aboutsummaryrefslogtreecommitdiffstats
path: root/dist/plyr.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/plyr.js')
-rw-r--r--dist/plyr.js53
1 files changed, 36 insertions, 17 deletions
diff --git a/dist/plyr.js b/dist/plyr.js
index 25754727..d2071524 100644
--- a/dist/plyr.js
+++ b/dist/plyr.js
@@ -3883,7 +3883,9 @@ var Listeners = function () {
}, {
key: 'global',
- value: function global(toggle) {
+ value: function global() {
+ var toggle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+
// Keyboard shortcuts
if (this.player.config.keyboard.global) {
utils.toggleListener(window, 'keydown keyup', this.handleKey, toggle, false);
@@ -4294,6 +4296,14 @@ var Listeners = function () {
});
}, false);
}
+
+ // Reset on destroy
+
+ }, {
+ key: 'clear',
+ value: function clear() {
+ this.global(false);
+ }
}]);
return Listeners;
}();
@@ -4565,7 +4575,7 @@ var Ads = function () {
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!start) {
- window.clearInterval(this.countdownTimer);
+ clearInterval(this.countdownTimer);
this.elements.container.removeAttribute('data-badge-text');
return;
}
@@ -4576,7 +4586,7 @@ var Ads = function () {
_this5.elements.container.setAttribute('data-badge-text', label);
};
- this.countdownTimer = window.setInterval(update, 100);
+ this.countdownTimer = setInterval(update, 100);
}
/**
@@ -5351,10 +5361,10 @@ var youtube = {
utils.dispatchEvent.call(player, player.media, 'durationchange');
// Reset timer
- window.clearInterval(player.timers.buffering);
+ clearInterval(player.timers.buffering);
// Setup buffering
- player.timers.buffering = window.setInterval(function () {
+ player.timers.buffering = setInterval(function () {
// Get loaded % from YouTube
player.media.buffered = instance.getVideoLoadedFraction();
@@ -5368,7 +5378,7 @@ var youtube = {
// Bail if we're at 100%
if (player.media.buffered === 1) {
- window.clearInterval(player.timers.buffering);
+ clearInterval(player.timers.buffering);
// Trigger event
utils.dispatchEvent.call(player, player.media, 'canplaythrough');
@@ -5385,7 +5395,7 @@ var youtube = {
var instance = event.target;
// Reset timer
- window.clearInterval(player.timers.playing);
+ clearInterval(player.timers.playing);
// Handle events
// -1 Unstarted
@@ -5425,7 +5435,7 @@ var youtube = {
utils.dispatchEvent.call(player, player.media, 'playing');
// Poll to get playback progress
- player.timers.playing = window.setInterval(function () {
+ player.timers.playing = setInterval(function () {
utils.dispatchEvent.call(player, player.media, 'timeupdate');
}, 50);
@@ -6287,7 +6297,7 @@ var Plyr = function () {
this.listeners.container();
// Global listeners
- this.listeners.global(true);
+ this.listeners.global();
// Setup fullscreen
this.fullscreen = new Fullscreen(this);
@@ -6547,7 +6557,7 @@ var Plyr = function () {
}
// Clear timer on every call
- window.clearTimeout(this.timers.controls);
+ clearTimeout(this.timers.controls);
// If the mouse is not over the controls, set a timeout to hide them
if (show || this.paused || this.loading) {
@@ -6666,12 +6676,12 @@ var Plyr = function () {
callback();
}
} else {
+ // Unbind listeners
+ _this4.listeners.clear();
+
// Replace the container with the original element provided
utils.replaceElement(_this4.elements.original, _this4.elements.container);
- // Unbind global listeners
- _this4.listeners.global(false);
-
// Event
utils.dispatchEvent.call(_this4, _this4.elements.original, 'destroyed', true);
@@ -6680,15 +6690,24 @@ var Plyr = function () {
callback.call(_this4.elements.original);
}
- // Clear for GC
- _this4.elements = null;
+ // Clear for garbage collection
+ setTimeout(function () {
+ _this4.elements = null;
+ _this4.media = null;
+ }, 200);
}
};
+ // Stop playback
+ this.stop();
+
// Type specific stuff
switch (this.provider + ':' + this.type) {
case 'html5:video':
case 'html5:audio':
+ // Clear timeout
+ clearTimeout(this.timers.loading);
+
// Restore native video controls
ui.toggleNativeControls.call(this, true);
@@ -6699,8 +6718,8 @@ var Plyr = function () {
case 'youtube:video':
// Clear timers
- window.clearInterval(this.timers.buffering);
- window.clearInterval(this.timers.playing);
+ clearInterval(this.timers.buffering);
+ clearInterval(this.timers.playing);
// Destroy YouTube API
if (this.embed !== null) {