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