Skip to content

Commit

Permalink
fix: Remove duplicate playing listener from redispatch. (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored and misteroneill committed Mar 20, 2019
1 parent 07946db commit 944c363
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ const contribAdsPlugin = function(options) {
// plugins that aren't ad-aware will break. prefixing allows
// plugins that wish to handle ad events to do so while
// avoiding the complexity for common usage
const videoEvents = VIDEO_EVENTS.concat([
'firstplay',
'loadedalldata',
'playing'
]);
const videoEvents = [];

// dedupe event names
VIDEO_EVENTS.concat(['firstplay', 'loadedalldata']).forEach(function(eventName) {
if (videoEvents.indexOf(eventName) === -1) {
videoEvents.push(eventName);
}
});

// Set up redispatching of player events
player.on(videoEvents, redispatch);
Expand Down

0 comments on commit 944c363

Please sign in to comment.