Skip to content

Commit

Permalink
Dont send "playing" during play/pause for delayed ads
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Smith committed Sep 26, 2016
1 parent 176dc00 commit 10176f4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/videojs.ads.js
Expand Up @@ -368,6 +368,12 @@ var
!player.ads.videoElementRecycled()) {
triggerEvent('ad', event);

// If the ad takes a long time to load, "playing" caused by play/pause can happen
// during "ads-ready?" instead of "preroll?" or "ad-playback", skipping the
// other conditions that would normally catch it
} else if (event.type === 'playing' && player.ads.state === 'ads-ready?') {
triggerEvent('ad', event);

// When an ad is playing in content tech, we would normally prefix
// "playing" with "ad" to send "adplaying". However, when we did a play/pause
// before the preroll, we already sent "adplaying". This condition prevents us
Expand Down Expand Up @@ -824,7 +830,10 @@ var
});
},
events: {
// in the case of a timeout, adsready might come in late.
// In the case of a timeout, adsready might come in late.
// This assumes the behavior that if an ad times out, it could still
// interrupt the content and start playing. An integration could
// still decide to behave otherwise.
'adsready': function() {
player.trigger('readyforpreroll');
},
Expand Down

0 comments on commit 10176f4

Please sign in to comment.