Skip to content

Commit

Permalink
Added player event triggering code for ad requests (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypavlotsky committed Jun 4, 2018
1 parent 6088f86 commit 9701135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,15 @@ Controller.prototype.adsWillPlayMuted = function() {
}
};

/**
* Triggers an event on the VJS player
* @param {string} name The event name.
* @param {Object} data The event data.
*/
Controller.prototype.triggerPlayerEvent = function(name, data) {
this.playerWrapper.triggerPlayerEvent(name, data);
};


/**
* Extends an object to include the contents of objects at parameters 2 onward.
Expand Down
9 changes: 9 additions & 0 deletions src/player-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ PlayerWrapper.prototype.playContentFromZero = function() {
this.vjsPlayer.play();
};

/**
* Triggers an event on the VJS player
* @param {string} name The event name.
* @param {Object} data The event data.
*/
PlayerWrapper.prototype.triggerPlayerEvent = function(name, data) {
this.vjsPlayer.trigger(name, data);
};


/**
* Listener JSDoc for ESLint. This listener can be passed to
Expand Down
1 change: 1 addition & 0 deletions src/sdk-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ SdkImpl.prototype.requestAds = function() {
adsRequest.setAdWillPlayMuted(this.controller.adsWillPlayMuted());

this.adsLoader.requestAds(adsRequest);
this.controller.triggerPlayerEvent('ads-request', adsRequest);
};


Expand Down

0 comments on commit 9701135

Please sign in to comment.