Skip to content

Commit

Permalink
Fixed tech switching when ad tech and video tech dont match
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkjanm committed Jul 30, 2014
1 parent 9a06fc6 commit a886d97
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/videojs.ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ var
snapshot = {
src: player.currentSrc(),
currentTime: player.currentTime(),

// get the current tech name in case the video tech is different than ad tech
techName: player.techName,
// on slow connections, player.paused() may be true when starting and
// stopping ads even though play has been requested. Hard-coding the
// playback state works for the purposes of ad playback but makes this
Expand Down Expand Up @@ -224,7 +225,13 @@ var
return;
}

// if the original video used a different tech, load that tech again
if (player.techName !== snapshot.techName){
player.loadTech(snapshot.techName,snapshot.src);
}else{
player.src(snapshot.src);
}

// safari requires a call to `load` to pick up a changed source
player.load();

Expand Down

0 comments on commit a886d97

Please sign in to comment.