Merge pull request #1935 from SBGSports/Cancel-network-requests-once-player-is-destroyed

Network requests are not cancelled after the player is destroyed
This commit is contained in:
Sam Potts 2020-08-30 15:44:55 +10:00 committed by GitHub
commit 8b0d84a9a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ import { getProviderByUrl, providers, types } from './config/types';
import Console from './console'; import Console from './console';
import controls from './controls'; import controls from './controls';
import Fullscreen from './fullscreen'; import Fullscreen from './fullscreen';
import html5 from './html5';
import Listeners from './listeners'; import Listeners from './listeners';
import media from './media'; import media from './media';
import Ads from './plugins/ads'; import Ads from './plugins/ads';
@ -1054,7 +1055,12 @@ class Plyr {
const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force);
// Close menu // Close menu
if (hiding && is.array(this.config.controls) && this.config.controls.includes('settings') && !is.empty(this.config.settings)) { if (
hiding &&
is.array(this.config.controls) &&
this.config.controls.includes('settings') &&
!is.empty(this.config.settings)
) {
controls.toggleMenu.call(this, false); controls.toggleMenu.call(this, false);
} }
@ -1140,6 +1146,9 @@ class Plyr {
// Unbind listeners // Unbind listeners
unbindListeners.call(this); unbindListeners.call(this);
// Cancel current network requests
html5.cancelRequests.call(this);
// Replace the container with the original element provided // Replace the container with the original element provided
replaceElement(this.elements.original, this.elements.container); replaceElement(this.elements.original, this.elements.container);