From a2a82a96a6ab51ed42597dbb9479c4fedeaad927 Mon Sep 17 00:00:00 2001 From: Mohamed Elbahja Date: Sat, 13 Oct 2018 12:59:59 +0100 Subject: [PATCH 1/2] fix: continue with the current duration after changing video quality --- src/js/plyr.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js/plyr.js b/src/js/plyr.js index 77582dd7..2b296181 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -680,6 +680,8 @@ class Plyr { set quality(input) { const config = this.config.quality; const options = this.options.quality; + const duration = this.duration; + const isPlaying = this.playing; if (!options.length) { return; @@ -703,6 +705,14 @@ class Plyr { // Set quality this.media.quality = quality; + + // seek to duration before changing quality + this.seek = duration; + + // continue + if (isPlaying) { + this.play(); + } } /** From 06db3f702d21ec440d53451ce8cb115f036ddec4 Mon Sep 17 00:00:00 2001 From: Mohamed Elbahja <8259014+melbahja@users.noreply.github.com> Date: Sat, 13 Oct 2018 13:23:42 +0100 Subject: [PATCH 2/2] Update plyr.js --- src/js/plyr.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/js/plyr.js b/src/js/plyr.js index 2b296181..5a9a1bd3 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -680,8 +680,7 @@ class Plyr { set quality(input) { const config = this.config.quality; const options = this.options.quality; - const duration = this.duration; - const isPlaying = this.playing; + const { duration, playing } = this; if (!options.length) { return; @@ -706,11 +705,11 @@ class Plyr { // Set quality this.media.quality = quality; - // seek to duration before changing quality + // Seek to duration before changing quality this.seek = duration; - // continue - if (isPlaying) { + // Continue + if (playing) { this.play(); } }