Join GitHub today
Proposed solution for issue #656 - "Default flag not working on tracks" #1153
So the breaking tests is actually that we have another tests that sets auto play to true and a track with default true.
The way I would actually fix that one is to change
The way this is being implemented isn't really ideal. It requires one of the control elements to handle the default track behavior. If controls were disabled or removed, this would stop working.
The preferred way to fix this would be to uncomment this line.
The dirty hack way to fix the issue would be to put a settimeout around the track.show call.
I think we could accept that solution for now, along with a comment pointing to this note. This issue has been outstanding for awhile.
Would you be interest in updating your PR to do that instead?
The long term way to fix this I think would be to make the textTrackDisplay an actual part of a tech, so that it's ready when the tech is. @mmcc and I have already talked about doing that, and relying more on the browser's captions support at the same time.
Another way to fix this might be to wait for all child elements to be loaded before triggering ready on the player. I think that could be done, and probably should be anyway.
@heff Thanks for your quick response. I have updated my PR with your suggested changes.
I modified the player unit test to not specifically pass the "default" option but rather "attrtest" to make sure it was passed through.
I also reverted the original fix and then uncommented the existing default track code in the addTextTrack function (found here https://github.com/videojs/video.js/blob/v4.5.2/src/js/tracks.js#L61) as suggested. Essentially, adding the quick and dirty hack to get it all working.
For the long term, if you or @mmcc will point me in the right direction for implementing the textTrackDisplay as part of the tech then I'd be happy to give it a go.
@Chris-DL would you happen to have a single video.js file with your change implemented so that I could test it? Or, could you point me in the right direction as to how I could create one myself? I'm sure there's a script that combines all the js files, but this is all new to me.
Hey @kutothe. I've created a github gist with the contents of the video.js file with the fix included. You should be able to copy and paste the contents to overwrite your video.js file. Let me know if you need help with anything or have any questions.
This looks great, thanks!! Pulling this in.
Moving captions handling to the tech I think is going to be difficult, but you're welcome to take a stab at it. A first step might be to make it possible to determine if captions are supported by the current video element, and if so, allow the track info to be passed through.
It'd probably be easier to address the waiting for children to load issue. Right now we just trigger ready on the player whenever a new tech is loaded and ready, but we could add in a step to wait for children as well.