AI-generated Key Takeaways
-
The
setContinuousPlayback()method in the IMA SDK for HTML5 informs the SDK if the player intends to play content videos continuously, affecting the type of ads returned. -
Setting
setContinuousPlayback()totrueindicates continuous play, similar to a TV broadcast, and results in ads suitable for such an environment. -
Not calling
setContinuousPlayback()leaves its setting as unknown and has no effect on ad playback once set. -
The
setAdWillAutoPlay()method is distinct from continuous play and determines if the player starts automatically or waits for user action.
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.
The following sample demonstrates how to set continuous play in an ads request.
var adsRequest = new google.ima.AdsRequest(); adsRequest.adTagUrl(adTagUrl); adsRequest.setContinuousPlayback(true); adsLoader.requestAds(adsRequest);
How continuous play differs from ad auto-play
The 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
setAdWillAutoPlay()
method. When set to true, the ads returned are those designated by the ads
server as suitable for an auto-play environment.
This table details when to request ads for continuous play and auto-play, based on the video content the ads are paired with.
| Video Content | Parameter for setContinuousPlayback() | Parameter for setAdWillAutoPlay() |
|---|---|---|
| A single content video that plays upon user interaction | false |
false |
| A single content video that autoplays | false |
true |
| A video playlist that plays the first video upon user interaction but autoplays the following videos | true |
false |
| A video playlist that autoplays the first video and autoplays the following videos | true |
true |