Replace switch in support.check with simpler conditions
This commit is contained in:
parent
2d6732d580
commit
64bb206d85
@ -16,31 +16,9 @@ const support = {
|
|||||||
// Check for support
|
// Check for support
|
||||||
// Basic functionality vs full UI
|
// Basic functionality vs full UI
|
||||||
check(type, provider, playsinline) {
|
check(type, provider, playsinline) {
|
||||||
let api = false;
|
|
||||||
let ui = false;
|
|
||||||
const canPlayInline = browser.isIPhone && playsinline && support.playsinline;
|
const canPlayInline = browser.isIPhone && playsinline && support.playsinline;
|
||||||
|
const api = support[type] || provider !== 'html5';
|
||||||
switch (`${provider}:${type}`) {
|
const ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
|
||||||
case 'html5:video':
|
|
||||||
api = support.video;
|
|
||||||
ui = api && support.rangeInput && (!browser.isIPhone || canPlayInline);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'html5:audio':
|
|
||||||
api = support.audio;
|
|
||||||
ui = api && support.rangeInput;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'youtube:video':
|
|
||||||
case 'vimeo:video':
|
|
||||||
api = true;
|
|
||||||
ui = support.rangeInput && (!browser.isIPhone || canPlayInline);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
api = support.audio && support.video;
|
|
||||||
ui = api && support.rangeInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
api,
|
api,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user