ima。 StreamRequest
建構函式
StreamRequest
new StreamRequest()
用於指定流請求的屬性。
屬性
adTagParameters
字串
(選用步驟) 您可以在串流請求中覆寫一組有限的廣告代碼參數。 如需更多資訊,請參閱「為串流提供指定目標參數」。您也可以使用 dai-ot 和 dai-ov 參數,設定偏好的串流變體。詳情請參閱「覆寫串流變體參數」。
adUiNode
roSGNode
廣告 UI 顯示的場景圖節點。IMA 會在廣告期間,將「為什麼會顯示這則廣告?」和「略過」按鈕等元素放在這個元素上。元素必須疊加在整個影片元素上。
apiKey
字串
(選用步驟) 這些金鑰可用於驗證流程請求。 必須在 DFP UI 中設定 DAI 驗證金鑰。
assetKey
字串
直播需要用到。這是用來決定應該播放哪個視訊串流的。即時串流請求 asset key 是一個標識符,可以在 DFP UI 中找到。
authToken
字串
串流請求授權令牌。用於取代 API 金鑰,以實現更嚴格的內容授權。發布者可以根據此令牌控制各個內容流的授權。
contentSourceId
字串
這是隨選串流的必要項目。 cmsid 來自 DFP 使用者介面中的 DFP 影片內容來源。
customAssetKey
字串
自訂資源鍵用於決定應該播放哪個串流。 pod 服務流程請求需要自訂資產金鑰。
format
串流格式。預設值為 ima.StreamFormat.HLS。
networkCode
字串
提出串流要求的發布商聯播網代碼。使用 createPodLiveStreamRequest 或 createPodVodStreamRequest 提出 Pod 放送串流要求時,必須提供電視網代碼。使用 createVideoStitcherLiveStreamRequest、createVideoStitcherVodStreamRequest 或 createVideoStitcherVodStreamRequestWithVodConfig 發出 Cloud 縫合串流要求時,也需要這些代碼。這些代碼是選用項目,建議用於透過 createLiveStreamRequest 或 createVodStreamRequest 提出的全方位服務串流要求。加入聯播網代碼後,系統會套用在 Ad Manager UI 中選取的設定,例如啟用程式輔助受限制廣告。如果是 Pod 放送和雲端縫合,新增聯播網代碼即可找到並播放串流。如要找出聯播網代碼,請參閱這篇文章。
球員
(ima.Player 或無效)
玩家介面的實現。
ppid
字串
已淘汰,使用 adTagParameters。 (選用步驟) DFP Audience 發布商提供的 ID。
streamActivityMonitorId
字串
用於透過流活動監視器調試流的 ID。 這是為了方便發布者在串流活動監控工具中尋找串流日誌而採取的措施。
videoId
字串
這是隨選串流的必要項目。 影片內容來源的 ID。
videoObject
(roVideo 或無效)
負責客戶端應用程式影片播放的影片物件(例如 Video roSGNode)。系統會輪詢此物件以取得各種數據,用於正確計時 Live HLS ID3 事件。
videoStitcherSessionOptions
V 的數組
會話選項用於為 VideoStitcher 串流請求設定視訊拼接器特定的參數。
方法
createLiveStreamRequest
createLiveStreamRequest(assetKey, apiKey, networkCode) 回傳 ima.StreamRequest
初始化 Live StreamRequest 的必要屬性。使用這個 API 會導致系統忽略任何其他 StreamType 專屬屬性。如果任何必要參數為空字串,系統會記錄錯誤,且 API 會傳回一般 StreamRequest,不會忽略任何屬性。
參數 |
|
|---|---|
|
assetKey |
字串 |
|
apiKey |
字串 指派給傳回 |
|
networkCode |
字串 提出串流要求的發布商聯播網代碼。網路代碼為選填項目,但建議填寫。 |
- 傳回
-
ima.StreamRequestima.StreamRequest具有必需的 Live 屬性的物件。
createPodLiveStreamRequest
createPodLiveStreamRequest(customAssetKey, networkCode, apiKey) 回傳 StreamRequest
初始化 Pod Live ima.StreamRequest 的必要屬性。
使用此 API 會導致忽略任何其他 ima.StreamType 特定屬性。
如果任何必需參數為空字串,則會記錄錯誤日誌,且 API 傳回通用的 StreamRequest,不忽略任何屬性。
參數 |
|
|---|---|
|
customAssetKey |
字串 |
|
networkCode |
字串 |
|
apiKey |
字串 指派給傳回的 |
- 傳回
-
StreamRequestima.StreamRequest具有必要 PodLive 屬性的物件。
createPodVodStreamRequest
createPodVodStreamRequest(networkCode) returns StreamRequest
初始化 ima.StreamRequest 的必要屬性,以便在使用第三方影片縫合器透過 DAI Pod 放送廣告時,註冊 VOD 串流。這項函式會將要求類型設為 ima.StreamType.POD_VOD,並驗證所有必要屬性是否缺少資料。驗證失敗時,偵錯控制台會記錄錯誤。
參數 |
|
|---|---|
|
networkCode |
字串 Google Ad Manager 網路程式碼 |
- 傳回
-
StreamRequestima.StreamRequest物件。如果指定所有必要屬性,要求類型會設為ima.StreamType.POD_VOD。
createStreamRequest
createStreamRequest() 會傳回 ima.StreamRequest
- 傳回
-
ima.StreamRequest空白ima.StreamRequest物件。
createVideoStitcherLiveStreamRequest
createVideoStitcherLiveStreamRequest(customAssetKey、networkCode、liveConfigId、region、projectNumber、oAuthToken) returns ima.StreamRequest
初始化 Video Stitcher Live StreamRequest 的必要屬性。使用此 API 會導致系統忽略任何其他 StreamType 專屬屬性。如果任何必要參數為空字串,系統會記錄錯誤,且 API 會傳回一般 StreamRequest,不會忽略任何屬性。
參數 |
|
|---|---|
|
customAssetKey |
字串 |
|
networkCode |
字串 |
|
liveConfigId |
字串 |
|
區域 |
字串 |
|
projectNumber |
字串 |
|
oAuthToken |
字串 |
- 傳回
-
ima.StreamRequestima.StreamRequest具有必要 VideoStitcherLive 屬性的物件。
createVideoStitcherVodStreamRequest
createVideoStitcherVodStreamRequest(adTagUrl, networkCode, contentSourceUrl, region, projectNumber, oAuthToken) 回傳 ima.StreamRequest
初始化 Video Stitcher VOD StreamRequest 的必要屬性。使用此 API 會導致系統忽略任何其他 StreamType 專屬屬性。如果任何必要參數為空字串,系統會記錄錯誤,且 API 會傳回一般 StreamRequest,不會忽略任何屬性。
參數 |
|
|---|---|
|
adTagUrl |
字串 |
|
networkCode |
字串 |
|
contentSourceUrl |
字串 |
|
區域 |
字串 |
|
projectNumber |
字串 |
|
oAuthToken |
字串 |
- 傳回
-
ima.StreamRequestima.StreamRequest具有必要的 VideoStitcherVod 屬性的物件。
createVideoStitcherVodStreamRequestWithVodConfig
createVideoStitcherVodStreamRequestWithVodConfig(vodConfigId, networkCode, region, projectNumber, oAuthToken) 回傳 ima.StreamRequest
使用從 Cloud Video Stitcher 建立的 vodConfigId,初始化 Video Stitcher VOD 的必要屬性。StreamRequest使用此 API 會導致系統忽略任何其他 StreamType 專屬屬性。如果任何必要參數為空字串,系統會記錄錯誤,且 API 會傳回一般 StreamRequest,不會忽略任何屬性。
參數 |
|
|---|---|
|
vodConfigId |
字串 |
|
networkCode |
字串 |
|
區域 |
字串 |
|
projectNumber |
字串 |
|
oAuthToken |
字串 |
- 傳回
-
ima.StreamRequestima.StreamRequest具有必要的 VideoStitcherVod 屬性的物件。
createVodStreamRequest
createVodStreamRequest(contentSourceId, videoId, apiKey, networkCode) returns ima.StreamRequest
初始化 VOD ima.StreamRequest 的必要屬性。使用這個 API 會導致系統忽略任何其他 ima.StreamType 專屬屬性。如果任何必要參數為空字串,系統會記錄錯誤,且 API 會傳回一般 StreamRequest,不會忽略任何屬性。
參數 |
|
|---|---|
|
contentSourceId |
字串 |
|
videoId |
字串 |
|
apiKey |
字串 指派給傳回 |
|
networkCode |
字串 提出串流要求的發布商聯播網代碼。網路代碼為選填項目,但建議填寫。 |
- 傳回
-
ima.StreamRequestima.StreamRequest物件,其中包含必要的 VOD 屬性。