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

Disable captions by default when streaming hls videos #8662

Open
AndiLeni opened this issue Mar 29, 2024 · 3 comments
Open

Disable captions by default when streaming hls videos #8662

AndiLeni opened this issue Mar 29, 2024 · 3 comments
Labels
enhancement needs: triage This issue needs to be reviewed

Comments

@AndiLeni
Copy link

AndiLeni commented Mar 29, 2024

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

  1. Start the video, captions are shown
  2. Disable captions
  3. Reload page
  4. Captions are again visble when player is started

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

@AndiLeni AndiLeni added the needs: triage This issue needs to be reviewed label Mar 29, 2024
Copy link

welcome bot commented Mar 29, 2024

👋 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.

@mister-ben
Copy link
Contributor

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.

@AnVanVee
Copy link

AnVanVee commented Jun 25, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs: triage This issue needs to be reviewed
Projects
None yet
Development

No branches or pull requests

3 participants