aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/controls.js9
-rw-r--r--src/js/plugins/youtube.js5
-rw-r--r--src/js/plyr.js3
3 files changed, 10 insertions, 7 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index 2bc8b4de..e95cfc86 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -1455,12 +1455,9 @@ const controls = {
target = this.elements.container;
}
- // Inject controls HTML
- if (is.element(container)) {
- target.appendChild(container);
- } else if (container) {
- target.insertAdjacentHTML('beforeend', container);
- }
+ // Inject controls HTML (needs to be before captions, hence "afterbegin")
+ const insertMethod = is.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container);
// Find the elements if need be
if (!is.element(this.elements.controls)) {
diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js
index b521be3c..66a73acf 100644
--- a/src/js/plugins/youtube.js
+++ b/src/js/plugins/youtube.js
@@ -188,6 +188,7 @@ const youtube = {
videoId,
playerVars: {
autoplay: player.config.autoplay ? 1 : 0, // Autoplay
+ hl: player.config.hl, // iframe interface language
controls: player.supported.ui ? 0 : 1, // Only show controls if not fully supported
rel: 0, // No related vids
showinfo: 0, // Hide info
@@ -239,6 +240,10 @@ const youtube = {
triggerEvent.call(player, player.media, 'ratechange');
},
onReady(event) {
+ // Bail if onReady has already been called. See issue #1108
+ if (is.function(player.media.play)) {
+ return;
+ }
// Get the instance
const instance = event.target;
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 0f27b750..6d321112 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -171,7 +171,7 @@ class Plyr {
this.elements.container.className = '';
// Get attributes from URL and set config
- if (url.searchParams.length) {
+ if (url.search.length) {
const truthy = ['1', 'true'];
if (truthy.includes(url.searchParams.get('autoplay'))) {
@@ -185,6 +185,7 @@ class Plyr {
// YouTube requires the playsinline in the URL
if (this.isYouTube) {
this.config.playsinline = truthy.includes(url.searchParams.get('playsinline'));
+ this.config.hl = url.searchParams.get('hl');
} else {
this.config.playsinline = true;
}