From 9437f057d0e2a5f242cf8aae9ce5376c8b3b4f72 Mon Sep 17 00:00:00 2001 From: Redirion Date: Thu, 14 Feb 2019 09:52:46 +0100 Subject: [PATCH 1/3] Fix delayed ducking of Audio Scenario: listening to a video on NewPipe over Bluetooth and a Notification Sound causes audio focus event AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK. Problem: With the current implementation animateAudio would cause the audio to reach the target volume AFTER the notification sound is played, which is irritating and annoying. Solution: animateAudio should just be used on focusGain where it is sensible to increase audio gradually. On ducking event the reaction should be immediate. This very simple fix does this. Please approve. --- .../java/org/schabi/newpipe/player/helper/AudioReactor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/AudioReactor.java b/app/src/main/java/org/schabi/newpipe/player/helper/AudioReactor.java index 46d20c7e1..f148aed27 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/AudioReactor.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/AudioReactor.java @@ -131,7 +131,7 @@ public class AudioReactor implements AudioManager.OnAudioFocusChangeListener, private void onAudioFocusLossCanDuck() { Log.d(TAG, "onAudioFocusLossCanDuck() called"); // Set the volume to 1/10 on ducking - animateAudio(player.getVolume(), DUCK_AUDIO_TO); + player.setVolume(DUCK_AUDIO_TO); } private void animateAudio(final float from, final float to) { From db9cf9564820fbf1bbd6087d3e6b3189d69d2e13 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Sun, 17 Feb 2019 09:52:05 +0100 Subject: [PATCH 2/3] Remove old player from the manifest See https://github.com/TeamNewPipe/NewPipe/pull/1884 for more info --- app/src/main/AndroidManifest.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 06d621016..af6dda798 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,12 +35,6 @@ - - From 4dd572063ef5b38d9c31e66b306e47727702e106 Mon Sep 17 00:00:00 2001 From: kapodamy Date: Sun, 17 Feb 2019 16:59:35 -0300 Subject: [PATCH 3/3] fix crash while switching from popup to fullscreen player, or closing the popup player. --- .../main/java/org/schabi/newpipe/player/PopupVideoPlayer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java index f5c731ed9..8ea3d509c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java @@ -626,6 +626,7 @@ public final class PopupVideoPlayer extends Service { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); + if (playerImpl == null) return; // rebuild notification here since remote view does not release bitmaps, // causing memory leaks resetNotification();