parent
04c6573dfb
commit
fcb13d3fc6
2 changed files with 12 additions and 2 deletions
|
@ -755,7 +755,17 @@ class MPVPlayer(
|
|||
playWhenReadyChangeReason = Player.PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
|
||||
)
|
||||
if (isPlayerReady) {
|
||||
MPVLib.setPropertyBoolean("pause", !playWhenReady)
|
||||
// Request audio focus when starting playback
|
||||
if (requestAudioFocus && playWhenReady) {
|
||||
val res = audioManager.requestAudioFocus(audioFocusRequest)
|
||||
if (res != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
|
||||
MPVLib.setPropertyBoolean("pause", true)
|
||||
} else {
|
||||
MPVLib.setPropertyBoolean("pause", false)
|
||||
}
|
||||
} else {
|
||||
MPVLib.setPropertyBoolean("pause", !playWhenReady)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ constructor(
|
|||
.build()
|
||||
player = MPVPlayer(
|
||||
context = application,
|
||||
requestAudioFocus = false,
|
||||
requestAudioFocus = true,
|
||||
trackSelectionParameters = trackSelectionParameters,
|
||||
seekBackIncrement = appPreferences.playerSeekBackIncrement,
|
||||
seekForwardIncrement = appPreferences.playerSeekForwardIncrement,
|
||||
|
|
Loading…
Reference in a new issue