Skip to content

fix(safari): fix an issue when using startAt.fromLivePosition with directfile content#1842

Open
Florent-Bouisset wants to merge 1 commit into
devfrom
fix/safari-fromLivePosition
Open

fix(safari): fix an issue when using startAt.fromLivePosition with directfile content#1842
Florent-Bouisset wants to merge 1 commit into
devfrom
fix/safari-fromLivePosition

Conversation

@Florent-Bouisset
Copy link
Copy Markdown
Collaborator

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.

…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.
@Florent-Bouisset Florent-Bouisset added the bug This is an RxPlayer issue (unexpected result when comparing to the API) label May 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

✅ Automated performance checks have passed on commit e1f7b68873d7b3c164f9c84c75a2700d679ad6b0 with the base branch dev.

Details

Performance tests 1st run output

No significative change in performance for tests:

Name Mean Median
loading 19.50ms -> 19.55ms (-0.053ms, z: 1.11606) 27.90ms -> 28.05ms
seeking 518.01ms -> 504.73ms (13.282ms, z: 0.57645) 1512.30ms -> 1512.45ms
audio-track-reload 23.92ms -> 23.97ms (-0.044ms, z: 2.00350) 35.25ms -> 35.55ms
cold loading multithread 40.51ms -> 40.07ms (0.437ms, z: 9.16691) 59.10ms -> 58.50ms
seeking multithread 630.85ms -> 660.80ms (-29.950ms, z: 1.46123) 1513.50ms -> 1513.20ms
audio-track-reload multithread 23.82ms -> 23.73ms (0.086ms, z: 1.48077) 35.25ms -> 35.10ms
hot loading multithread 16.49ms -> 16.36ms (0.132ms, z: 3.80411) 24.45ms -> 24.30ms

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();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This is an RxPlayer issue (unexpected result when comparing to the API)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants