diff --git a/app/src/main/java/org/schabi/newpipe/player/resolver/AudioPlaybackResolver.java b/app/src/main/java/org/schabi/newpipe/player/resolver/AudioPlaybackResolver.java index 6730fc741..6b2e3d27c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/resolver/AudioPlaybackResolver.java +++ b/app/src/main/java/org/schabi/newpipe/player/resolver/AudioPlaybackResolver.java @@ -96,7 +96,11 @@ public class AudioPlaybackResolver implements PlaybackResolver { } } - public void setAudioTrack(@Nullable final String audioLanguage) { - this.audioTrack = audioLanguage; + /** Set audio track to be used the next time {@link #resolve(StreamInfo)} is called. + * + * @param audioTrack the {@link AudioStream} audioTrackId that should be selected on resolve + */ + public void setAudioTrack(@Nullable final String audioTrack) { + this.audioTrack = audioTrack; } } diff --git a/app/src/main/java/org/schabi/newpipe/player/resolver/VideoPlaybackResolver.java b/app/src/main/java/org/schabi/newpipe/player/resolver/VideoPlaybackResolver.java index 5c2b89027..312bac7e9 100644 --- a/app/src/main/java/org/schabi/newpipe/player/resolver/VideoPlaybackResolver.java +++ b/app/src/main/java/org/schabi/newpipe/player/resolver/VideoPlaybackResolver.java @@ -218,12 +218,12 @@ public class VideoPlaybackResolver implements PlaybackResolver { this.playbackQuality = playbackQuality; } - @Nullable - public String getAudioTrack() { - return audioTrack; - } - - public void setAudioTrack(@Nullable final String audioLanguage) { - this.audioTrack = audioLanguage; + /** Set audio track to be used the next time {@link #resolve(StreamInfo, SelectedPlayer)} + * is called. + * + * @param audioTrack the {@link AudioStream} audioTrackId that should be selected on resolve + */ + public void setAudioTrack(@Nullable final String audioTrack) { + this.audioTrack = audioTrack; } } diff --git a/app/src/main/java/org/schabi/newpipe/util/ListHelper.java b/app/src/main/java/org/schabi/newpipe/util/ListHelper.java index 2b8f982ce..7ac5adb57 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ListHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ListHelper.java @@ -121,12 +121,13 @@ public final class ListHelper { * . * @param context * @param audioStreams - * @param trackId ??? + * @param trackId Try to find this #AudioStream.getAudioTrackId in the audioStreams & select it * @return index to play, or -1 if audioStreams is empty. */ public static int getAudioFormatIndex(final Context context, @NonNull final List audioStreams, @Nullable final String trackId) { + // if we were given a trackId, try to select that before going to the defaults. if (trackId != null) { for (int i = 0; i < audioStreams.size(); i++) { final AudioStream s = audioStreams.get(i);