mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-29 10:52:38 +02:00
Allowing playback to save any position and not only after 5 seconds.
This commit is contained in:
@@ -92,10 +92,8 @@ class MultiPlayerPlaybackManager(
|
|||||||
override fun onPlaybackStateChanged(playbackState: Int) {
|
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||||
when (playbackState) {
|
when (playbackState) {
|
||||||
STATE_IDLE -> {
|
STATE_IDLE -> {
|
||||||
if (player.currentPosition > 5 * 60) { // 5 seconds
|
|
||||||
cachedPositions.add(uri, player.currentPosition)
|
cachedPositions.add(uri, player.currentPosition)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
STATE_READY -> {
|
STATE_READY -> {
|
||||||
cachedPositions.get(uri)?.let { lastPosition ->
|
cachedPositions.get(uri)?.let { lastPosition ->
|
||||||
if (abs(player.currentPosition - lastPosition) > 5 * 60) {
|
if (abs(player.currentPosition - lastPosition) > 5 * 60) {
|
||||||
@@ -104,12 +102,10 @@ class MultiPlayerPlaybackManager(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
if (player.currentPosition > 5 * 60) { // 5 seconds
|
|
||||||
cachedPositions.add(uri, player.currentPosition)
|
cachedPositions.add(uri, player.currentPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
cache.put(id, mediaSession)
|
cache.put(id, mediaSession)
|
||||||
|
|||||||
Reference in New Issue
Block a user