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: prevent dispose error and text track duplicate listeners #6984

Merged
merged 4 commits into from
Jan 21, 2021

Conversation

brandonocasey
Copy link
Contributor

Description

Noticed an error when disposing a player with text tracks on and was able to replicate it on our standard simple demo by turning on throttling to 6x in chrome and disposing the player with the default text track on. I also noticed that we do two other things:

  1. It's possible to configure the player such that we trigger two updates for a text track on every timeupdate, as we don't remove timeupdate handlers before adding them in modechange.
  2. If mode is set to showing more then once in a text track we add another update handler, without a limit to how many we can add.

@@ -241,12 +248,10 @@ class TextTrack extends Track {
// On-demand load.
loadTrack(this.src, this);
}
this.tech_.off('timeupdate', timeupdateHandler);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we also return early in this function if the mode is the same as the current mode? Is there a reason we trigger modechange when a track goes from disabled to disabled again?

Copy link
Member

Choose a reason for hiding this comment

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

Making this change makes sense. I think we'd want to see whether doing that causes any issues for the captions menu, though, I doubt it.

@brandonocasey brandonocasey added the needs: LGTM Needs one or more additional approvals label Dec 7, 2020
@gkatsev
Copy link
Member

gkatsev commented Jan 11, 2021

Is there a specific timing for adding the throttling? I've tried it and cannot reproduce.

I think this hasn't really come up previously because the menu itself prevents changing the mode to the same item already. It's only an issue programmatically.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Changes here make sense, though, I wasn't able to reproduce.

Comment on lines 204 to 207
this.tech_.off('dispose', disposeHandler);
};

this.tech_.on('dispose', disposeHandler);
Copy link
Member

Choose a reason for hiding this comment

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

alternatively, use .one here?

@brandonocasey brandonocasey force-pushed the fix/text-track-duplicate-updates branch from 5ce1af2 to e6dda7c Compare January 21, 2021 21:06
@gkatsev gkatsev merged commit db46578 into main Jan 21, 2021
@gkatsev gkatsev deleted the fix/text-track-duplicate-updates branch January 21, 2021 22:02
@misteroneill misteroneill removed the needs: LGTM Needs one or more additional approvals label May 23, 2023
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
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.

3 participants