Skip to content

Commit

Permalink
fix: Added type to content source (#680)
Browse files Browse the repository at this point in the history
* Added type to content source

Resolved an issue with IMA plugin and HLS plugin on post-roll completed ads: without the source type the player hangs with a format not supported error.

* Update player-wrapper.js

* Update player-wrapper.js
  • Loading branch information
jascaldeira authored and shawnbuso committed Jul 24, 2018
1 parent 0fbf8f5 commit d8cb13d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/player-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ const PlayerWrapper = function(player, adsPluginSettings, controller) {
*/
this.contentSource = '';

/**
* Stores the content source type so we can re-populate it manually after a
* post-roll.
*/
this.contentSourceType = '';

/**
* Stores data for the content playhead tracker.
*/
Expand Down Expand Up @@ -461,6 +467,7 @@ PlayerWrapper.prototype.onAdError = function(adErrorEvent) {
*/
PlayerWrapper.prototype.onAdBreakStart = function() {
this.contentSource = this.vjsPlayer.currentSrc();
this.contentSourceType = this.vjsPlayer.currentType();
this.vjsPlayer.off('contentended', this.boundContentEndedListener);
this.vjsPlayer.ads.startLinearAdMode();
this.vjsControls.hide();
Expand Down Expand Up @@ -494,7 +501,12 @@ PlayerWrapper.prototype.onAdStart = function() {
PlayerWrapper.prototype.onAllAdsCompleted = function() {
if (this.contentComplete == true) {
if (this.h5Player.src != this.contentSource) {
this.vjsPlayer.src(this.contentSource);
// Avoid setted autoplay after the post-roll
this.vjsPlayer.autoplay(false);
this.vjsPlayer.src({
src: this.contentSource,
type: this.contentSourceType,
});
}
this.controller.onContentAndAdsCompleted();
}
Expand Down

1 comment on commit d8cb13d

@mysuf
Copy link

@mysuf mysuf commented on d8cb13d Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I already mentioned in one of your PR, this functionality duplicates what contrib-ads already does. There is also bug (same as I reported in contrib-ads), when multiple sources are present. It restores only one source and loose others which breaks any plugin or functionality working with multiple sources (like quality selector, etc)

Please sign in to comment.