Skip to content

Commit b06c976

Browse files
committed
Fix bug where events would be missing on release
1 parent b3e1c00 commit b06c976

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

player/playback-engine/src/main/kotlin/com/tidal/sdk/player/playbackengine/ExoPlayerPlaybackEngine.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ internal class ExoPlayerPlaybackEngine(
345345
}
346346

347347
override fun release() {
348+
val positionInSeconds = if (forwardingMediaProduct?.productType == ProductType.BROADCAST) {
349+
extendedExoPlayer.currentPositionSinceEpochMs
350+
} else {
351+
extendedExoPlayer.currentPositionMs
352+
}.toDouble() / MS_IN_SECOND
353+
reportEnd(EndReason.OTHER, endPositionSeconds = positionInSeconds)
348354
extendedExoPlayer.release()
349355
coroutineScope.launch {
350356
eventSink.emit(Event.Release)

0 commit comments

Comments
 (0)