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

Question: How to monitor for a paused position going out of live playlist range? #3794

Closed
softworkz opened this issue Apr 17, 2021 · 2 comments
Labels

Comments

@softworkz
Copy link
Contributor

Same playback setup as described here: #3764 (Live TV Playback with Time-Shift buffer)

In that situation, let's assume that a user has paused playback.
Now it can eventually happen, that the pause-position gets out of the time-range that is covered by the segments in the live playlist.

Assuming I would want to do something in that case like displaying a message or auto-resuming playback, what would be the best way to monitor for that situation?
(in terms of which event to monitor and which values to check)

Originally posted by @softworkz in #3764 (comment)

@robwalch
Copy link
Collaborator

robwalch commented Apr 19, 2021

Hi @softworkz,

The LEVEL_UPDATED event fires when hls.levels[hls.loadLevel].details.fragments is updated.

hls.levels[hls.loadLevel].details.fragments[0].start is the start time of your live sliding window. You'll need to compare this to currentTime on this event.

If you know how many segments are in your sliding window, you can set hls.config.liveMaxLatencyDurationCount to this value (before setup or after LEVEL_UPDATED with details.fragments.length). This will update hls.maxLatency which when reached (hls.latency) will make hls.js seek forward to the live sync position (there is no hls.js event when this happens, just video 'seeking' and 'seeked'). liveMaxLatencyDurationCount defaults to Infinity so this behavior is off when not configured (side note, hls.js will still seek forward if outside the window and completely unbuffered, as it must be within the window to stream content).

@softworkz
Copy link
Contributor Author

I apologize for getting back late on this issue.

Works perfectly as per your description. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants