mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 19:12:45 +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:
parent
d27d36b76a
commit
8932adbf88
@ -3294,25 +3294,26 @@ public final class Player implements
|
|||||||
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
|
public MediaSource sourceOf(final PlayQueueItem item, final StreamInfo info) {
|
||||||
if (audioPlayerSelected()) {
|
if (audioPlayerSelected()) {
|
||||||
return audioResolver.resolve(info);
|
return audioResolver.resolve(info);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
if (isAudioOnly && videoResolver.getStreamSourceType().orElse(
|
if (isAudioOnly && videoResolver.getStreamSourceType().orElse(
|
||||||
SourceType.VIDEO_WITH_AUDIO_OR_AUDIO_ONLY)
|
SourceType.VIDEO_WITH_AUDIO_OR_AUDIO_ONLY)
|
||||||
== 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
|
// If the current info has only video streams with audio and if the stream is played as
|
||||||
// played as audio, we need to use the audio resolver, otherwise the video stream
|
// audio, we need to use the audio resolver, otherwise the video stream will be played
|
||||||
// will be played in background.
|
// in background.
|
||||||
return audioResolver.resolve(info);
|
return audioResolver.resolve(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even if the stream is played in background, we need to use the video resolver if the
|
// 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
|
// 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
|
// resolver was called when the app was in background, the app will only stream audio when
|
||||||
// when the user come back to the app and will never fetch the video stream.
|
// 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
|
// 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);
|
return videoResolver.resolve(info);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void disablePreloadingOfCurrentTrack() {
|
public void disablePreloadingOfCurrentTrack() {
|
||||||
loadController.disablePreloadingOfCurrentTrack();
|
loadController.disablePreloadingOfCurrentTrack();
|
||||||
|
Loading…
Reference in New Issue
Block a user