File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2195,12 +2195,12 @@ private void notifyAudioTrackUpdateToListeners() {
21952195 }
21962196 }
21972197
2198- public void useVideoSource (final boolean videoEnabled ) {
2198+ public void useVideoAndSubtitles (final boolean videoAndSubtitlesEnabled ) {
21992199 if (playQueue == null || audioPlayerSelected ()) {
22002200 return ;
22012201 }
22022202
2203- isAudioOnly = !videoEnabled ;
2203+ isAudioOnly = !videoAndSubtitlesEnabled ;
22042204
22052205 getCurrentStreamInfo ().ifPresentOrElse (info -> {
22062206 // In case we don't know the source type, fall back to either video-with-audio, or
@@ -2214,10 +2214,11 @@ public void useVideoSource(final boolean videoEnabled) {
22142214
22152215 setRecovery ();
22162216
2217- // Disable or enable video and subtitles renderers depending of the videoEnabled value
2217+ // Disable or enable video and subtitles renderers depending of the
2218+ // videoAndSubtitlesEnabled value
22182219 trackSelector .setParameters (trackSelector .buildUponParameters ()
2219- .setTrackTypeDisabled (C .TRACK_TYPE_TEXT , !videoEnabled )
2220- .setTrackTypeDisabled (C .TRACK_TYPE_VIDEO , !videoEnabled ));
2220+ .setTrackTypeDisabled (C .TRACK_TYPE_TEXT , !videoAndSubtitlesEnabled )
2221+ .setTrackTypeDisabled (C .TRACK_TYPE_VIDEO , !videoAndSubtitlesEnabled ));
22212222 }, () -> {
22222223 /*
22232224 The current metadata may be null sometimes (for e.g. when using an unstable connection
Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ public void onBroadcastReceived(final Intent intent) {
331331 } else if (VideoDetailFragment .ACTION_VIDEO_FRAGMENT_RESUMED .equals (intent .getAction ())) {
332332 // Restore video source when user returns to the fragment
333333 fragmentIsVisible = true ;
334- player .useVideoSource (true );
334+ player .useVideoAndSubtitles (true );
335335
336336 // When a user returns from background, the system UI will always be shown even if
337337 // controls are invisible: hide it in that case
@@ -370,7 +370,7 @@ private void onFragmentStopped() {
370370 if (player .isPlaying () || player .isLoading ()) {
371371 switch (getMinimizeOnExitAction (context )) {
372372 case MINIMIZE_ON_EXIT_MODE_BACKGROUND :
373- player .useVideoSource (false );
373+ player .useVideoAndSubtitles (false );
374374 break ;
375375 case MINIMIZE_ON_EXIT_MODE_POPUP :
376376 getParentActivity ().ifPresent (activity -> {
Original file line number Diff line number Diff line change @@ -219,10 +219,10 @@ public void onBroadcastReceived(final Intent intent) {
219219 } else if (player .isPlaying () || player .isLoading ()) {
220220 if (Intent .ACTION_SCREEN_OFF .equals (intent .getAction ())) {
221221 // Use only audio source when screen turns off while popup player is playing
222- player .useVideoSource (false );
222+ player .useVideoAndSubtitles (false );
223223 } else if (Intent .ACTION_SCREEN_ON .equals (intent .getAction ())) {
224224 // Restore video source when screen turns on and user was watching video in popup
225- player .useVideoSource (true );
225+ player .useVideoAndSubtitles (true );
226226 }
227227 }
228228 }
You can’t perform that action at this time.
0 commit comments