Filter out unsupported mimetypes in getSources() instead of the quality setter
This commit is contained in:
parent
f15e07f7f5
commit
ed606c28ab
@ -11,7 +11,10 @@ const html5 = {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array.from(this.media.querySelectorAll('source'));
|
const sources = Array.from(this.media.querySelectorAll('source'));
|
||||||
|
|
||||||
|
// Filter out unsupported sources
|
||||||
|
return sources.filter(source => support.mime.call(this, source.getAttribute('type')));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get quality levels
|
// Get quality levels
|
||||||
@ -46,14 +49,11 @@ const html5 = {
|
|||||||
// Get sources
|
// Get sources
|
||||||
const sources = html5.getSources.call(player);
|
const sources = html5.getSources.call(player);
|
||||||
|
|
||||||
// Get matches for requested size
|
// Get first match for requested size
|
||||||
const matches = sources.filter(source => Number(source.getAttribute('size')) === input);
|
const source = sources.find(source => Number(source.getAttribute('size')) === input);
|
||||||
|
|
||||||
// Get supported sources
|
// No matching source found
|
||||||
const supported = matches.filter(source => support.mime.call(player, source.getAttribute('type')));
|
if (!source) {
|
||||||
|
|
||||||
// No supported sources
|
|
||||||
if (utils.is.empty(supported)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ const html5 = {
|
|||||||
const { currentTime, playing } = player;
|
const { currentTime, playing } = player;
|
||||||
|
|
||||||
// Set new source
|
// Set new source
|
||||||
player.media.src = supported[0].getAttribute('src');
|
player.media.src = source.getAttribute('src');
|
||||||
|
|
||||||
// Restore time
|
// Restore time
|
||||||
const onLoadedMetaData = () => {
|
const onLoadedMetaData = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user