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

How to resume delayed playback when play after pause on live stream #5287

Closed
AngelDev0329 opened this issue Mar 13, 2023 · 3 comments
Closed

Comments

@AngelDev0329
Copy link

What do you want to do with Hls.js?

I want to resume the delayed playback when play after pause on live stream.

What have you tried so far?

No response

@AngelDev0329 AngelDev0329 added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Mar 13, 2023
@robwalch
Copy link
Collaborator

robwalch commented Mar 16, 2023

This comment explains how live HLS streams are played by HLS.js and similar players.
#4402 (comment)

The player can continue on resume as long as the HLS playlist has segments where the video was paused or the player has buffered all media (which is no longer in the playlist) between the current time and the live edge. If the segments are gone from the playlist and not buffered, the player has to resync with the "live window" or available segments in the live playlist.

@robwalch robwalch added answered Question and removed Question Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Mar 16, 2023
@AngelDev0329
Copy link
Author

Could you share example code for this?
Thank you.

@robwalch
Copy link
Collaborator

robwalch commented Dec 1, 2023

Set currentTime to the live sync position to catch up to the live edge:

video.currentTime = hls.liveSyncPosition;

If you'd like to do this after pause, try using the "play" event:

video.onplay = () => {
  video.currentTime = hls.liveSyncPosition;
};

@robwalch robwalch closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants