Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,23 @@ class CS3IPlayer : IPlayer {
event(PlayerAttachedEvent(exoPlayer))
exoPlayer?.prepare()

// For offline fragmented MP4s, FLAG_MERGE_FRAGMENTED_SIDX builds the SIDX seek map
// incrementally as data is buffered. The initial seek resolves to the nearest merged
// entry (~first fragment, 3 s). On STATE_READY, re-seek to the actual saved position.
// This may only be reproducible on large and fairly long fragmented MP4 files with
// multiple sidx boxes.
if (onlineSource == null && playbackPosition > (exoPlayer?.duration ?: 0L)) {
Comment thread
Luna712 marked this conversation as resolved.
exoPlayer?.addListener(object : Player.Listener {
private var seekApplied = false
override fun onPlaybackStateChanged(playbackState: Int) {
if (seekApplied || playbackState != Player.STATE_READY) return
seekApplied = true
exoPlayer?.seekTo(currentWindow, playbackPosition)
exoPlayer?.removeListener(this)
}
})
}

exoPlayer?.let { exo ->
event(StatusEvent(CSPlayerLoading.IsBuffering, CSPlayerLoading.IsBuffering))
isPlaying = exo.isPlaying
Expand Down