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

feat: improve the playback timeout error experience #223

Merged
merged 3 commits into from
Jun 13, 2022

Conversation

kchang-brightcove
Copy link
Contributor

Copy link
Member

@misteroneill misteroneill left a 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
Comment on lines 286 to 287
player.reset();
player.src(player.options_.sources);
Copy link
Member

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:

Suggested change
player.reset();
player.src(player.options_.sources);
const source = player.currentSource();
player.reset();
player.src(source);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented suggestion.

Copy link
Member

@misteroneill misteroneill left a 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();
});
Copy link
Member

@misteroneill misteroneill Jun 8, 2022

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.

@misteroneill misteroneill merged commit 235ff8f into main Jun 13, 2022
@misteroneill misteroneill deleted the feature/improve-playback-timeout-experience branch June 13, 2022 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants