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

Non-preloaded, default text track is loaded and parsed twice #7019

Closed
sethcarlton opened this issue Dec 28, 2020 · 3 comments · Fixed by #7021
Closed

Non-preloaded, default text track is loaded and parsed twice #7019

sethcarlton opened this issue Dec 28, 2020 · 3 comments · Fixed by #7021

Comments

@sethcarlton
Copy link

Description

When not preloading text tracks and setting a default, the default text track is being loaded and parsed twice, resulting in a "double caption"

Reduced test case: https://codepen.io/scarlton/pen/ZEpvaEo

Steps to reproduce

  1. Set preloadTextTracks to false
  2. Set one of your text tracks as default
  3. Load the player

Results

Expected

A single network request for the default text track, the default track to be selected, the selected track cues to be shown.
image

Actual

Two network requests for the default text track, the default track is selected, the selected track cues are showing double.
image

Additional Information

On track load, if we are preloading OR this track is default, then loadTrack is called. However, when we are NOT preloading, loadTrack is also called for each track when its mode changes. Since a track set as default fires a mode change, loadTrack ends up being called twice.

As far as I can tell, the issue could be resolved by removing || default_ from line 344 of text-track.js. When preloading, all tracks would still be loaded here while non preloaded default tracks would load when its mode changes.

versions

videojs

7.10.2

browsers

Chrome (probably others)

OSes

macOS (probably Windows)

@welcome
Copy link

welcome bot commented Dec 28, 2020

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

isabelleingato added a commit to isabelleingato/video.js that referenced this issue Dec 29, 2020
When preloadTextTracks option is set to false, it still preloads the default text track. This leads to duplicate tracks once the mode changes to showing and the track is loaded a second time. This includes the default text track in the behavior defined by the preloadTextTracks option.

Fixes videojs#7019
@isabelleingato
Copy link
Contributor

isabelleingato commented Dec 29, 2020

New here! I'd like to grab this one if that's okay.

I agree with the assessment of #6043 in the issue description. The other option would seem to be to assume the default track has always been preloaded and not try to load it a second time on mode change to "showing": https://github.com/videojs/video.js/blob/affc0611d978b1a6d02e443a46d14a58f2b1441c/src/js/tracks/text-track.js/#L240; that might be more aligned with the original intent of #2192.

@sethcarlton
Copy link
Author

Yep that could also be a solution and may be more clear/more aligned with the original intent. Thanks for picking this up!

gkatsev pushed a commit that referenced this issue Mar 9, 2021
…7021)

When preloadTextTracks option is set to false, it still preloads the default text track. This leads to duplicate tracks once the mode changes to showing and the track is loaded a second time. This includes the default text track in the behavior defined by the preloadTextTracks option.

Fixes #7019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
edirub pushed a commit to edirub/video.js that referenced this issue Jun 8, 2023
…ideojs#7021)

When preloadTextTracks option is set to false, it still preloads the default text track. This leads to duplicate tracks once the mode changes to showing and the track is loaded a second time. This includes the default text track in the behavior defined by the preloadTextTracks option.

Fixes videojs#7019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants