Skip to content

Commit

Permalink
fix(hls): Fix raw format detection when the main playlist hasn't type (
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Oct 18, 2022
1 parent 86cb3e7 commit d319718
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2714,6 +2714,11 @@ shaka.hls.HlsParser = class {
return mimeType;
}

mimeType = HlsParser.RAW_FORMATS_TO_MIME_TYPES_[extension];
if (mimeType) {
return mimeType;
}

// The extension map didn't work, so guess based on codecs.
mimeType = this.guessMimeTypeBeforeLoading_(contentType, codecs);
if (mimeType) {
Expand Down Expand Up @@ -3091,6 +3096,18 @@ shaka.hls.HlsParser.StreamInfo;
shaka.hls.HlsParser.StreamInfos;


/**
* @const {!Object.<string, string>}
* @private
*/
shaka.hls.HlsParser.RAW_FORMATS_TO_MIME_TYPES_ = {
'aac': 'audio/aac',
'ac3': 'audio/ac3',
'ec3': 'audio/ec3',
'mp3': 'audio/mpeg',
};


/**
* @const {!Object.<string, string>}
* @private
Expand All @@ -3105,12 +3122,6 @@ shaka.hls.HlsParser.AUDIO_EXTENSIONS_TO_MIME_TYPES_ = {
'cmfa': 'audio/mp4',
// MPEG2-TS also uses video/ for audio: https://bit.ly/TsMse
'ts': 'video/mp2t',

// Raw formats:
'aac': 'audio/aac',
'ac3': 'audio/ac3',
'ec3': 'audio/ec3',
'mp3': 'audio/mpeg',
};


Expand Down

0 comments on commit d319718

Please sign in to comment.