mirror of
https://github.com/samsonjs/media.git
synced 2026-04-20 13:45:47 +00:00
Cleanup to use getCodecsOfType()
Use the `Util.getCodecsOfType()` method rather than hard coded codec strings
This commit is contained in:
parent
232820d3e1
commit
4ad4a826ab
1 changed files with 6 additions and 7 deletions
|
|
@ -458,19 +458,18 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
|
|||
}
|
||||
break;
|
||||
case TYPE_SUBTITLES:
|
||||
String subtitleMime = MimeTypes.TEXT_VTT; // Assume VTT unless variant declares it
|
||||
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||
variant = getVariantWithSubtitleGroup(variants, groupId);
|
||||
if (variant != null) {
|
||||
@Nullable
|
||||
String codecs[] = Util.splitCodecs(variant.format.codecs);
|
||||
for (String codec : codecs) {
|
||||
if (codec.equalsIgnoreCase("stpp.ttml.im1t")) { // TOOD move this all to Utils.x
|
||||
subtitleMime = MimeTypes.APPLICATION_TTML;
|
||||
}
|
||||
String codecs = Util.getCodecsOfType(variant.format.codecs, C.TRACK_TYPE_AUDIO);
|
||||
sampleMimeType = MimeTypes.getMediaMimeType(codecs);
|
||||
if (sampleMimeType == null) {
|
||||
sampleMimeType = MimeTypes.TEXT_VTT;
|
||||
}
|
||||
}
|
||||
|
||||
formatBuilder.setSampleMimeType(subtitleMime).setMetadata(metadata);
|
||||
formatBuilder.setSampleMimeType(sampleMimeType).setMetadata(metadata);
|
||||
subtitles.add(new Rendition(uri, formatBuilder.build(), groupId, name));
|
||||
break;
|
||||
case TYPE_CLOSED_CAPTIONS:
|
||||
|
|
|
|||
Loading…
Reference in a new issue