aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/support.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-23 17:35:35 +1100
committerSam Potts <me@sampotts.me>2017-11-23 17:35:35 +1100
commit921cefd212f65290349aa1d9d533c95cb1f6fcce (patch)
tree69c58f43d154440d9f327fb5028372a488522fe2 /src/js/support.js
parentde6f0f1b778180f7b26f85f45053ffb97eb526af (diff)
downloadplyr-921cefd212f65290349aa1d9d533c95cb1f6fcce.tar.lz
plyr-921cefd212f65290349aa1d9d533c95cb1f6fcce.tar.xz
plyr-921cefd212f65290349aa1d9d533c95cb1f6fcce.zip
Moved to provider + type to make it cleaner in future, fix for multiple players
Diffstat (limited to 'src/js/support.js')
-rw-r--r--src/js/support.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/js/support.js b/src/js/support.js
index a8e0cc3e..fc61bbf6 100644
--- a/src/js/support.js
+++ b/src/js/support.js
@@ -12,29 +12,29 @@ const support = {
// Check for support
// Basic functionality vs full UI
- check(type, inline) {
+ check(type, provider, inline) {
let api = false;
let ui = false;
const browser = utils.getBrowser();
const playsInline = browser.isIPhone && inline && support.inline;
- switch (type) {
- case 'video':
+ switch (`${provider}:${type}`) {
+ case 'html5:video':
api = support.video;
ui = api && support.rangeInput && (!browser.isIPhone || playsInline);
break;
- case 'audio':
+ case 'html5:audio':
api = support.audio;
ui = api && support.rangeInput;
break;
- case 'youtube':
+ case 'youtube:video':
api = true;
ui = support.rangeInput && (!browser.isIPhone || playsInline);
break;
- case 'vimeo':
+ case 'vimeo:video':
api = true;
ui = support.rangeInput && !browser.isIPhone;
break;
@@ -92,12 +92,12 @@ const support = {
try {
// Bail if no checking function
- if (!utils.is.function(media.canPlayType)) {
+ if (!this.isHTML5 || !utils.is.function(media.canPlayType)) {
return false;
}
// Type specific checks
- if (this.type === 'video') {
+ if (this.isVideo) {
switch (type) {
case 'video/webm':
return media.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, '');
@@ -111,7 +111,7 @@ const support = {
default:
return false;
}
- } else if (this.type === 'audio') {
+ } else if (this.isAudio) {
switch (type) {
case 'audio/mpeg':
return media.canPlayType('audio/mpeg;').replace(/no/, '');