Open AndiLeni opened 3 months ago
👋 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.
We don't currently have a way to preselect which, if any, text track is shown, so in the absence of that this track is shown as it is marked as default in the manifest. It's something I'd like us to add, although you can still enable / disable the tracks as desired programmatically today.
Hi there, Correct suggestion, but will be of little use for the initiator if not telling how. That holds especially in view of the clarity of documentation around the textTrack matter. Let me share a few lines working such that an external .m3u8 containing "default" textTracks will be played without displaying these, but keeping the option to activate if desired. I assume the video.js player instance is called player. Add the following to the script section in the body, which I do so after a call of player.play(); :
//--- start of code snippet --- //Disable all text tracks enabled by the default setting in the m3u8 master. This needs doing in "tech" if the source //is defined in the script. This approach allows simple activating in the textTracks selector (button) if there is use later. //This is tricky as .textTracks. seems never altered (length always 0), but .textTracks. does the trick //The only problem is .textTracks. seems populated delayed and an event has to listen when we can start to override. player.one('loadedmetadata', function(){ for (let i = 0; i < player.tech.textTracks.length; i++) { player.tech.textTracks_[i].mode = 'disabled'; } } ); //--- end of code snippet ---
Hope this helps (especially as there is really scarce information on the net about this topic). Code is tested and found working for video-js 8.10.0 and 8.16.1 (test of select cases only).
Description
It seems like captions are shown by default if a hls video provides them. This behavior shoule be customizable and be deactivatable. It is in many cases not intended that the captions are shown by default and must be manually disabled by the user on each page load.
Reduced test case
https://codepen.io/AndiLeni/pen/LYvzeqO?editors=1000
Steps to reproduce
Errors
No response
What version of Video.js are you using?
8.10
Video.js plugins used.
videojs-contrib-quality-menu
What browser(s) including version(s) does this occur with?
Chrome 123
What OS(es) and version(s) does this occur with?
Windows 10