Skip to content

Commit 6af22e3

Browse files
authored
Merge pull request #1237 from AudricV/yt_more-audio-track-types-support
[YouTube] Add support for automatic dubbed and secondary audio tracks
2 parents abba78c + 8a3350f commit 6af22e3

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,12 @@ public static AudioTrackType extractAudioTrackType(final String streamUrl) {
17201720
case "original":
17211721
return AudioTrackType.ORIGINAL;
17221722
case "dubbed":
1723+
case "dubbed-auto":
17231724
return AudioTrackType.DUBBED;
17241725
case "descriptive":
17251726
return AudioTrackType.DESCRIPTIVE;
1727+
case "secondary":
1728+
return AudioTrackType.SECONDARY;
17261729
default:
17271730
return null;
17281731
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/dashmanifestcreators/YoutubeDashManifestCreatorsUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ private static String getRoleValue(@Nullable final AudioTrackType trackType) {
325325
case DESCRIPTIVE:
326326
return "description";
327327
default:
328+
// Secondary track types do not seem to have a dedicated role in the DASH
329+
// specification, so use alternate for them
328330
return "alternate";
329331
}
330332
}

extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioTrackType.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package org.schabi.newpipe.extractor.stream;
22

33
/**
4-
* An enum representing the track type of an {@link AudioStream} extracted by a {@link
4+
* An enum representing the track type of {@link AudioStream}s extracted by a {@link
55
* StreamExtractor}.
66
*/
77
public enum AudioTrackType {
8+
89
/**
9-
* An original audio track of the video.
10+
* An original audio track of a video.
1011
*/
1112
ORIGINAL,
1213

@@ -20,6 +21,7 @@ public enum AudioTrackType {
2021

2122
/**
2223
* A descriptive audio track.
24+
*
2325
* <p>
2426
* A descriptive audio track is an audio track in which descriptions of visual elements of
2527
* a video are added to the original audio, with the goal to make a video more accessible to
@@ -29,5 +31,15 @@ public enum AudioTrackType {
2931
* @see <a href="https://en.wikipedia.org/wiki/Audio_description">
3032
* https://en.wikipedia.org/wiki/Audio_description</a>
3133
*/
32-
DESCRIPTIVE
34+
DESCRIPTIVE,
35+
36+
/**
37+
* A secondary audio track.
38+
*
39+
* <p>
40+
* A secondary audio track can be an alternate audio track from the original language of a
41+
* video or an alternate language.
42+
* </p>
43+
*/
44+
SECONDARY
3345
}

0 commit comments

Comments
 (0)