报告连续播放
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
适用于 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
,则返回的广告是由广告指定的
以适合自动播放环境。
下表详细说明了何时根据视频内容请求连续播放和自动播放广告
广告的配对对象。
视频内容 |
ContinuousPlayback 的值 |
adWillAutoPlay 的值 |
用户互动时播放的单个内容视频 |
false |
false |
自动播放的单个内容视频 |
false |
true |
用户互动时播放第一个视频但会自动播放
关注视频 |
true |
false |
自动播放第一个视频并自动播放后续视频的视频播放列表 |
true |
true |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-01。
[null,null,["最后更新时间 (UTC):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` |"]]