Skip to content

Commit

Permalink
Merge pull request #1576 from canalplus/chore-improve-initialseek-com…
Browse files Browse the repository at this point in the history
…ment

chore: improve comment
  • Loading branch information
peaBerberian authored Oct 15, 2024
2 parents bafffdc + 0ebf3b2 commit 3f297e5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main_thread/init/utils/initial_seek_and_play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,9 @@ export default function performInitialSeekAndPlay(
obs.readyState < HTMLMediaElement.HAVE_CURRENT_DATA
) {
/**
* On browser, such as Safari, the HTMLMediaElement.duration
* and HTMLMediaElement.buffered may not be initialized at readyState 1, leading
* to cases where it can be equal to `Infinity`.
* If so, the range in which it is possible to seek is not yet known.
* To solve this, the seek should be done after readyState HAVE_CURRENT_DATA (2),
* at that time the previously mentioned attributes are correctly initialized and
* the range in which it is possible to seek is correctly known.
* The starting position may not be known yet.
* Postpone the seek to a moment where the starting position should be known,
* assumely it's when readyState is greater or equal to HAVE_CURRENT_DATA (2).
* If the initiallySeekedTime is still `undefined` when the readyState is >= 2,
* let assume that the initiallySeekedTime will never be known and continue
* the logic without seeking.
Expand Down

0 comments on commit 3f297e5

Please sign in to comment.