Fix support check

This commit is contained in:
Sam Potts 2018-11-03 21:16:40 +11:00
parent 1a9b860e68
commit 65eb5c1b8b

View File

@ -70,25 +70,21 @@ const support = {
// Related: http://www.leanbackplayer.com/test/h5mt.html
mime(inputType) {
const [mediaType] = inputType.split('/');
let type = inputType;
// Verify we're using HTML5 and there's no media type mismatch
if (!this.isHTML5 || mediaType !== this.type) {
return false;
}
let type;
if (inputType && inputType.includes('codecs=')) {
// Use input directly
type = inputType;
} else if (inputType === 'audio/mpeg') {
// Skip codec
type = 'audio/mpeg;';
} else if (inputType in defaultCodecs) {
// Use codec
type = `${inputType}; codecs="${defaultCodecs[inputType]}"`;
// Add codec if required
if (Object.keys(defaultCodecs).includes(type)) {
type += `; codecs="${defaultCodecs[inputType]}"`;
}
try {
return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
} catch (err) {
} catch (e) {
return false;
}
},