Skip to content

Commit

Permalink
No seek event while in pause (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ authored Oct 20, 2023
1 parent 003427a commit beda01c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ class CommandersActTrackerTest {
val expected = listOf(
MediaEventType.Play.toString(),
MediaEventType.Pause.toString(),
MediaEventType.Seek.toString(),
MediaEventType.Pause.toString(),
MediaEventType.Stop.toString()
)
launch(Dispatchers.Main) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ internal class CommandersActStreaming(
}

private fun notifyPause() {
if (state == State.Idle) return
if (state != State.Playing) return
this.state = State.Paused
notifyEvent(MediaEventType.Pause, player.currentPosition.milliseconds)
stopHeartBeat()
Expand All @@ -155,7 +155,7 @@ internal class CommandersActStreaming(
}

private fun notifySeek(seekStartPosition: Duration) {
if (state == State.Seeking || state == State.Idle) return
if (state != State.Playing) return
state = State.Seeking
notifyEvent(MediaEventType.Seek, seekStartPosition)
}
Expand Down

0 comments on commit beda01c

Please sign in to comment.