mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 07:13:00 +00:00 
			
		
		
		
	Made audio-focus calls respect mute state.
This commit is contained in:
		| @@ -1082,7 +1082,7 @@ public final class Player implements PlaybackListener, Listener { | |||||||
|  |  | ||||||
|         UIs.call(PlayerUi::onPrepared); |         UIs.call(PlayerUi::onPrepared); | ||||||
|  |  | ||||||
|         if (playWhenReady) { |         if (playWhenReady && !isMuted()) { | ||||||
|             audioReactor.requestAudioFocus(); |             audioReactor.requestAudioFocus(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -1223,6 +1223,11 @@ public final class Player implements PlaybackListener, Listener { | |||||||
|     public void toggleMute() { |     public void toggleMute() { | ||||||
|         final boolean wasMuted = isMuted(); |         final boolean wasMuted = isMuted(); | ||||||
|         simpleExoPlayer.setVolume(wasMuted ? 1 : 0); |         simpleExoPlayer.setVolume(wasMuted ? 1 : 0); | ||||||
|  |         if (wasMuted) { | ||||||
|  |             audioReactor.requestAudioFocus(); | ||||||
|  |         } else { | ||||||
|  |             audioReactor.abandonAudioFocus(); | ||||||
|  |         } | ||||||
|         UIs.call(playerUi -> playerUi.onMuteUnmuteChanged(!wasMuted)); |         UIs.call(playerUi -> playerUi.onMuteUnmuteChanged(!wasMuted)); | ||||||
|         notifyPlaybackUpdateToListeners(); |         notifyPlaybackUpdateToListeners(); | ||||||
|     } |     } | ||||||
| @@ -1620,7 +1625,9 @@ public final class Player implements PlaybackListener, Listener { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         audioReactor.requestAudioFocus(); |         if (!isMuted()) { | ||||||
|  |             audioReactor.requestAudioFocus(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         if (currentState == STATE_COMPLETED) { |         if (currentState == STATE_COMPLETED) { | ||||||
|             if (playQueue.getIndex() == 0) { |             if (playQueue.getIndex() == 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 J-Stutzmann
					J-Stutzmann