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

fix(HLS): Ensure textSequenceModeOffset is updated on each offset calculation #5

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

willdharris
Copy link

@willdharris willdharris commented Mar 28, 2024

DO NOT MERGE!
PR just to review diff of changes.

This resolves AVIAJS-10, captions sync issue with Pluto HLS streams.

  • Previously the base offset, used for time.periodStart in vtt_text_parser, was calculated and set at stream start and never updated.
  • The correct offset is actually being calculated on every call to appendBuffer, but when it is applied to the text engine (textEngine_.setTimestampOffset) in order to update time.periodStart, it only ever uses the initial calculated offset.
  • That is because this.textSequenceModeOffset_ is typed and initiated as a Promise. The value is updated by calling this.textSequenceModeOffset_.resolve(value). However, once a promise is resolved, calling resolve on it again has no effect. So the first value passed is locked in and used in all subsequent calculations.
  • This PR changes this.textSequenceModeOffset_ type from a Promise to a number and directly updates it's value on each appendBuffer of type video.

@willdharris willdharris changed the title Reset text offset after discontinuity fix(HLS): Ensure textSequenceModeOffset is updated on each offset calculation Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant