Cleanup
This commit is contained in:
4
dist/plyr.js
vendored
4
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -426,8 +426,7 @@
|
|||||||
isChrome: isChrome,
|
isChrome: isChrome,
|
||||||
isSafari: isSafari,
|
isSafari: isSafari,
|
||||||
isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
|
isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
|
||||||
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform),
|
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform)
|
||||||
isTouch: 'ontouchstart' in document.documentElement
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -933,12 +932,8 @@
|
|||||||
// Check for support
|
// Check for support
|
||||||
var support = {
|
var support = {
|
||||||
// Basic support
|
// Basic support
|
||||||
audio: (function() {
|
audio: 'canPlayType' in document.createElement('audio'),
|
||||||
return 'canPlayType' in document.createElement('video');
|
video: 'canPlayType' in document.createElement('video'),
|
||||||
})(),
|
|
||||||
video: (function() {
|
|
||||||
return 'canPlayType' in document.createElement('video');
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// Fullscreen support and set prefix
|
// Fullscreen support and set prefix
|
||||||
fullscreen: fullscreen.prefix !== false,
|
fullscreen: fullscreen.prefix !== false,
|
||||||
@ -980,15 +975,11 @@
|
|||||||
|
|
||||||
// Airplay support
|
// Airplay support
|
||||||
// Safari only currently
|
// Safari only currently
|
||||||
airplay: (function() {
|
airplay: is.function(window.WebKitPlaybackTargetAvailabilityEvent),
|
||||||
return is.function(window.WebKitPlaybackTargetAvailabilityEvent);
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// Inline playback support
|
// Inline playback support
|
||||||
// https://webkit.org/blog/6784/new-video-policies-for-ios/
|
// https://webkit.org/blog/6784/new-video-policies-for-ios/
|
||||||
inline: (function() {
|
inline: 'playsInline' in document.createElement('video'),
|
||||||
return 'playsInline' in document.createElement('video');
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// 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
|
||||||
@ -1031,9 +1022,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Check for textTracks support
|
// Check for textTracks support
|
||||||
textTracks: (function() {
|
textTracks: 'textTracks' in document.createElement('video'),
|
||||||
return 'textTracks' in document.createElement('video');
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// Check for passive event listener support
|
// Check for passive event listener support
|
||||||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
||||||
@ -1051,7 +1040,11 @@
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
return supported;
|
return supported;
|
||||||
})()
|
})(),
|
||||||
|
|
||||||
|
// Touch
|
||||||
|
// Remember a device can be moust + touch enabled
|
||||||
|
touch: 'ontouchstart' in document.documentElement
|
||||||
};
|
};
|
||||||
|
|
||||||
// Player instance
|
// Player instance
|
||||||
@ -2332,7 +2325,7 @@
|
|||||||
utils.toggleClass(player.elements.container, config.classes.isIos, player.browser.isIos);
|
utils.toggleClass(player.elements.container, config.classes.isIos, player.browser.isIos);
|
||||||
|
|
||||||
// Add touch class
|
// Add touch class
|
||||||
utils.toggleClass(player.elements.container, config.classes.isTouch, player.browser.isTouch);
|
utils.toggleClass(player.elements.container, config.classes.isTouch, support.touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inject the player wrapper
|
// Inject the player wrapper
|
||||||
@ -3664,7 +3657,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delay for hiding on touch
|
// Delay for hiding on touch
|
||||||
if (player.browser.isTouch) {
|
if (support.touch) {
|
||||||
delay = 3000;
|
delay = 3000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4323,7 +4316,7 @@
|
|||||||
// On click play, pause ore restart
|
// On click play, pause ore restart
|
||||||
utils.on(wrapper, 'click', function() {
|
utils.on(wrapper, 'click', function() {
|
||||||
// Touch devices will just show controls (if we're hiding controls)
|
// Touch devices will just show controls (if we're hiding controls)
|
||||||
if (config.hideControls && player.browser.isTouch && !player.elements.media.paused) {
|
if (config.hideControls && support.touch && !player.elements.media.paused) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4666,11 +4659,6 @@
|
|||||||
|
|
||||||
// Everything done
|
// Everything done
|
||||||
function ready() {
|
function ready() {
|
||||||
// Ready event at end of execution stack
|
|
||||||
window.setTimeout(function() {
|
|
||||||
trigger(player.elements.media, 'ready');
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
// Set class hook on media element
|
// Set class hook on media element
|
||||||
utils.toggleClass(player.elements.media, defaults.classes.setup, true);
|
utils.toggleClass(player.elements.media, defaults.classes.setup, true);
|
||||||
|
|
||||||
@ -4680,6 +4668,11 @@
|
|||||||
// Store a refernce to instance
|
// Store a refernce to instance
|
||||||
player.elements.media.plyr = api;
|
player.elements.media.plyr = api;
|
||||||
|
|
||||||
|
// Ready event at end of execution stack
|
||||||
|
window.setTimeout(function() {
|
||||||
|
trigger(player.elements.media, 'ready');
|
||||||
|
}, 0);
|
||||||
|
|
||||||
// Autoplay
|
// Autoplay
|
||||||
if (config.autoplay) {
|
if (config.autoplay) {
|
||||||
play();
|
play();
|
||||||
@ -4878,7 +4871,7 @@
|
|||||||
var events = config.events.concat(['setup', 'statechange', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled']);
|
var events = config.events.concat(['setup', 'statechange', 'enterfullscreen', 'exitfullscreen', 'captionsenabled', 'captionsdisabled']);
|
||||||
|
|
||||||
utils.on(instance.getContainer(), events.join(' '), function(event) {
|
utils.on(instance.getContainer(), events.join(' '), function(event) {
|
||||||
console.log([config.logPrefix, 'event:', event.type].join(' '), event.detail.plyr);
|
window.console.log([config.logPrefix, 'event:', event.type].join(' ').trim());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user