aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 8722b62f..3d78c58c 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -1,13 +1,13 @@
// ==========================================================================
// Plyr
-// plyr.js v1.5.17
+// plyr.js v1.5.21
// https://github.com/selz/plyr
// License: The MIT License (MIT)
// ==========================================================================
// Credits: http://paypal.github.io/accessible-html5-video-player/
// ==========================================================================
-(function(root, factory) {
+;(function(root, factory) {
'use strict';
/*global define,module*/
@@ -1242,7 +1242,7 @@
// Toggle style hook
function _toggleStyleHook() {
- _toggleClass(plyr.container, defaults.selectors.container.replace('.', ''), plyr.supported.full);
+ _toggleClass(plyr.container, config.selectors.container.replace('.', ''), plyr.supported.full);
}
// Toggle native controls
@@ -1319,12 +1319,6 @@
// Clean up
plyr.embedId = null;
}
- else {
- // Autoplay
- if (config.autoplay) {
- _play();
- }
- }
}
// Setup YouTube/Vimeo
@@ -1415,14 +1409,14 @@
// When embeds are ready
function _embedReady() {
+ // Store reference to API
+ plyr.container.plyr.embed = plyr.embed;
+
// Setup the UI
_setupInterface();
// Set title
_setTitle(_getElement('iframe'));
-
- // Store reference to API
- plyr.container.plyr.embed = plyr.embed;
}
// Handle YouTube API ready
@@ -1438,7 +1432,7 @@
plyr.embed = new YT.Player(container.id, {
videoId: videoId,
playerVars: {
- autoplay: 0,
+ autoplay: (config.autoplay ? 1 : 0),
controls: (plyr.supported.full ? 0 : 1),
rel: 0,
showinfo: 0,
@@ -1626,12 +1620,12 @@
});
// Always seek to 0
- //plyr.embed.api('seekTo', 0);
+ // plyr.embed.api('seekTo', 0);
- // Prevent autoplay if needed (seek will play)
- //if (!config.autoplay) {
- // plyr.embed.api('pause');
- //}
+ // Autoplay
+ if (config.autoplay) {
+ plyr.embed.api('play');
+ }
});
}
@@ -2277,6 +2271,11 @@
// Inject the new element
_prependChild(plyr.container, plyr.media);
+ // Autoplay the new source?
+ if (typeof source.autoplay !== 'undefined') {
+ config.autoplay = source.autoplay;
+ }
+
// Set attributes for audio video
if (_inArray(config.types.html5, plyr.type)) {
if (config.crossorigin) {
@@ -2301,9 +2300,6 @@
_toggleClass(plyr.container, config.classes.captions.active, plyr.captionsEnabled);
_toggleStyleHook();
- // Autoplay the new source?
- config.autoplay = (source.autoplay || config.autoplay);
-
// Set new sources for html5
if (_inArray(config.types.html5, plyr.type)) {
_insertChildElements('source', source.sources);
@@ -2329,11 +2325,6 @@
_displayDuration();
}
- // Play if autoplay attribute is present
- if (config.autoplay) {
- _play();
- }
-
// Set aria title and iframe title
config.title = source.title;
_setTitle();
@@ -2668,6 +2659,11 @@
// Set title on button and frame
_setTitle();
+
+ // Autoplay
+ if (config.autoplay) {
+ _play();
+ }
}
// Successful setup
@@ -2730,6 +2726,9 @@
// Display duration
_displayDuration();
+
+ // Ready event
+ _triggerEvent(plyr.container, 'ready');
}
// Initialize instance
@@ -2831,7 +2830,7 @@
}
// Create a player instance for each element
- for (var i = elements.length - 1; i >= 0; i--) {
+ for (var i = 0; i < elements.length; i++) {
// Get the current element
var element = elements[i];