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 @@ -961,6 +961,22 @@ class CS3IPlayer : IPlayer {
when (event) {
CSPlayerEvent.Play -> {
event(PlayEvent(source))
// If the player was stopped (e.g. notification dismissed) it lands in
// STATE_IDLE. A bare play() call is a no-op in that state, re-prepare and
// then resume to the current position once we are in STATE_READY again.
if (playbackState == Player.STATE_IDLE) {
val seekPosition = currentPosition
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, seekPosition)
exoPlayer?.removeListener(this)
}
})
prepare()
}
play()
}

Expand Down