diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 42f6cbf36..f3dfb0a91 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -2195,12 +2195,12 @@ public final class Player implements PlaybackListener, Listener { } } - public void useVideoSource(final boolean videoEnabled) { + public void useVideoAndSubtitles(final boolean videoAndSubtitlesEnabled) { if (playQueue == null || audioPlayerSelected()) { return; } - isAudioOnly = !videoEnabled; + isAudioOnly = !videoAndSubtitlesEnabled; getCurrentStreamInfo().ifPresentOrElse(info -> { // In case we don't know the source type, fall back to either video-with-audio, or @@ -2214,10 +2214,11 @@ public final class Player implements PlaybackListener, Listener { setRecovery(); - // Disable or enable video and subtitles renderers depending of the videoEnabled value + // Disable or enable video and subtitles renderers depending of the + // videoAndSubtitlesEnabled value trackSelector.setParameters(trackSelector.buildUponParameters() - .setTrackTypeDisabled(C.TRACK_TYPE_TEXT, !videoEnabled) - .setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, !videoEnabled)); + .setTrackTypeDisabled(C.TRACK_TYPE_TEXT, !videoAndSubtitlesEnabled) + .setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, !videoAndSubtitlesEnabled)); }, () -> { /* The current metadata may be null sometimes (for e.g. when using an unstable connection diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java index bfcc82984..b21a387a9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java @@ -331,7 +331,7 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh } else if (VideoDetailFragment.ACTION_VIDEO_FRAGMENT_RESUMED.equals(intent.getAction())) { // Restore video source when user returns to the fragment fragmentIsVisible = true; - player.useVideoSource(true); + player.useVideoAndSubtitles(true); // When a user returns from background, the system UI will always be shown even if // controls are invisible: hide it in that case @@ -370,7 +370,7 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh if (player.isPlaying() || player.isLoading()) { switch (getMinimizeOnExitAction(context)) { case MINIMIZE_ON_EXIT_MODE_BACKGROUND: - player.useVideoSource(false); + player.useVideoAndSubtitles(false); break; case MINIMIZE_ON_EXIT_MODE_POPUP: getParentActivity().ifPresent(activity -> { diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java index 24b734fe0..10a982bf0 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/PopupPlayerUi.java @@ -219,10 +219,10 @@ public final class PopupPlayerUi extends VideoPlayerUi { } else if (player.isPlaying() || player.isLoading()) { if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { // Use only audio source when screen turns off while popup player is playing - player.useVideoSource(false); + player.useVideoAndSubtitles(false); } else if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) { // Restore video source when screen turns on and user was watching video in popup - player.useVideoSource(true); + player.useVideoAndSubtitles(true); } } }