diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java index 18821ab09..d4da8ea45 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java @@ -162,6 +162,26 @@ public final class PlayerHolder { context.stopService(new Intent(context, PlayerService.class)); } + + private void unbind(final Context context) { + if (DEBUG) { + Log.d(TAG, "unbind() called"); + } + + if (bound) { + context.unbindService(serviceConnection); + bound = false; + if (player != null) { + player.removeFragmentListener(internalListener); + } + playerService = null; + player = null; + if (listener != null) { + listener.onServiceDisconnected(); + } + } + } + class PlayerServiceConnection implements ServiceConnection { private boolean playAfterConnect = false; @@ -195,25 +215,6 @@ public final class PlayerHolder { } } - private void unbind(final Context context) { - if (DEBUG) { - Log.d(TAG, "unbind() called"); - } - - if (bound) { - context.unbindService(serviceConnection); - bound = false; - if (player != null) { - player.removeFragmentListener(internalListener); - } - playerService = null; - player = null; - if (listener != null) { - listener.onServiceDisconnected(); - } - } - } - private final PlayerServiceEventListener internalListener = new PlayerServiceEventListener() { @Override