-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix text track change edge cases #1582
Conversation
If text track mode is set to `disabled` in middle of VTTParser, then bailout as `currentTrack.cues` will be nullified when track is disabled. If accessing `currentTrack.cues.getCueById` when the mode is `disabled` then an exception is thrown
If subtitles are changed in the middle of downloading another subtitle track then in certain edge cases the next subtitle track gets stuck and doesn't download fragments
|
Yes @johnBartos we are stuck in In general I think this makes sense as we rely to heavily on the native track object and if it's null you can't do anything.
and our use case is more like After writing all of this I think that maybe the better fix will be to actually use the But now I stumbled on an even worse case I think. I pushed another fix, please review it. |
Hi @johnBartos, any chance you got to review this? |
@OrenMe Taking a look. Do you have a test stream and repro steps for the tricky edge cases? |
@johnBartos take any media that has more then one caption language. I discovered it because I had the following use case: In general, I think we should just be able to set initial audio/text/video preferences in the settings so initial load will be the one the application chooses. |
@johnBartos, were you able to review? |
@OrenMe Sorry wasn't able to today, I will tomorrow |
Hey dear contributors, we have recently applied linting rules to our code. This might have created conflicts in your current WIP contribution. No worries though, all the changes we did were applying consistent indent and style rules across the code :) These can be applied automatically with the new But you still need to pull in changes from master to be able to merge this PR and formaly resolve any "conflicts". To easily resolve that, simplest way will be a plain merge without rebase, resolving the conflicts in a "trivial" way by keeping "yours" and apply the auto-fixing tool on top of that, then committing the result :) You can't do anything wrońg here: the CI output will be red if the diff of your PR causes linting errors :) Step by step:
See: https://git-scm.com/docs/merge-strategies#merge-strategies-ours Now you have resolved the conflicts by enforcing your change upon the conflicting ones on master branch. Finally, run: Ideally, this should return with zero exit code, no errors (even if many warnings for now remaining). If you have lint errors after the auto-fix script runs, you will have to manually fix these as they probably come from your changes :) After this is done, and Next destination, a super nicely readable and safely maintainable Hls.js codebase 👍 Thanks for your contribution! EDIT: Finally-finally, please also check that you have only force-resolved conflicts that were related to linting, and not anything functional which has been done on master since your branch forked off. However that would show up in the PR diff anyhow here, and be subject of review - just a hint, as this is hypothetically also possible :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just a few nitpicky things
// downloading its frags, if not all have been downloaded yet | ||
const currentTrack = this.tracks[this.currentTrackId]; | ||
let details = currentTrack.details; | ||
if (details !== undefined && details.live !== true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it matter if we're live
? I think a comment would be helpful here.
@@ -270,6 +270,12 @@ class TimelineController extends EventHandler { | |||
// Parse the WebVTT file contents. | |||
WebVTTParser.parse(payload, this.initPTS, vttCCs, frag.cc, function (cues) { | |||
const currentTrack = textTracks[frag.trackId]; | |||
// If text track is disabled in middle of process bailout as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment needs a bit of proofreading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnBartos I'm open to suggestions...
Hi @johnBartos, can you please check. |
@OrenMe OK I just pulled the branch, will do a bit of manual testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one last thing
// For live the tracks are reloaded anyhow every couple of sec so tick will be called than | ||
const currentTrack = this.tracks[this.currentTrackId]; | ||
let details = currentTrack.details; | ||
if (details !== undefined && details.live !== true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The live
check is unnecessary; the tick
function debounces itself so that it's always called on the same cadence. Allowing it to be called if it's live is no problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OrenMe LGTM! Thanks for addressing the feedback
Thanks @johnBartos! |
due to the way hls.js manages track selection, especialy when default text track is set in manifest, we had some incorrect logic. This simplfies and fixes the various paths we had to handle this. The fix is dependent on a fix on video-dev/hls.js#1582 and kaltura/playkit-js-hls#65.
Description of the Changes
Fix text track change edge cases:
disabled
in middle of VTTParser operation, then bailout ascurrentTrack.cues
will be nullified when track is disabled.If accessing
currentTrack.cues.getCueById
when the mode isdisabled
then an exception is thrownCheckLists