Cleanup
This commit is contained in:
parent
3cd6c2acf6
commit
8aaa932050
@ -5,7 +5,7 @@
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"globals": { "Plyr": true },
|
||||
"globals": { "Plyr": false, "jQuery": false },
|
||||
"rules": {
|
||||
"no-const-assign": 1,
|
||||
"no-this-before-super": 1,
|
||||
|
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
@ -7,7 +7,6 @@ import captions from './../captions';
|
||||
import ui from './../ui';
|
||||
|
||||
const vimeo = {
|
||||
// Setup YouTube
|
||||
setup() {
|
||||
// Remove old containers
|
||||
const containers = utils.getElements.call(this, `[id^="${this.type}-"]`);
|
||||
@ -34,7 +33,7 @@ const vimeo = {
|
||||
}
|
||||
},
|
||||
|
||||
// Ready
|
||||
// API Ready
|
||||
ready() {
|
||||
const player = this;
|
||||
|
||||
|
@ -7,7 +7,6 @@ import controls from './../controls';
|
||||
import ui from './../ui';
|
||||
|
||||
const youtube = {
|
||||
// Setup YouTube
|
||||
setup() {
|
||||
const videoId = utils.parseYouTubeId(this.embedId);
|
||||
|
||||
@ -45,7 +44,7 @@ const youtube = {
|
||||
}
|
||||
},
|
||||
|
||||
// Handle YouTube API ready
|
||||
// API ready
|
||||
ready(videoId) {
|
||||
const player = this;
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
|
||||
/* global jQuery */
|
||||
|
||||
import defaults from './defaults';
|
||||
import types from './types';
|
||||
import support from './support';
|
||||
@ -80,6 +78,7 @@ class Plyr {
|
||||
};
|
||||
|
||||
// Captions
|
||||
// TODO: captions.enabled should be in config?
|
||||
this.captions = {
|
||||
enabled: null,
|
||||
tracks: null,
|
||||
@ -647,8 +646,7 @@ class Plyr {
|
||||
const player = this;
|
||||
|
||||
// Nothing specified
|
||||
if (utils.is.empty(input)) {
|
||||
this.toggleCaptions(false);
|
||||
if (!utils.is.string(input)) {
|
||||
return player;
|
||||
}
|
||||
|
||||
@ -886,8 +884,8 @@ class Plyr {
|
||||
}
|
||||
|
||||
// Check for support
|
||||
supports(mimeType) {
|
||||
return support.mime(this, mimeType);
|
||||
supports(type) {
|
||||
return support.mime.call(this, type);
|
||||
}
|
||||
|
||||
// Destroy an instance
|
||||
|
@ -87,8 +87,8 @@ const support = {
|
||||
// Check for mime type support against a player instance
|
||||
// Credits: http://diveintohtml5.info/everything.html
|
||||
// Related: http://www.leanbackplayer.com/test/h5mt.html
|
||||
mime(player, type) {
|
||||
const media = { player };
|
||||
mime(type) {
|
||||
const { media } = this;
|
||||
|
||||
try {
|
||||
// Bail if no checking function
|
||||
@ -97,25 +97,31 @@ const support = {
|
||||
}
|
||||
|
||||
// Type specific checks
|
||||
if (player.type === 'video') {
|
||||
if (this.type === 'video') {
|
||||
switch (type) {
|
||||
case 'video/webm':
|
||||
return media.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, '');
|
||||
|
||||
case 'video/mp4':
|
||||
return media.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, '');
|
||||
|
||||
case 'video/ogg':
|
||||
return media.canPlayType('video/ogg; codecs="theora"').replace(/no/, '');
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else if (player.type === 'audio') {
|
||||
} else if (this.type === 'audio') {
|
||||
switch (type) {
|
||||
case 'audio/mpeg':
|
||||
return media.canPlayType('audio/mpeg;').replace(/no/, '');
|
||||
|
||||
case 'audio/ogg':
|
||||
return media.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, '');
|
||||
|
||||
case 'audio/wav':
|
||||
return media.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user