檢舉連續播放
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
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 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eThe 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.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esetContinuousPlayback()\u003c/code\u003e method indicates if videos will autoplay sequentially, similar to a TV broadcast, while \u003ccode\u003esetAdWillAutoPlay()\u003c/code\u003e specifies if ads themselves will autoplay.\u003c/p\u003e\n"],["\u003cp\u003eThis 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.\u003c/p\u003e\n"],["\u003cp\u003ePublishers should align these settings with their content strategy: single videos with user interaction require neither, single autoplaying videos need \u003ccode\u003esetAdWillAutoPlay(true)\u003c/code\u003e, playlists with autoplay after the first video use \u003ccode\u003esetContinuousPlayback(true)\u003c/code\u003e, and fully autoplaying playlists utilize both.\u003c/p\u003e\n"]]],[],null,["# Report continuous play\n\nThe IMA SDK for HTML5 allows for setting the continuous play context for an ads request. The `\n`[setContinuousPlayback()](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRequest#setContinuousPlayback) method notifies the SDK whether the player intends to continuously play the content videos one after another, similar to a TV broadcast. When set to `true`, the ads returned from the request are those designated by the ads server as suitable for continuous play. Not calling this method leaves the setting as unknown. **Note:** Changing this setting has no impact on ad playback.\nThe following sample demonstrates how to set continuous play in an ads request. \n\n```gdscript\nvar adsRequest = new google.ima.AdsRequest();\nadsRequest.adTagUrl(adTagUrl);\nadsRequest.setContinuousPlayback(true);\nadsLoader.requestAds(adsRequest);\n```\n\nHow continuous play differs from ad auto-play\n---------------------------------------------\n\nThe IMA SDK for HTML5 also allows for setting whether the player will start playing automatically or wait for user action to begin playing. This is done using the `\n`[setAdWillAutoPlay()](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRequest#setAdWillAutoPlay) method. When set to `true`, the ads returned are those designated by the ads server as suitable for an auto-play environment.\n\n\nThis table details when to request ads for continuous play and auto-play, based on the video content\nthe ads are paired with.\n\n| Video Content | Parameter for setContinuousPlayback() | Parameter for setAdWillAutoPlay() |\n|------------------------------------------------------------------------------------------------------|---------------------------------------|-----------------------------------|\n| A single content video that plays upon user interaction | `false` | `false` |\n| A single content video that autoplays | `false` | `true` |\n| A video playlist that plays the first video upon user interaction but autoplays the following videos | `true` | `false` |\n| A video playlist that autoplays the first video and autoplays the following videos | `true` | `true` |"]]