aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/support.js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-06-15 14:06:28 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-06-16 07:27:04 +0200
commit64bb206d85e5f7415d5ff81821e19fb107c30877 (patch)
tree720b1ef64d8335c9bceb9b0eb27cd8866a520202 /src/js/support.js
parent2d6732d5801fb19ad24f180f0adea7233b57f088 (diff)
downloadplyr-64bb206d85e5f7415d5ff81821e19fb107c30877.tar.lz
plyr-64bb206d85e5f7415d5ff81821e19fb107c30877.tar.xz
plyr-64bb206d85e5f7415d5ff81821e19fb107c30877.zip
Replace switch in support.check with simpler conditions
Diffstat (limited to 'src/js/support.js')
-rw-r--r--src/js/support.js26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/js/support.js b/src/js/support.js
index 7eabae3c..e6ce30c4 100644
--- a/src/js/support.js
+++ b/src/js/support.js
@@ -16,31 +16,9 @@ const support = {
// Check for support
// Basic functionality vs full UI
check(type, provider, playsinline) {
- let api = false;
- let ui = false;
const canPlayInline = browser.isIPhone && playsinline && support.playsinline;
-
- switch (`${provider}:${type}`) {
- 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;
- }
+ const api = support[type] || provider !== 'html5';
+ const ui = api && support.rangeInput && (type !== 'video' || !browser.isIPhone || canPlayInline);
return {
api,