Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove duplicate playing listener from redispatch. #473

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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