aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2018-03-03 23:06:12 +1100
committerSam Potts <sam@potts.es>2018-03-03 23:06:12 +1100
commit317b08c703c94c5ce0e1d53603f4e1c9842df249 (patch)
tree95cff2aacd5068bc029cde2c89355e1fd9847bdb /src
parentbfb550b8d0be3b4eeb0fc900f26e8c1cb05419fd (diff)
downloadplyr-317b08c703c94c5ce0e1d53603f4e1c9842df249.tar.lz
plyr-317b08c703c94c5ce0e1d53603f4e1c9842df249.tar.xz
plyr-317b08c703c94c5ce0e1d53603f4e1c9842df249.zip
Ready event fix, YouTube play event fix, docs update
Diffstat (limited to 'src')
-rw-r--r--src/js/listeners.js2
-rw-r--r--src/js/plugins/ads.js2
-rw-r--r--src/js/plugins/vimeo.js2
-rw-r--r--src/js/plugins/youtube.js5
-rw-r--r--src/js/plyr.js12
-rw-r--r--src/js/ui.js4
-rw-r--r--src/js/utils.js2
7 files changed, 10 insertions, 19 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js
index 214f6e7d..f7efa7e6 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -202,7 +202,7 @@ const listeners = {
// Delay the adding of classname until the focus has changed
// This event fires before the focusin event
- window.setTimeout(() => {
+ setTimeout(() => {
utils.toggleClass(utils.getFocusElement(), this.config.classNames.tabFocus, true);
}, 0);
});
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js
index 72fd49d8..eee03752 100644
--- a/src/js/plugins/ads.js
+++ b/src/js/plugins/ads.js
@@ -553,7 +553,7 @@ class Ads {
startSafetyTimer(time, from) {
this.player.debug.log(`Safety timer invoked from: ${from}`);
- this.safetyTimer = window.setTimeout(() => {
+ this.safetyTimer = setTimeout(() => {
this.cancel();
this.clearSafetyTimer('startSafetyTimer()');
}, time);
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js
index 4b604337..7b846f04 100644
--- a/src/js/plugins/vimeo.js
+++ b/src/js/plugins/vimeo.js
@@ -311,7 +311,7 @@ const vimeo = {
});
// Rebuild UI
- window.setTimeout(() => ui.build.call(player), 0);
+ setTimeout(() => ui.build.call(player), 0);
},
};
diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js
index d66b98b7..07e12b79 100644
--- a/src/js/plugins/youtube.js
+++ b/src/js/plugins/youtube.js
@@ -194,17 +194,14 @@ const youtube = {
// Create a faux HTML5 API using the YouTube API
player.media.play = () => {
instance.playVideo();
- player.media.paused = false;
};
player.media.pause = () => {
instance.pauseVideo();
- player.media.paused = true;
};
player.media.stop = () => {
instance.stopVideo();
- player.media.paused = true;
};
player.media.duration = instance.getDuration();
@@ -331,7 +328,7 @@ const youtube = {
}, 200);
// Rebuild UI
- window.setTimeout(() => ui.build.call(player), 50);
+ setTimeout(() => ui.build.call(player), 50);
},
onStateChange(event) {
// Get the instance
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 17336f06..50b9458e 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -972,15 +972,7 @@ class Plyr {
// If toggle is false or if we're playing (regardless of toggle),
// then set the timer to hide the controls
if (!show || this.playing) {
- this.timers.controls = window.setTimeout(() => {
- /* this.debug.warn({
- pressed: this.elements.controls.pressed,
- hover: this.elements.controls.pressed,
- playing: this.playing,
- paused: this.paused,
- loading: this.loading,
- }); */
-
+ this.timers.controls = setTimeout(() => {
// If the mouse is over the controls (and not entering fullscreen), bail
if ((this.elements.controls.pressed || this.elements.controls.hover) && !isEnterFullscreen) {
return;
@@ -1111,7 +1103,7 @@ class Plyr {
}
// Vimeo does not always return
- window.setTimeout(done, 200);
+ setTimeout(done, 200);
break;
diff --git a/src/js/ui.js b/src/js/ui.js
index d8d420b0..7e09dea6 100644
--- a/src/js/ui.js
+++ b/src/js/ui.js
@@ -84,7 +84,9 @@ const ui = {
this.ready = true;
// Ready event at end of execution stack
- utils.dispatchEvent.call(this, this.media, 'ready');
+ setTimeout(() => {
+ utils.dispatchEvent.call(this, this.media, 'ready');
+ }, 0);
// Set the title
ui.setTitle.call(this);
diff --git a/src/js/utils.js b/src/js/utils.js
index 3e176d10..5dafee89 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -854,7 +854,7 @@ const utils = {
// Force repaint of element
repaint(element) {
- window.setTimeout(() => {
+ setTimeout(() => {
utils.toggleHidden(element, true);
element.offsetHeight; // eslint-disable-line
utils.toggleHidden(element, false);