报告连续播放
您可以使用适用于 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 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-10-15。
[null,null,["最后更新时间 (UTC):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."]]],[]]