Google 動態廣告插播 (DAI) 連播放送 API,為直播活動啟用伺服器端廣告插播 (SSAI)。
Pod Serving API 可存取經過編碼和處理的廣告片段,這些片段已準備就緒,可直接併入面向使用者的 HLS 或 MPEG-DASH 媒體播放清單。如果是 MPEG-DASH,Pod Serving API 也會提供資訊清單範本,為這些廣告片段提供額外資訊和脈絡。
本指南著重於為直播活動實作基本的廣告連播放送資訊清單操控伺服器。
必要條件:在 Google Ad Manager 中設定直播活動
向廣告連播放送 API 發出任何請求前,您必須為處理的每個串流建立 Ad Manager 直播活動。你可以使用 LiveStreamEventService API
或 Google Ad Manager 網頁介面建立直播活動。
如要將直播活動與廣告連播放送 API 搭配使用,您需要填入活動的多個屬性:
customAssetKey
:用於這個活動的自訂 ID。必須和聯播網的所有活動都不同。adTags
- Ad Manager 廣告投放工作流程產生的主要廣告代碼網址。dynamicAdInsertionType
- 必須設為POD_SERVING_REDIRECT
。streamingFormat
- 視情況設為HLS
或DASH
。segmentUrlAuthenticationKeyIds
- 至少一個用於簽署廣告區隔要求的 HMAC 金鑰。daiEncodingProfileIds
:為此活動啟用的 DAIEncodingProfile ID 清單。startDateTime
- 活動的開始日期和時間endDateTime
- 這個活動的預定結束日期和時間。如果unlimitedEndDateTime
is false and ignored if
unlimitedEndDateTimeis true.
unlimitedEndDateTime` - 布林值,則這個屬性為必填。如上所示。
接收串流資訊清單要求
資訊清單操控器必須提供 API 端點,才能監聽影片播放器用戶端應用程式的資訊清單要求。這個端點至少要從用戶端播放器應用程式收集串流 ID,並傳回已縫合的串流資訊清單。串流 ID 用於向 Ad Manager 識別串流工作階段。
您也需要收集其他資訊,例如內容 ID,以識別適當的內容串流。
潛在資訊清單要求端點範例
GET /api/video/{asset_key}/manifest.{format}
Host: {your_domain}
路徑參數 | |||||
---|---|---|---|---|---|
asset_key |
您系統中與所要求直播影片對應的假設 ID。 | ||||
format |
與串流格式對應的假設參數。下列其中一項:
|
查詢參數 | |
---|---|
stream_id |
用戶端影片播放器應用程式的 Ad Manager 串流 ID。 |
擷取內容串流
使用從資訊清單要求收集的內容 ID,選取要與廣告縫合的內容串流。
將廣告片段縫合到內容串流中
視串流格式而定,廣告片段網址的縫合方式也會有所不同。
HTTP 即時串流
HLS 串流通常會以多變體資訊清單的形式提供,其中包含一組變體資訊清單的連結,分別對應至各個編碼設定檔。
注意:為簡化說明,本指南假設您的 HLS 媒體是以某種格式編碼,可將音訊和視訊多工處理至同一區段檔案。
Proxy 多變化版本播放清單
您必須在原始多變體播放清單中,將每個變體播放清單網址替換為另一個對操縱器的端點呼叫,以處理播放器選取的變體資訊清單。
後續的 HTTP 即時串流拼接步驟會假設處理的是單一變體資訊清單。
潛在變體要求端點範例
GET /api/video/{asset_key}/variant/{variant_id}.m3u8
Host: {your_domain}
路徑參數 | |
---|---|
asset_key |
您系統中與所要求直播影片對應的假設 ID。 |
variant |
假設性參數,內含正在處理的特定變體 ID。 |
查詢參數 | |
---|---|
stream_id |
用戶端影片播放器應用程式的 Ad Manager 串流 ID,用於透過資訊清單操控器識別使用者工作階段。 |
未處理的多變化版本資訊清單範例
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080,CODECS="avc1.4d000c,mp4a.40.5"
https://cdn.{...}/1080p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720,CODECS="avc1.4d000c,mp4a.40.5"
https://cdn.{...}/720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=640x360,CODECS="avc1.4d000d,mp4a.40.5"
https://cdn.{...}/360p.m3u8
範例代理多變體資訊清單
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080,CODECS="avc1.4d000c,mp4a.40.5"
https://{manifest_manipulator}/api/video/tears_of_steel/variant/1080p.m3u8?stream_id=6e69425c-0ac5-43ef-b070-c5143ba68541:CHS
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720,CODECS="avc1.4d000c,mp4a.40.5"
https://{manifest_manipulator}/api/video/tears_of_steel/variant/720p.m3u8?stream_id=6e69425c-0ac5-43ef-b070-c5143ba68541:CHS
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=640x360,CODECS="avc1.4d000d,mp4a.40.5"
https://{manifest_manipulator}/api/video/tears_of_steel/variant/360p.m3u8?stream_id=6e69425c-0ac5-43ef-b070-c5143ba68541:CHS
找出廣告插播片段並插入不連續點
處理變體資訊清單時,請追蹤下一個即將到來的廣告插播的開始時間、長度和索引,直到處理中的動態資訊清單包含將由廣告內容取代的區隔為止。
視編碼器而定,廣告插播點與內容片段的分界方式可能不同。如要劃分廣告插播時間,常見做法是在廣告片段前加上 #EXT-X-CUE-OUT
標記,然後加上 #EXT-X-CUE-IN
標記。
如要將 Google 代管的廣告插播與內容片段分開,您必須在每個廣告插播的開頭和結尾插入 #EXT-X-DISCONTINUITY
標記。如果最終資訊清單中沒有這些不連續標記,播放就會失敗。
插入的廣告區隔 URI 未加密。如果內容經過加密,您也必須在每個廣告時段的第一個廣告片段前指定 #EXT-X-KEY:METHOD=NONE
,移除加密,然後在廣告時段後重新加入加密。
資訊清單範例 (原始)
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:5.005,
contentorigin.com/1.ts
#EXTINF:5.005,
contentorigin.com/2.ts
#EXT-X-CUE-OUT:15.000
#EXTINF:5.005,
contentorigin.com/3.ts
#EXTINF:5.005,
contentorigin.com/4.ts
#EXTINF:5.005,
contentorigin.com/5.ts
#EXTINF:5.000,d
contentorigin.com/6.ts
#EXT-X-CUE-IN
#EXTINF:5.005,
contentorigin.com/7.mp4
#EXTINF:5.005,
contentorigin.com/8.mp4
插入不連續點的資訊清單
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:5.005,
contentorigin.com/1.ts
#EXTINF:5.005,
contentorigin.com/2.ts
#EXTINF:5.005,
#EXT-X-DISCONTINUITY
{... New segments will go here ...}
#EXT-X-DISCONTINUITY
#EXTINF:5.005,
contentorigin.com/7.mp4
#EXTINF:5.005,
contentorigin.com/8.mp4
處理廣告連播區隔
您必須追蹤廣告插播中每個片段的幾個額外值:
segment_number
:廣告插播中的片段索引,從零開始。或是 mp4 初始化區隔的「init」。segment_duration
:目前區段的時間長度 (以毫秒為單位)。除了 Pod 中的最後一個區段外,所有區段的值都應相同。segment_offset
:區隔偏移量,計算方式為將前一個區隔的持續時間加到其區隔偏移量 (以毫秒為單位)last
:布林值,用於識別廣告插播中的最後一個片段。預設值為 false。
建立廣告區隔網址
將廣告插播時間軸中的每個區段,替換為以下格式的網址:
/linear/pods/v1/seg/network/{network_code}/custom_asset/{custom_asset_key}/{pod_identifier}/profile/{profile_name}/{segment_number}.(ts|mp4|vtt|aac|ac3|eac3)
路徑參數 | |
---|---|
network_code
|
這個聯播網的 Ad Manager 360 聯播網代碼。 |
custom_asset_key
|
在 LiveStreamEventService API 或 Ad Manager 360 網頁介面的直播頁面中指定的自訂直播素材資源金鑰。 |
pod_identifier |
支援的格式如下: pod/{integer}
目前廣告插播的數字 ID。系統會為每個廣告插播事件遞增指派廣告組 ID,從 ad_break_id/{string}
目前廣告插播的字串 ID。 |
profile_name
|
所要求設定檔的 ID, |
segment_number
|
目前廣告插播中這個片段的索引,從零開始。 使用 MP4 容器時,您可以將 segment_number 設為「init」,要求初始化片段。 |
查詢參數 | ||
---|---|---|
stream_id
|
必要 | 使用者從 Stream Create 要求傳回的 stream_id 參數。
|
sd
|
必要 | segment_duration
|
so
|
選填 | segment_offset
如果缺少 |
pd
|
必填,但啟用未指定時間長度的廣告插播時除外 | 廣告插播的時間長度 (以毫秒為單位)。也稱為「ad_pod_duration 」。 |
auth-token
|
必要 | 這個廣告插播的已簽署網址編碼 HMAC 權杖。 |
last
|
選填 | 布林值,指出廣告插播中的最後一個片段。預設值為 false。 |
查詢參數值必須經過適當編碼,才能確保網址安全。這對 auth-token
欄位尤其重要,因為該欄位可能包含 /
、+
和 =
字元。
資訊清單範例 (替換片段後)
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:5.005,
contentorigin.com/1.ts
#EXTINF:5.005,
contentorigin.com/2.ts
#EXT-X-DISCONTINUITY
#EXTINF:5.005,
https://dai.google.com/linear/pods/v1/seg/network/6062/custom_asset/iYdOkYZdQ1KFULXSN0Gi7g/ad_break_id/adbreak1/profile/devrel4628000/0.ts?sd=5005&so=0&pd=18015&auth-token=ad_break_id%3Dadbreak1~custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~hmac%3D44bf78223c240cbc5bae3cdfd794bfc6971b6583cd296f44ef3a46944605cf9a&stream_id=fe6c9136-09a4-4ff6-862e-daee1dea0e1b:MRN2
#EXTINF:5.005,
https://dai.google.com/linear/pods/v1/seg/network/6062/custom_asset/iYdOkYZdQ1KFULXSN0Gi7g/ad_break_id/adbreak1/profile/devrel4628000/1.ts?sd=5005&so=5005&pd=18015&auth-token=ad_break_id%3Dadbreak1~custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~hmac%3D44bf78223c240cbc5bae3cdfd794bfc6971b6583cd296f44ef3a46944605cf9a&stream_id=fe6c9136-09a4-4ff6-862e-daee1dea0e1b:MRN2
#EXTINF:5.005,
https://dai.google.com/linear/pods/v1/seg/network/6062/custom_asset/iYdOkYZdQ1KFULXSN0Gi7g/ad_break_id/adbreak1/profile/devrel4628000/2.ts?sd=5005&so=10010&pd=18015&auth-token=ad_break_id%3adbreak1~custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~hmac%3D44bf78223c240cbc5bae3cdfd794bfc6971b6583cd296f44ef3a46944605cf9a&stream_id=fe6c9136-09a4-4ff6-862e-daee1dea0e1b:MRN2
#EXTINF:3.000,
https://dai.google.com/linear/pods/v1/seg/network/6062/custom_asset/iYdOkYZdQ1KFULXSN0Gi7g/ad_break_id/adbreak1/profile/devrel4628000/3.ts?sd=3000&so=15015&pd=18015&auth-token=ad_break_id%3Dadbreak1~custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~hmac%3D44bf78223c240cbc5bae3cdfd794bfc6971b6583cd296f44ef3a46944605cf9a&stream_id=fe6c9136-09a4-4ff6-862e-daee1dea0e1b:MRN2&last=true
#EXT-X-DISCONTINUITY
#EXTINF:5.005,
contentorigin.com/7.mp4
#EXTINF:5.005,
contentorigin.com/8.mp4
恭喜!您現在放送的直播含有 DAI 廣告連播放送 API 提供的廣告片段。
DASH 串流
DASH 串流會以 MPD 檔案的形式提供,其中包含單一檔案中的所有串流編碼,而內容則以一系列時段表示。
要求期間範本
向 Google Ad Manager 索取週期範本。填入巨集後,這個範本就會成為廣告插播期。
每個串流工作階段只能要求這個範本一次,並快取範本,以便在每個廣告插播時重複使用。
週期範本要求端點
GET /linear/pods/v1/dash/network/{network_code}/custom_asset/{custom_asset}/pods.json
Host: dai.google.com
Content-Type: application/json
路徑參數 | |
---|---|
network_code |
發布商的 Ad Manager 360 聯播網代碼。 |
custom_asset |
Google Ad Manager 中直播活動的自訂資產金鑰。 |
查詢參數 | |
---|---|
stream_id |
用戶端影片播放器的 Ad Manager 串流 ID。 |
回應 JSON | |
---|---|
dash_period_template |
週期範本 XML 字串。 |
segment_duration_ms |
DASH 期間範本中每個廣告媒體片段的時間長度 (以毫秒為單位)。 |
要求範例 (cURL)
curl https://dai.google.com/linear/pods/v1/dash/network/21775744923/custom_asset/tears_of_steel/pods.json?stream-id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS
回應範例
{"dash_period_template":"<Period id="adpod-$$pod-id$$" $$period-start$$ $$period-duration$$> <BaseURL>https://dai.google.com/linear/pods/v1/seg/event/{event_code}/pods/$$pod-id$$/profile/</BaseURL>
<SegmentTemplate initialization="$RepresentationID$/init.mp4?stream_id={a-stream-id}&sd=5000&pd=$$pod-duration$$&cust_params=$$cust_params$$&auth_token=$$token$$" media="$RepresentationID$/$Number$.mp4?stream_id={a-stream-id}&sd=5000&pd=$$pod-duration$$&cust_params=$$cust_params$$&scte35=$$scte35$$&auth_token=$$token$$" startNumber="1" presentationTimeOffset="0">
<SegmentTimeline>
<S t="0" d="5" r="$$number-of-repeated-segments$$"/>
</SegmentTimeline>
</SegmentTemplate>
<AdaptationSet id="0" width="1280" height="720" frameRate="30" contentType="video" subsegmentAlignment="true" startWithSAP="1">
<InbandEventStream schemeIdUri="https://developer.apple.com/streaming/emsg-id3"/>
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation mimeType="video/mp4" codecs="avc1.640029" id="a943ff679a2f3e71d9181a21b7542122g" bandwidth="3200000"/>
<Representation mimeType="video/mp4" codecs="avc1.640029" id="abbbd80q4w5ce2fs28308rd1f4g4bat0" bandwidth="1500000"/>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio"> <Representation audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2" id="a87ff679a2f3e71d9181a67b7542122c" bandwidth="95000"/>
<Representation audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2" id="eccbc87e4b5ce2fe28308fd9f2a7baf3" bandwidth="127000"/>
</AdaptationSet>
</Period>",
"segment_duration_ms":5000}
填入週期範本
週期範本包含多個巨集,您必須為每個廣告插播替換這些巨集。所有巨集都必須替換。未使用的巨集應替換為空字串 ("")。
巨集 | 說明 | 範例 |
---|---|---|
$$pod-id$$ |
這個期間代表的廣告連播索引。在所有觀眾工作階段中,相同 Pod 的這個值必須一致。 | 1 |
$$period-start$$ |
目前 MPD 中期間的開始時間。選用屬性,應由 start="###" 取代,其中 ### 是廣告插播開始的呈現時間。如果未提供時間範圍的開始時間,這個巨集應替換為空白字串。 |
start="PT2H33M30S" |
$$period-duration$$ |
完整廣告期間的長度。選用屬性,應由 duration="###" 取代,其中 ### 是以標準 DASH 持續時間格式表示的廣告期間長度。如果未提供時間範圍的長度,這個巨集應替換為空白字串。 |
duration="PT15S" |
$$pod-duration$$ |
這個廣告連播預期裁決的廣告時間長度,以毫秒為單位。 | 15000 |
$$number-of-repeated-segments$$ |
這個值的計算方式是將廣告期間長度 (以毫秒為單位) 除以 segment_duration_ms 的值,然後無條件進位至最接近的整數。 | 3 |
$$cust_params$$ |
如果提供,這個巨集可以替換為目前廣告插播專用的自訂指定目標參數。值的格式必須符合這篇 Ad Manager 說明中心文章的說明。如不需自訂參數,請將這個巨集換成空白字串。 |
&cust_params=section%3Dblog%26anotherKey%3Dvalue1%2Cvalue2
|
$$scte35$$ |
如果提供廣告插播專屬的 scte35 值,則必須替換這個巨集。如不需要 scte35 資訊,請將這個巨集替換為空白字串。 |
/DAqAAAAAAAA///wDwVAAAT2f0/+ecF1mQABC/8ACgAIQ1VFSQAAAAsuZVlR
|
$$token$$ |
已簽署的網址編碼 HMAC 權杖。這是必要權杖。 |
custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~hmac%3D6a8c44c72e4718ff63ad2284edf2a8b9e319600b430349d31195c99b505858c9
|
含有巨集的原始週期範本
<Period id="adpod-$$pod-id$$" $$period-start$$ $$period-duration$$>
<BaseURL>
https://dai.google.com/linear/pods/v1/seg/event/{event_code}/pods/$$pod-id$$/profile/
</BaseURL>
<SegmentTemplate initialization="$RepresentationID$/init.mp4?stream_id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS&sd=5000&pd=$$pod-duration$$&cust_params=$$cust_params$$&auth_token=$$token$$" media="$RepresentationID$/$Number$.mp4?stream_id=ç√&sd=5000&pd=$$pod-duration$$&cust_params=$$cust_params$$&scte35=$$scte35$$&auth_token=$$token$$" startNumber="1" presentationTimeOffset="0">
<SegmentTimeline>
<S t="0" d="5" r="$$number-of-repeated-segments$$"/>
</SegmentTimeline>
</SegmentTemplate>
<AdaptationSet id="0" width="1280" height="720" frameRate="30" contentType="video" subsegmentAlignment="true" startWithSAP="1">
<InbandEventStream schemeIdUri="https://developer.apple.com/streaming/emsg-id3"/>
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation mimeType="video/mp4" codecs="avc1.640029" id="a943ff679a2f3e71d9181a21b7542122g" bandwidth="3200000"/>
<Representation mimeType="video/mp4" codecs="avc1.640029" id="abbbd80q4w5ce2fs28308rd1f4g4bat0" bandwidth="1500000"/>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio"> <Representation audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2" id="a87ff679a2f3e71d9181a67b7542122c" bandwidth="95000"/>
<Representation audioSamplingRate="48000" mimeType="audio/mp4" codecs="mp4a.40.2" id="eccbc87e4b5ce2fe28308fd9f2a7baf3" bandwidth="127000"/>
</AdaptationSet>
</Period>
已填入廣告的期間
<Period id="pod-0" start="PT5H50M12S">
<BaseURL>
https://dai.google.com/linear/pods/v1/seg/event/M-nTcApTRTi6CEGIt4GYMw/pod/0/profile/
</BaseURL>
<SegmentTemplate startNumber="0" media="1080p/0.mp4?stream_id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS&sd=5000&pd=30000&cust_params=&auth-token=&scte35=" initialization="$RepresentationID$/init.mp4?stream_id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS&pd=30000&cust_params=&auth-token=&scte35=">
<SegmentTimeline>
<S d="5" r="1"/>
</SegmentTimeline>
</SegmentTemplate>
<AdaptationSet mimeType="video/mp4" scanType="progressive" contentType="video">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation width="768" height="432" frameRate="30" codecs="avc1.42c01e" id="fmp4-video-1200k" bandwidth="1300000">
<InbandEventStream schemeIdUri="https://developer.apple.com/streaming/emsg-id3"/>
</Representation>
</AdaptationSet>
<AdaptationSet mimeType="audio/mp4" scanType="progressive" contentType="audio">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation audioSamplingRate="48000" codecs="mp4a.40.2" id="fmp4-audio-128kbps" bandwidth="128000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
將填入的週期插入 DASH 資訊清單
最後,請在原始資訊清單中,將適當的時間週期替換為新填入的廣告時間週期,並將最終縫合的資訊清單傳回給要求播放的影片用戶端。
原始內容資訊清單範例
<?xml version="1.0"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:DASH:schema:MPD:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011" profiles="urn:mpeg:dash:profile:isoff-main:2011" type="static" mediaPresentationDuration="PT0H9M56.46S">
<BaseURL>
http://example.com/tears_of_steel/
</BaseURL>
<Period start="PT0S">
<AdaptationSet bitstreamSwitching="true">
<Representation id="0" codecs="avc1" mimeType="video/mp4" width="1920" height="1080" startWithSAP="1" bandwidth="500000">
<SegmentBase>
<Initialization sourceURL="segments/1080/1.m4s" range="0-862"/>
</SegmentBase>
<SegmentList duration="15">
<SegmentURL media="segments/1080p/2.m4s" mediaRange="863-7113"/>
<SegmentURL media="segments/1080p/3.m4s" mediaRange="7114-14104"/>
<SegmentURL media="segments/1080p/4.m4s" mediaRange="14105-17990"/>
...
</SegmentList>
</Representation>
<Representation id="1" codecs="avc1" mimeType="video/mp4" width="1280" height="720" startWithSAP="1" bandwidth="250000">
<SegmentBase>
<Initialization sourceURL="segments/720p/1.m4s" range="0-864"/>
</SegmentBase>
<SegmentList duration="15">
<SegmentURL media="segments/720p/2.m4s" mediaRange="865-11523"/>
<SegmentURL media="segments/720p/3.m4s" mediaRange="11524-25621"/>
<SegmentURL media="segments/720p/4.m4s" mediaRange="25622-33693"/>
...
</SegmentList>
</Representation>
<Representation id="1" codecs="avc1" mimeType="video/mp4" width="640" height="480" startWithSAP="1" bandwidth="100000">
<SegmentBase>
<Initialization sourceURL="segment/480p/1.m4s" range="0-865"/>
</SegmentBase>
<SegmentList duration="15">
<SegmentURL media="segment/480p/2.m4s" mediaRange="866-26970"/>
<SegmentURL media="segment/480p/3.m4s" mediaRange="26971-72543"/>
<SegmentURL media="segment/480p/4.m4s" mediaRange="72544-95972"/>
...
</SegmentList>
</Representation>
...
</AdaptationSet>
</Period end>
</MPD>
縫合資訊清單範例
<?xml version="1.0"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:DASH:schema:MPD:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011" profiles="urn:mpeg:dash:profile:isoff-main:2011" type="static" mediaPresentationDuration="PT0H9M56.46S">
<BaseURL>
http://example.com/tears_of_steel/
</BaseURL>
<Period id="pod-0" start="PT5H50M12S">
<BaseURL>
https://dai.google.com/linear/pods/v1/seg/event/M-nTcApTRTi6CEGIt4GYMw/pod/0/profile/
</BaseURL>
<SegmentTemplate startNumber="0" media="1080p/0.mp4?stream_id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS&sd=5000&pd=30000&cust_params=&auth-token=&scte35=$$scte35$$" initialization="$RepresentationID$/init.mp4?stream_id=cc59197a-44c0-4be2-a8cc-9a6fdb80158f:DLS&pd=30000&cust_params=&auth-token=&scte35=$$scte35$$">
<SegmentTimeline>
<S d="5" r="1"/>
</SegmentTimeline>
</SegmentTemplate>
<AdaptationSet mimeType="video/mp4" scanType="progressive" contentType="video">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation width="768" height="432" frameRate="30" codecs="avc1.42c01e" id="fmp4-video-1200k" bandwidth="1300000">
<InbandEventStream schemeIdUri="https://developer.apple.com/streaming/emsg-id3"/>
</Representation>
</AdaptationSet>
<AdaptationSet mimeType="audio/mp4" scanType="progressive" contentType="audio">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
<Representation audioSamplingRate="48000" codecs="mp4a.40.2" id="fmp4-audio-128kbps" bandwidth="128000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
恭喜!您現在放送的 DASH 直播,廣告片段是由 DAI 廣告連播放送 API 提供。
其他資源
- 使用 IMA SDK 播放廣告連播:
- 使用 DAI API 播放廣告連播