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

Playback jumps to live position after seeking backward in live stream #6934

Open
Firouzzadeh99 opened this issue Dec 27, 2024 · 4 comments
Open
Labels
Change configuration DVR Live or event playlists, long enough to seek back Live Question Works as expected

Comments

@Firouzzadeh99
Copy link

What do you want to do with Hls.js?

I am working on a live stream that supports a DVR feature with up to 30 minutes of backward seeking. However, when the stream's duration exceeds 30 minutes, I experience a delay of approximately 3-4 minutes. To address this issue, I used the following Hls.js configuration:

const hls = new Hls({
liveSyncDurationCount: 3,
liveMaxLatencyDurationCount: 5,
backBufferLength: 180,
maxLiveSyncPlaybackRate: 30,
});
This configuration helped reduce the delay, and the playback now works fine in most cases. However, I encountered a problem when seeking backward in the stream. After seeking to a previous point in the timeline, if I resume playback, it automatically jumps back to the live position.

I would like to maintain playback at the selected position when seeking backward, instead of it automatically returning to the live position.

What have you tried so far?

No response

@Firouzzadeh99 Firouzzadeh99 added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Dec 27, 2024
@robwalch robwalch added Works as expected and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Dec 27, 2024
@robwalch
Copy link
Collaborator

robwalch commented Dec 27, 2024

liveMaxLatencyDurationCount causes playback to seek forward to the live sync location when playback is more than this number of segments behind the edge. Remove that setting and the rate setting to allow seeking back in DVR mode.

The documentation includes a description of each configuration setting, including how they impact playback:
https://github.com/video-dev/hls.js/blob/master/docs/API.md#livemaxlatencydurationcount

@robwalch
Copy link
Collaborator

robwalch commented Dec 27, 2024

The 3-4 minute delay could be a problem with your live stream. It is unclear exactly what you are trying to describe. Does playback start a few minutes behind live? Does it stall for several minutes?

See the Bug Report Template for a list of details to include when reporting an issue with HLS stream playback:

  • Test stream/page (if possible)
  • Steps to reproduce
  • Expected behavior
  • Actual behavior

If the issue is related to your stream, and you cannot share the stream, please include all the information we would need to reproduce the issue. This includes how to generate a stream that reproduces the issue.

@Firouzzadeh99
Copy link
Author

The currentTime has a 3-4 minute difference compared to the duration, meaning the currentTime is lagging behind. I have to manually seek forward to achieve a live state. I managed to resolve this delay issue using the mentioned configuration, but it caused problems with seeking backward. Without this configuration, I was able to have proper playback functionality.

This issue was handled in Video.js, but since I'm creating a custom video player using HLS, I encountered this problem. I thought there might be another configuration to simultaneously reduce the delay and maintain backward playback functionality.

@robwalch
Copy link
Collaborator

robwalch commented Dec 27, 2024

The currentTime has a 3-4 minute difference compared to the duration

What does the playlist look like on start? Playback should begin 3 segments (or liveSyncDurationCount) before the end of the playlist. It could be that you have very long segments, add too many segments to the playlist on first update, or define a large HOLD-BACK or START-OFFSET value in the playlist that the player is expected to honor.

@robwalch robwalch added DVR Live or event playlists, long enough to seek back Change configuration Live labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change configuration DVR Live or event playlists, long enough to seek back Live Question Works as expected
Projects
None yet
Development

No branches or pull requests

2 participants