+ var playPromise = videoSlot.play();
+ if (playPromise === undefined) {
+ // The browser did not support returning a promise when calling play().
+ // Assume that the video is playing.
+ //
+ // Google IMA SDK always incorrectly returns undefined
+ // due to lack of direct access to video element.
+ adIsAutoPlaying();
+ } else {
+ // Got a promise
+ playPromise.then(function () {
+ // Automatic playback started
+ adIsAutoPlaying();
+ }).catch(function (error) {
+ // Show a UI element to let the user manually start playback.
+ adIsNotAutoPlaying();
+ });
+ }