-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: improve the playback timeout error experience #223
feat: improve the playback timeout error experience #223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small suggestion!
src/plugin.js
Outdated
player.reset(); | ||
player.src(player.options_.sources); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
player.options_.sources` won't be populated in all cases, I don't think. Here's a suggestion:
player.reset(); | |
player.src(player.options_.sources); | |
const source = player.currentSource(); | |
player.reset(); | |
player.src(source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works like a charm. Noticed one small thing that would only really come through experience with Video.js event model, though.
}); | ||
player.on(dismissButton, 'click', function() { | ||
display.close(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, these listeners create a small memory leak. Even if the display is closed and the elements are removed from the DOM, the internal Video.js listeners do not go away.
There's not a very easy way to find this, but I set a breakpoint in Video.js and exposed the DomData
object. Then I tracked the number of listeners counted on this object as I created and dismissed the timeout modal multiple times. Each time the number of listeners increased by two.
I'd suggest adding the following:
display.one('modalclose', () => {
player.off(reloadButton);
player.off(dismissButton);
});
That should clear these two listeners when these DOM elements disappear when the display is closed.
Description
Ticket: https://brightcove.atlassian.net/browse/WP-8