Fix for Slow loading videos not autoplaying

This commit is contained in:
Danielh112 2020-08-14 10:29:46 +01:00
parent 423b7b276f
commit 4eaa1a72b5

View File

@ -308,7 +308,7 @@ class Plyr {
// Autoplay if required // Autoplay if required
if (this.isHTML5 && this.config.autoplay) { if (this.isHTML5 && this.config.autoplay) {
setTimeout(() => silencePromise(this.play()), 10); this.on('canplay', () => silencePromise(this.play()));
} }
// Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek // Seek time will be recorded (in listeners.js) so we can prevent hiding controls for a few seconds after seek
@ -1054,7 +1054,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);
} }