Moves wake lock to activate only when the video is actually playing
This commit is contained in:
@@ -66,7 +66,6 @@ class MultiPlayerPlaybackManager(
|
|||||||
repeatMode = Player.REPEAT_MODE_ALL
|
repeatMode = Player.REPEAT_MODE_ALL
|
||||||
videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT
|
videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT
|
||||||
volume = 0f
|
volume = 0f
|
||||||
setWakeMode(C.WAKE_MODE_NETWORK)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val mediaSession = MediaSession.Builder(context, player).run {
|
val mediaSession = MediaSession.Builder(context, player).run {
|
||||||
@@ -80,8 +79,10 @@ class MultiPlayerPlaybackManager(
|
|||||||
player.addListener(object : Player.Listener {
|
player.addListener(object : Player.Listener {
|
||||||
override fun onIsPlayingChanged(isPlaying: Boolean) {
|
override fun onIsPlayingChanged(isPlaying: Boolean) {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
|
player.setWakeMode(C.WAKE_MODE_NETWORK)
|
||||||
playingMap.put(id, mediaSession)
|
playingMap.put(id, mediaSession)
|
||||||
} else {
|
} else {
|
||||||
|
player.setWakeMode(C.WAKE_MODE_NONE)
|
||||||
cache.put(id, mediaSession)
|
cache.put(id, mediaSession)
|
||||||
playingMap.remove(id, mediaSession)
|
playingMap.remove(id, mediaSession)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user