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

Disabling inflight subtitle playlist prevents segments from ever loading #6402

Closed
5 tasks done
andreasschrottenbaum opened this issue May 7, 2024 · 3 comments · Fixed by #6424
Closed
5 tasks done

Comments

@andreasschrottenbaum
Copy link

andreasschrottenbaum commented May 7, 2024

What version of Hls.js are you using?

1.5.x

What browser (including version) are you using?

Chrome

What OS (including version) are you using?

macOS

Test stream

https://codepen.io/3qgmbh/pen/MWdgKVK

Configuration

{
  autoStartLoad: false
}

Additional player setup steps

No response

Checklist

Steps to reproduce

When I try to Change to the first textTrack, there is no reaction.

The other tracks can be changed as expected, but choosing the first one doesn't have an effect.

The code works up until HLS 1.4.14, but on 1.5.x it's broken.

Example Codepen: https://codepen.io/3qgmbh/pen/MWdgKVK

Expected behaviour

You can choose the first texttrack

What actually happened?

When choosing the first texttrack, the last message (if existing) keeps being displayed

Console output

[log] > [subtitle-track-controller]: Switching to subtitle-track 0 "English" lang:en group:textstream

contrary to the other texttracks, there is no more output after this line. Video was buffered and paused

Chrome media internals output

No response

@andreasschrottenbaum andreasschrottenbaum added Bug Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels May 7, 2024
@robwalch
Copy link
Collaborator

robwalch commented May 7, 2024

I'm unable to reproduce the issue on the demo page with "autoStartLoad": false in the config and executing hls.startLoad() to begin streaming.

https://hlsjs-dev.video-dev.org/demo/?src=https%3A%2F%2Fsdn-global-streaming-cache.3qsdn.com%2Fstream%2F27816%2Ffiles%2F24%2F01%2F11%2F9207963%2F27816-v6CQ3mJwkTHNBGb.ism%2Fmanifest.m3u8&demoConfig=eyJlbmFibGVTdHJlYW1pbmciOnRydWUsImF1dG9SZWNvdmVyRXJyb3IiOnRydWUsInN0b3BPblN0YWxsIjpmYWxzZSwiZHVtcGZNUDQiOmZhbHNlLCJsZXZlbENhcHBpbmciOi0xLCJsaW1pdE1ldHJpY3MiOi0xfQ==

In your reproduction example, the english subtitle playlist is requested on start. It is the default track and will be loaded when you begin loading on manifest_parsed. The issue is related to disabling the subtitle track while it is being loaded. This results in the level details never being stored in subtitle-stream-controller because of an early return (Subtitle track 0 loaded is never logged, and the track-controller maintains that it is loaded and will not reload it):

private onSubtitleTrackLoaded(
event: Events.SUBTITLE_TRACK_LOADED,
data: TrackLoadedData,
) {
const { currentTrackId, levels } = this;
const { details: newDetails, id: trackId } = data;
if (!levels) {
this.warn(`Subtitle tracks were reset while loading level ${trackId}`);
return;
}
const track: Level = levels[currentTrackId];
if (trackId >= levels.length || trackId !== currentTrackId || !track) {
return;

You could either remove the default tag from the subs or not disable subtitles on start to workaround this issue for now.

@robwalch robwalch added Confirmed Suggested-Workaround and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels May 7, 2024
@robwalch robwalch modified the milestones: 1.6.0, 1.5.9 May 7, 2024
@robwalch robwalch changed the title Broken textTrack[0] Disabling inflight subtitle playlist prevents segments from ever loading May 7, 2024
@andreasschrottenbaum
Copy link
Author

Thank you for that fast response!

What I figured out inbetween: When I set the track to null instead of -1, it works

@robwalch
Copy link
Collaborator

robwalch commented May 7, 2024

What I figured out inbetween: When I set the track to null instead of -1, it works

That's clever. I guess this produces the warning Invalid subtitle track id: null? Try setting hls.subtitleTrack to -1 (rather than null) right after calling loadSource. Doing this before the manifest is parsed prevents default selection and loading of subtitle playlists:

set subtitleTrack(newId: number) {
this.selectDefaultTrack = false;
this.setSubtitleTrack(newId);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants