How to set `configuredTimeOffsetFromLive` for Live HLS in AVPlayer

Viewed 27

I am trying to play Live HLS stream from AVPlayer. My HLS file m3u8 has entries of 10 tracks at once and each track has a duration of 4 seconds. Now AVPlayer is making a request for the last chunk of the playlist, but I want the AVPlayer make request 2 chunks behind the live (8th chunk of playlist). I tried configuring this scenario with variable configuredTimeOffsetFromLive, automaticallyPreservesTimeOffsetFromLive, automaticallyWaitsToMinimizeStalling and preferredForwardBufferDuration.

I have tried to set below values

        player.currentItem?.automaticallyPreservesTimeOffsetFromLive = true
        player.automaticallyWaitsToMinimizeStalling = false
        player.currentItem?.preferredForwardBufferDuration = TimeInterval.init(4)
        player.currentItem?.configuredTimeOffsetFromLive = CMTimeMakeWithSeconds(12, 1000000)

But i could not notice anything different. Need help to configure these values. Any help would be appreciated. Thanks in advance.

0 Answers
Related