mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-05-06 11:30:18 +02:00
Fixes the saving of the video position between screens
This commit is contained in:
parent
7eddf4a12a
commit
e8c9e73985
@ -84,6 +84,7 @@ class MultiPlayerPlaybackManager(
|
|||||||
playingMap.put(id, mediaSession)
|
playingMap.put(id, mediaSession)
|
||||||
} else {
|
} else {
|
||||||
player.setWakeMode(C.WAKE_MODE_NONE)
|
player.setWakeMode(C.WAKE_MODE_NONE)
|
||||||
|
cachedPositions.add(uri, player.currentPosition)
|
||||||
cache.put(id, mediaSession)
|
cache.put(id, mediaSession)
|
||||||
playingMap.remove(id, mediaSession)
|
playingMap.remove(id, mediaSession)
|
||||||
}
|
}
|
||||||
@ -92,8 +93,11 @@ class MultiPlayerPlaybackManager(
|
|||||||
override fun onPlaybackStateChanged(playbackState: Int) {
|
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||||
when (playbackState) {
|
when (playbackState) {
|
||||||
STATE_IDLE -> {
|
STATE_IDLE -> {
|
||||||
|
// only saves if it wqs playing
|
||||||
|
if (abs(player.currentPosition) > 1) {
|
||||||
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) {
|
||||||
@ -102,10 +106,13 @@ class MultiPlayerPlaybackManager(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
// only saves if it wqs playing
|
||||||
|
if (abs(player.currentPosition) > 1) {
|
||||||
cachedPositions.add(uri, player.currentPosition)
|
cachedPositions.add(uri, player.currentPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
cache.put(id, mediaSession)
|
cache.put(id, mediaSession)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user