From fabb8a6d792de630c19b5b24c1a64511c71b1b44 Mon Sep 17 00:00:00 2001 From: dhk2 Date: Fri, 3 Jul 2020 16:00:29 -0700 Subject: [PATCH] adding controls to exit pip or switch to background audio --- .../schueller/peertube/service/VideoPlayerService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java index a601af4..fbfc033 100644 --- a/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java +++ b/app/src/main/java/net/schueller/peertube/service/VideoPlayerService.java @@ -131,8 +131,13 @@ public class VideoPlayerService extends Service { playerNotificationManager.setPlayer(null); } //Was seeing an error when exiting the program about about not unregistering the receiver. - if (null!=myNoisyAudioStreamReceiver) { - this.unregisterReceiver(myNoisyAudioStreamReceiver); + //Null check is insufficient to determine if it's been registered + try { + if (null!=myNoisyAudioStreamReceiver) { + this.unregisterReceiver(myNoisyAudioStreamReceiver); + } + } catch (Exception e) { + Log.e(TAG,"attempted to unregister a nonregistered noisy audio service"); } if (player != null) { player.release();