1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-22 11:02:35 +01:00

Apply suggested change and add a note about data consumption for HLS streams in background

ExoPlayer right now fetches HLS video tracks even if you disable them (with setRendererDisabled or setSelectionOverride).
See issue 9282 of ExoPlayer's issue tracker for more information.
This commit is contained in:
TiA4f8R 2022-02-13 16:54:44 +01:00
parent d27d36b76a
commit 8932adbf88
No known key found for this signature in database
GPG Key ID: E6D3E7F5949450DD

View File

@ -3294,25 +3294,26 @@ public final class Player implements
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
if (audioPlayerSelected()) {
return audioResolver.resolve(info);
} else {
}
if (isAudioOnly && videoResolver.getStreamSourceType().orElse(
SourceType.VIDEO_WITH_AUDIO_OR_AUDIO_ONLY)
== SourceType.VIDEO_WITH_AUDIO_OR_AUDIO_ONLY) {
// If the current info has only video streams with audio and if the stream is
// played as audio, we need to use the audio resolver, otherwise the video stream
// will be played in background.
// If the current info has only video streams with audio and if the stream is played as
// audio, we need to use the audio resolver, otherwise the video stream will be played
// in background.
return audioResolver.resolve(info);
}
// Even if the stream is played in background, we need to use the video resolver if the
// info played is separated video-only and audio-only streams; otherwise, if the audio
// resolver was called when the app was in background, the app will only stream audio
// when the user come back to the app and will never fetch the video stream.
// resolver was called when the app was in background, the app will only stream audio when
// the user come back to the app and will never fetch the video stream.
// Note that the video is not fetched when the app is in background because the video
// renderer is fully disabled (see useVideoSource method).
// renderer is fully disabled (see useVideoSource method), except for HLS streams
// (see https://github.com/google/ExoPlayer/issues/9282).
return videoResolver.resolve(info);
}
}
public void disablePreloadingOfCurrentTrack() {
loadController.disablePreloadingOfCurrentTrack();