From cc559dc9ce181fef19946667bfe4a9b5e827ee8d Mon Sep 17 00:00:00 2001 From: karol Date: Sun, 23 Feb 2020 22:55:34 +0100 Subject: [PATCH] isMuted() added --- .../java/org/schabi/newpipe/player/BasePlayer.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 79496388c..2fe04c9d1 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -538,13 +538,11 @@ public abstract class BasePlayer implements public void onMuteUnmuteButtonClicled(){ if (DEBUG) Log.d(TAG, "onMuteUnmuteButtonClicled() called"); + simpleExoPlayer.setVolume(isMuted() ? 1 : 0); + } - if (simpleExoPlayer.getVolume() != 0) { - simpleExoPlayer.setVolume(0); - } - else { - simpleExoPlayer.setVolume(1); - } + public boolean isMuted(){ + return simpleExoPlayer.getVolume() == 0; } /*//////////////////////////////////////////////////////////////////////////