Skip to content

Commit

Permalink
fix(HLS): Fix detection of Media Playlist for audio and video only in…
Browse files Browse the repository at this point in the history
… MP4 (#4803)
  • Loading branch information
avelad authored and joeyparrish committed Dec 8, 2022
1 parent 57780dd commit f814d26
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,23 @@ shaka.hls.HlsParser = class {
if (playlist.segments.length) {
const parsedUri = new goog.Uri(playlist.segments[0].absoluteUri);
const extension = parsedUri.getPath().split('.').pop();
const mimeType = HlsParser.RAW_FORMATS_TO_MIME_TYPES_[extension];
let mimeType = HlsParser.RAW_FORMATS_TO_MIME_TYPES_[extension];
if (mimeType) {
fullMimeType = mimeType;
} else if (extension === 'ts') {
// TODO: Fetch one segment a use the TsParser to analize if there is
// video, audio or both.
} else if (extension === 'mp4') {
// TODO: Fetch one segment a use the Mp4Parser to analize if there is
// video, audio or both.
} else if (HlsParser.AUDIO_EXTENSIONS_TO_MIME_TYPES_[extension]) {
mimeType = HlsParser.AUDIO_EXTENSIONS_TO_MIME_TYPES_[extension];
const defaultAudioCodec = this.config_.hls.defaultAudioCodec;
fullMimeType = `${mimeType}; codecs="${defaultAudioCodec}"`;
} else if (HlsParser.VIDEO_EXTENSIONS_TO_MIME_TYPES_[extension]) {
mimeType = HlsParser.VIDEO_EXTENSIONS_TO_MIME_TYPES_[extension];
const defaultVideoCodec = this.config_.hls.defaultVideoCodec;
fullMimeType = `${mimeType}; codecs="${defaultVideoCodec}"`;
}
}

Expand Down

0 comments on commit f814d26

Please sign in to comment.