fix(safari): fix an issue when using startAt.fromLivePosition with directfile content#1842
fix(safari): fix an issue when using startAt.fromLivePosition with directfile content#1842Florent-Bouisset wants to merge 1 commit into
Conversation
…rectfile content The startAt.fromLivePosition was not checking correctly that the wanted position was finite. It would lead to seeking to "Infinity" in some cases. Now the player wait that the media element has duration or seekable proprety defined and finite before calculating the wanted position.
|
✅ Automated performance checks have passed on commit DetailsPerformance tests 1st run outputNo significative change in performance for tests:
|
| return 0; | ||
| // Directfile contents do not expose a distinct live edge here, so | ||
| // `fromLivePosition` falls back to the same reference point as `fromLastPosition`. | ||
| const livePosition = getLastPosition(); |
There was a problem hiding this comment.
Wait now I realize something: are seekable.end(last) and duration semantically the same as per the HTMLMediaElement spec?
For example I remember that duration may be set to Inifinity for live contents, but that we sometimes (in MediaSource modes) set it to a large value like 2^32 instead because some browsers had issues in the past with very high/infinite values.
But this Infinity part does imply the possibility of an intended semantic difference between duration and seekable from the spec POV where duration may be purely indicative of the "finished" timestamp of the content yet seekable would be more about where we can seek in the content.
There's also the existence of the setLiveSeekableRange API that goes into this interpretation...
Even if today they have no difference in Safari, that might change and other browsers may have other interpretations so I would be more comfortable if we correspond more to the "spirit" of the spec in the POV of implementations.
This brings to me the question: why not trusting seekable first, more than duration, both for fromLastPosition and fromLivePosition? It is the one we're supposed to refer to for seeking after all.
To re-check the spec and implementations on this one
The startAt.fromLivePosition was not checking correctly that the wanted position was finite. It would lead to seeking to "Infinity" in some cases. Now the player wait that the media element has duration or that the seekable proprety is properly defined and finite before calculating the wanted position.