Pod Serving API 可讓您存取已編碼及條件設定的廣告區段,並以可直接拼接至面向使用者的 HLS 或 MPEG-DASH 媒體播放清單的方式進行準備。針對 MPEG-DASH,Pod Serving API 也會提供資訊清單範本,為這些廣告區段提供額外資訊和背景資訊。
本指南著重於為直播實作基本 Pod 放送資訊清單操控伺服器。
必要條件:在 Google Ad Manager 中設定直播活動
請先為每個要處理的串流建立 Ad Manager 直播活動,再向 Pod Serving API 發出任何要求。您可以使用 LiveStreamEventService API
或 Google Ad Manager 網頁介面建立直播活動。
如要將直播活動與 Pod Serving 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 媒體編碼採用 格式,將音訊和影片結合成同一個片段檔案。
代理多變化版本播放清單
您必須替換原始多變化版本中的每個變化版本播放清單網址 用另一個端點呼叫播放清單來處理玩家的 所選變化版本的資訊清單。
拼接 HLS 的其餘步驟會假設單一變數的資訊清單。 正在處理。
可能的變化版本要求端點示例
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
:廣告連播中的區隔索引 (從 0 開始)。或「init」mp4 初始化片段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
|
這個片段在目前廣告連播中的索引,從 0 開始。 使用 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 索取週期範本。這個範本會成為 廣告插播時段,就會填入巨集中的巨集。
每個串流工作階段只應要求這個範本一次,並將其快取,以便在每次廣告插播時重複使用。
期間範本要求 Endpointhjf
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 |
在破折號週期範本中,每個廣告媒體區段的時間長度 (以毫秒為單位)。 |
要求範例 (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$$ |
此時段代表的廣告連播索引。這個值必須符合以下項目: 相同的廣告連播 | 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 放送 Pod 播放內容:
- 使用 DAI API 進行廣告連播放送播放