回報連續播放
HTML5 的 IMA SDK 可讓您設定
廣告請求。
setContinuousPlayback()
方法會通知 SDK 播放器是否打算連續播放內容影片
類似電視節目設為
true
時,系統會從
請求是由廣告伺服器指定適合連續播放。非
呼叫這個方法
則將設定維持在不明狀態
以下範例說明如何在廣告請求中設定連續播放。
var adsRequest = new google.ima.AdsRequest();
adsRequest.adTagUrl(adTagUrl);
adsRequest.setContinuousPlayback(true);
adsLoader.requestAds(adsRequest);
連續播放與廣告自動播放的差異
HTML5 的 IMA SDK 還可讓您設定播放器是否會開始播放
自動或等待使用者動作開始播放。方法是使用
setAdWillAutoPlay()
方法。設為
true
時,系統會傳回廣告指定的廣告
適用於自動播放環境
此表格詳細列出根據影片內容,要求連續播放和自動播放廣告的時機
與廣告配對
影片內容 |
setContinuousPlayback() 參數 |
setAdWillAutoPlay() 的參數 |
在使用者進行互動時播放的單一內容影片 |
false |
false |
自動播放的單一內容影片 |
false |
true |
在使用者進行互動後,播放第一部影片但自動播放
追蹤的影片 |
true |
false |
自動播放第一部影片並自動播放下列影片的影片播放清單 |
true |
true |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-10-15 (世界標準時間)。
[null,null,["上次更新時間:2024-10-15 (世界標準時間)。"],[[["The IMA SDK for HTML5 allows publishers to set the continuous play context for ad requests, signaling whether content videos will play continuously, influencing the ads served."],["The `setContinuousPlayback()` method indicates if videos will autoplay sequentially, similar to a TV broadcast, while `setAdWillAutoPlay()` specifies if ads themselves will autoplay."],["This distinction is crucial as continuous play impacts ad selection from the ad server, ensuring ads suitable for continuous content are delivered, while autoplay dictates ad playback behavior."],["Publishers should align these settings with their content strategy: single videos with user interaction require neither, single autoplaying videos need `setAdWillAutoPlay(true)`, playlists with autoplay after the first video use `setContinuousPlayback(true)`, and fully autoplaying playlists utilize both."]]],[]]