Fixed errors when Plyr instance is destroyed before constructor setTimeout() functions execute. (#2108)

Co-authored-by: Emilis Dambauskas <emilis.dambauskas@mps.fi>
This commit is contained in:
Emilis (Idea IT) 2021-08-24 15:24:50 +03:00 committed by Sam Potts
parent d41a90f0dd
commit f016a367b5
2 changed files with 6 additions and 2 deletions

View File

@ -154,7 +154,9 @@ const captions = {
}
// Enable or disable captions based on track length
toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is.empty(tracks));
if (this.elements) {
toggleClass(this.elements.container, this.config.classNames.captions.enabled, !is.empty(tracks));
}
// Update available languages in list
if (

View File

@ -675,7 +675,9 @@ class Plyr {
// Set media speed
setTimeout(() => {
this.media.playbackRate = speed;
if (this.media) {
this.media.playbackRate = speed;
}
}, 0);
}