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

Display multiple subtitles at once on live streaming #9010

Open
adiamini opened this issue Mar 14, 2025 · 2 comments
Open

Display multiple subtitles at once on live streaming #9010

adiamini opened this issue Mar 14, 2025 · 2 comments

Comments

@adiamini
Copy link

Description

Displaying multiple subtitles simultaneously does not work when subtitles source is an hls/m3u8 live stream.

This appears to be caused by the fact that, in live streams, subtitles are not fully available at loading time but instead come in the form of .vtt chunks that must be fetched continuously during the live stream reproduction.

The process that fetches the .vtt chunks seems to be limited to the first active track - where the "first active track", in this context, is the first textTrack() with mode being hidden or showing; this way why only the "first active track"'s cues list gets updated.

Maybe parallel processes should be executed, one for each active subtitle track - may it be showing or hidden.

This issue differs from #5798 due to the live streaming context; in fact, option allowMultipleShowingTracks is used in the test case.

// Load player with allowMultipleShowingTracks
var vjs = videojs('demo', {
  liveui: true,
  textTrackDisplay: {
    allowMultipleShowingTracks: true,  // videojs#5817 solves issue videojs#5798
  }
});

// Create a toggle button for each subtitle
vjs.textTracks().addEventListener('addtrack', event =>
{
  let track = event.track;
  if (track.kind !== 'subtitles') return;

  let langButton = document.createElement('input');
  langButton.type = 'button';
  langButton.id = 'btn-' + track.label;
  langButton.value = `${track.label}`;
  document.getElementById('langButtons').appendChild(langButton);

  langButton.addEventListener('click', _ => {
    track.mode = (track.mode === 'showing') ? 'hidden' : 'showing';
  });
});

Reduced test case

https://jsfiddle.net/g57wx246/29/

Steps to reproduce

  1. Play the video (live is each hour at :00 :20 :40 minutes)
  2. Activate more than one subtitle language (using buttons below the player, since player's button cannot handle it)

Errors

No error displayed.

What version of Video.js are you using?

8.22.0

Video.js plugins used.

none

What browser(s) including version(s) does this occur with?

Chrome 133, Firefox 135

What OS(es) and version(s) does this occur with?

Windows 10

@adiamini adiamini added the needs: triage This issue needs to be reviewed label Mar 14, 2025
Copy link

welcome bot commented Mar 14, 2025

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

@gkatsev
Copy link
Member

gkatsev commented Mar 18, 2025

Unfortunately, this is a limitation of our streaming engine. It's only setup to handle one in-manifest text track at a time. The existing option essentially only applies to <track> elements or remote text tracks.
It's something that's been brought up before, and we'd like to support it, but we haven't gotten the chance to. It isn't something that we currently have a plan to work on.

@mister-ben mister-ben removed the needs: triage This issue needs to be reviewed label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants