Skip to content

Forcing the use of SeekParameters.CLOSEST_SYNC in a HLS stream #2209

Closed

Description

@DovydasKl

Hello,

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.

We are on version 1.5.1.

Activity

  1. tianyif commented on Mar 7, 2025

    @tianyif
    Contributor

    Hi @DovydasKl,

    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!

  2. DovydasKl commented on Mar 10, 2025

    @DovydasKl
    Author

    @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.

  3. tianyif commented on Mar 21, 2025

    @tianyif
    Contributor

    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.

  4. efemoney commented on Mar 25, 2025

    @efemoney

    we use a proprietary solution for the server that transcodes and creates the HLS streams

    @DovydasKl If your proprietary solution is ffmpeg you can add -hls_flags independent_segments and if not, do consider using ffmpeg instead!

  5. locked and limited conversation to collaborators on May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions