Merge pull request #10275 from J-Stutzmann/fix/audio-focus
Fix player audio focus not respecting mute
This commit is contained in:
commit
50d7d1b7b3
1 changed files with 9 additions and 2 deletions
|
@ -1082,7 +1082,7 @@ public final class Player implements PlaybackListener, Listener {
|
|||
|
||||
UIs.call(PlayerUi::onPrepared);
|
||||
|
||||
if (playWhenReady) {
|
||||
if (playWhenReady && !isMuted()) {
|
||||
audioReactor.requestAudioFocus();
|
||||
}
|
||||
}
|
||||
|
@ -1223,6 +1223,11 @@ public final class Player implements PlaybackListener, Listener {
|
|||
public void toggleMute() {
|
||||
final boolean wasMuted = isMuted();
|
||||
simpleExoPlayer.setVolume(wasMuted ? 1 : 0);
|
||||
if (wasMuted) {
|
||||
audioReactor.requestAudioFocus();
|
||||
} else {
|
||||
audioReactor.abandonAudioFocus();
|
||||
}
|
||||
UIs.call(playerUi -> playerUi.onMuteUnmuteChanged(!wasMuted));
|
||||
notifyPlaybackUpdateToListeners();
|
||||
}
|
||||
|
@ -1620,7 +1625,9 @@ public final class Player implements PlaybackListener, Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!isMuted()) {
|
||||
audioReactor.requestAudioFocus();
|
||||
}
|
||||
|
||||
if (currentState == STATE_COMPLETED) {
|
||||
if (playQueue.getIndex() == 0) {
|
||||
|
|
Loading…
Reference in a new issue