You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Forcing the use of SeekParameters.CLOSEST_SYNC in a HLS stream #2209
We're trying to enable SeekParameters.CLOSEST_SYNC in our player instance for our HLS streams, but it doesn't seem to work. We checked the code out and it seems for HLS the HlsChunkSource only calculates adjusted seek positions if the playlist has an EXT-X-INDEPENDENT-SEGMENTS tag. Our streams do not have this tag and we have no way of adding it server-side.
Is there any way to force exoplayer to use the timestamp adjusting logic? Our segments are independent and we have tested an imperfect workaround of calculating the position ourselves before seeking and it speeds up seeking significantly, but letting exoplayer do this would be much more preferable.
The main reason we are trying to do CLOSEST_SYNC seeks, because seek times to exact positions are significantly slower for some reason. If there's any other way to speed up seeking without SeekParameters I'd appreciate input too.
Our streams do not have this tag and we have no way of adding it server-side.
Could you please explain a bit why there is difficulty in adding the EXT-X-INDEPENDENT-SEGMENTS server side? In my opinion as of now, we should still trust as much as possible on the playlist, as it should be created logically consistent with the segments in a streaming server. As a library at client side, we definitely cannot assist on server side though, such information will help us to evaluate your case and decide whether we should add a "force" solution. Thanks!
@tianyif we use a proprietary solution for the server that transcodes and creates the HLS streams. That solution does make independent segments (each segment does have a keyframe in it) but so far we have found no option to make it add the EXT-X-INDEPENDENT-SEGMENTS tag by itself. We could resort to some hackery - like intercepting the playlist and editing it before passing it on to the client, but it would be much simpler to assume the segments are independent when they come from that streaming server.
We submitted a commit to loosen the condition for seeking to sync positions in HLS, and the SeekParameters.CLOSEST_SYNC is allowed to give a try even EXT-X-INDEPENDENT-SEGMENTS is not in the playlist. This is already in the latest 1.6.0 prerelease, and will be in 1.6.0 stable soon.
Activity
tianyif commentedon Mar 7, 2025
Hi @DovydasKl,
Could you please explain a bit why there is difficulty in adding the
EXT-X-INDEPENDENT-SEGMENTSserver side? In my opinion as of now, we should still trust as much as possible on the playlist, as it should be created logically consistent with the segments in a streaming server. As a library at client side, we definitely cannot assist on server side though, such information will help us to evaluate your case and decide whether we should add a "force" solution. Thanks!DovydasKl commentedon Mar 10, 2025
@tianyif we use a proprietary solution for the server that transcodes and creates the HLS streams. That solution does make independent segments (each segment does have a keyframe in it) but so far we have found no option to make it add the EXT-X-INDEPENDENT-SEGMENTS tag by itself. We could resort to some hackery - like intercepting the playlist and editing it before passing it on to the client, but it would be much simpler to assume the segments are independent when they come from that streaming server.
Loosen the condition for seeking to sync positions in a HLS stream
Loosen the condition for seeking to sync positions in a HLS stream
tianyif commentedon Mar 21, 2025
We submitted a commit to loosen the condition for seeking to sync positions in HLS, and the
SeekParameters.CLOSEST_SYNCis allowed to give a try evenEXT-X-INDEPENDENT-SEGMENTSis not in the playlist. This is already in the latest 1.6.0 prerelease, and will be in 1.6.0 stable soon.efemoney commentedon Mar 25, 2025
@DovydasKl If your proprietary solution is
ffmpegyou can add-hls_flags independent_segmentsand if not, do consider using ffmpeg instead!