capacitor-plugin-playlist 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -441,6 +441,13 @@ class PlaylistManager(private val application: Application) {
|
|
|
441
441
|
return
|
|
442
442
|
}
|
|
443
443
|
val index = currentPosition.coerceIn(0, audioTracks.size - 1)
|
|
444
|
+
// Snapshot the position of whatever track is being switched away from — covers the
|
|
445
|
+
// JS "tap a different playlist item" path (playTrackById), not just native skip, so a
|
|
446
|
+
// later native skip back to that track resumes correctly regardless of how it was left.
|
|
447
|
+
val fromIndex = exoPlayer.currentMediaItemIndex
|
|
448
|
+
if (fromIndex != index) {
|
|
449
|
+
audioTracks.getOrNull(fromIndex)?.startPositionMs = exoPlayer.currentPosition
|
|
450
|
+
}
|
|
444
451
|
currentPosition = index
|
|
445
452
|
exoPlayer.repeatMode = PlaylistPlaybackPolicy.repeatMode(loop, audioTracks.size)
|
|
446
453
|
exoPlayer.seekTo(index, seekPosition)
|