Pod 供應 API 提供編碼和有條件的廣告區隔存取權,並以這種方式,直接將這些片段拼接至面向使用者的 HLS 或 MPEG-DASH 媒體播放清單。對於 MPEG-DASH,Pod Serve API 也提供資訊清單範本,為這些廣告區隔提供額外資訊和背景資訊。
本指南的重點是說明如何為直播活動實作基本的 Pod 服務資訊清單操控伺服器。
必備條件:在 Google Ad Manager 中設定直播活動
從 Pod 供應 API 提出任何要求之前,您必須先針對您處理的每個串流建立 Ad Manager 直播活動。您可以使用 LiveStreamEventService API
或 Google Ad Manager 網頁介面建立直播活動。
如要將直播活動與 Pod 供應 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,選取要與廣告拼接的內容串流。
將廣告區隔拼接為內容串流
視串流格式而定,拼接廣告區隔網址會有所不同。
HLS 串流
HLS 串流通常會以多變化版本資訊清單的形式提供,其中包含一組變化版本資訊清單的連結,對應每個編碼設定檔。
注意:為求簡單起見,本指南假設您的 HLS 媒體編碼格式將音訊和影片放到同一個片段檔案中。
Proxy 多變化版本播放清單
您需要將原始多變化版本播放清單中的每個變化版本播放清單網址替換為另一項對操縱工具的端點呼叫,以處理玩家所選的變化版本資訊清單。
拼接 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
Proxy 多變化版本資訊清單範例
#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 開始。如果是 mp4 初始化區隔,則為「init」。segment_duration
:目前區段的時間長度 (以毫秒為單位)。除了 Pod 中的最後一個區隔以外,所有區隔的這個值應相同。segment_offset
:將前一個區段的時間長度新增至區段偏移 (以毫秒為單位) 來計算區隔偏移last
:識別廣告連播中最後一個區隔的布林值。預設值為 false。
建立廣告區隔網址
將廣告插播內的每個區段換成以下格式的網址:
/linear/pods/v1/seg/network/{network_code}/custom_asset/{custom_asset_key}/pod/{pod_id}/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_id
|
廣告插播的 ID。應為從 1 開始的整數,並為每個廣告插播遞增 1。在目前事件中,觀看同一個廣告插播的所有使用者的這個值必須相同。 |
profile_name
|
所要求設定檔的 ID。 |
segment_number
|
這個區隔在目前廣告連播中的索引,從零開始。 使用 MP4 容器時,只要將 segment_number 設為「init」,即可要求初始化區隔。 |
查詢參數 | ||
---|---|---|
stream_id
|
必要 | 透過串流建立要求傳回的使用者 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/pod/1/profile/devrel4628000/0.ts?sd=5005&so=0&pd=18015&auth-token=custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~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/pod/1/profile/devrel4628000/1.ts?sd=5005&so=5005&pd=18015&auth-token=custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~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/pod/1/profile/devrel4628000/2.ts?sd=5005&so=10010&pd=18015&auth-token=custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~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/pod/1/profile/devrel4628000/3.ts?sd=3000&so=15015&pd=18015&auth-token=custom_asset_key%3DiYdOkYZdQ1KFULXSN0Gi7g~cust_params%3D~exp%3D1489680000~network_code%3D6062~pd%3D180000~pod_id%3D5~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 Pod Delivery 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$$ |
這個時段代表的廣告連播索引。在所有觀看者工作階段中,同一個 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>
恭喜!您正在放送含 DAI Pod 供應 API 所提供廣告區段的 DASH 直播。
其他資源
- 透過 IMA SDK 放送廣告連播:
- 使用 DAI API 放送廣告連播