Fix support check
This commit is contained in:
parent
1a9b860e68
commit
65eb5c1b8b
@ -70,25 +70,21 @@ const support = {
|
|||||||
// Related: http://www.leanbackplayer.com/test/h5mt.html
|
// Related: http://www.leanbackplayer.com/test/h5mt.html
|
||||||
mime(inputType) {
|
mime(inputType) {
|
||||||
const [mediaType] = inputType.split('/');
|
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) {
|
if (!this.isHTML5 || mediaType !== this.type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let type;
|
// Add codec if required
|
||||||
if (inputType && inputType.includes('codecs=')) {
|
if (Object.keys(defaultCodecs).includes(type)) {
|
||||||
// Use input directly
|
type += `; codecs="${defaultCodecs[inputType]}"`;
|
||||||
type = inputType;
|
|
||||||
} else if (inputType === 'audio/mpeg') {
|
|
||||||
// Skip codec
|
|
||||||
type = 'audio/mpeg;';
|
|
||||||
} else if (inputType in defaultCodecs) {
|
|
||||||
// Use codec
|
|
||||||
type = `${inputType}; codecs="${defaultCodecs[inputType]}"`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
|
return Boolean(type && this.media.canPlayType(type).replace(/no/, ''));
|
||||||
} catch (err) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user