-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Comments
👋 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. |
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
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. |
Yep that could also be a solution and may be more clear/more aligned with the original intent. Thanks for picking this up! |
…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
…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
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
preloadTextTracks
tofalse
default
Results
Expected
A single network request for the
default
text track, thedefault
track to be selected, the selected track cues to be shown.Actual
Two network requests for the
default
text track, thedefault
track is selected, the selected track cues are showing double.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 asdefault
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)
The text was updated successfully, but these errors were encountered: