檢舉連續播放
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
tvOS 專用的 IMA SDK 可讓您設定
廣告請求。
continuousPlayback
屬性會通知 SDK 播放器是否打算連續播放內容影片
類似電視節目設為
true
時,系統會從
請求是由廣告伺服器指定適合連續播放。非
並指定下列項目的值
這項資源
則將設定維持在不明狀態
以下範例說明如何在廣告請求中設定連續播放。
Objective-C
IMAAdsRequest *request = [[IMAAdsRequest alloc]
initWithAdTagUrl:adTagUrl
adDisplayContainer:[self createAdDisplayContainer]
avPlayerVideoDisplay:[[IMAAVPlayerVideoDisplay alloc] initWithAVPlayer:self.contentPlayer]
pictureInPictureProxy:self.pictureInPictureProxy
userContext:nil];
request.continuousPlayback = true;
[self.adsLoader requestAdsWithRequest:request];
Swift
let request = IMAAdsRequest(
adTagUrl: adTagUrl,
adDisplayContainer: createAdDisplayContainer(),
avPlayerVideoDisplay: IMAAVPlayerVideoDisplay(avPlayer: contentPlayer),
pictureInPictureProxy: pictureInPictureProxy,
userContext: nil)
request.continuousPlayback = true;
adsLoader!.requestAds(with: request)
連續播放與廣告自動播放的差異
tvOS 專用的 IMA SDK 還可讓您設定播放器是否會開始播放
自動或等待使用者動作開始播放。方法是使用
adWillAutoPlay
資源。設為
true
時,系統會傳回廣告指定的廣告
適用於自動播放環境
此表格詳細列出根據影片內容,要求連續播放和自動播放廣告的時機
與廣告配對
影片內容 |
連續播放的值 |
adWillAutoPlay 的值 |
在使用者進行互動時播放的單一內容影片 |
false |
false |
自動播放的單一內容影片 |
false |
true |
在使用者進行互動後,播放第一部影片但自動播放
追蹤的影片 |
true |
false |
自動播放第一部影片並自動播放下列影片的影片播放清單 |
true |
true |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-01 (世界標準時間)。
[null,null,["上次更新時間:2025-08-01 (世界標準時間)。"],[[["\u003cp\u003eThe IMA SDK for tvOS allows you to set the \u003ccode\u003econtinuousPlayback\u003c/code\u003e property on ad requests to indicate if content videos will play continuously, influencing the types of ads returned.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003econtinuousPlayback\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e signals that videos will play one after another, similar to a TV broadcast, and retrieves ads designated for continuous play.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eadWillAutoPlay\u003c/code\u003e property determines whether ads will start playing automatically or require user interaction to begin.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the provided table to align \u003ccode\u003econtinuousPlayback\u003c/code\u003e and \u003ccode\u003eadWillAutoPlay\u003c/code\u003e settings with your specific video content behavior, such as single videos or playlists with autoplay functionality.\u003c/p\u003e\n"]]],[],null,["# Report continuous play\n\nThe IMA SDK for tvOS allows for setting the continuous play context for an ads request. The `\n`[continuousPlayback](/interactive-media-ads/docs/sdks/tvos/client-side/reference/Classes/IMAAdsRequest#continuousplayback) property 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 specifying a value for this property 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### Objective-C\n\n```objective-c\nIMAAdsRequest *request = [[IMAAdsRequest alloc]\n initWithAdTagUrl:adTagUrl\n adDisplayContainer:[self createAdDisplayContainer]\n avPlayerVideoDisplay:[[IMAAVPlayerVideoDisplay alloc] initWithAVPlayer:self.contentPlayer]\n pictureInPictureProxy:self.pictureInPictureProxy\n userContext:nil];\n request.continuousPlayback = true;\n [self.adsLoader requestAdsWithRequest:request];\n```\n\n### Swift\n\n```swift\nlet request = IMAAdsRequest(\n adTagUrl: adTagUrl,\n adDisplayContainer: createAdDisplayContainer(),\n avPlayerVideoDisplay: IMAAVPlayerVideoDisplay(avPlayer: contentPlayer),\n pictureInPictureProxy: pictureInPictureProxy,\n userContext: nil)\nrequest.continuousPlayback = true;\nadsLoader!.requestAds(with: request)\n```\n\nHow continuous play differs from ad auto-play\n---------------------------------------------\n\nThe IMA SDK for tvOS 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`[adWillAutoPlay](/interactive-media-ads/docs/sdks/tvos/client-side/reference/Classes/IMAAdsRequest#adwillautoplay) property. 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 | Value for continuousPlayback | Value for adWillAutoPlay |\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` |"]]