From 43879e08f44a5bb902b4dc0f8ccd1d3d6283b47d Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Tue, 19 Jun 2018 16:25:37 +0200 Subject: Make (increase/decrease)Volume methods ignore invalid input instead of raising / lowering to the min / max --- src/js/plyr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/js/plyr.js') diff --git a/src/js/plyr.js b/src/js/plyr.js index c2bb6a4d..9e00e836 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -553,7 +553,7 @@ class Plyr { */ increaseVolume(step) { const volume = this.media.muted ? 0 : this.volume; - this.volume = volume + (is.number(step) ? step : 1); + this.volume = volume + (is.number(step) ? step : 0); } /** @@ -562,7 +562,7 @@ class Plyr { */ decreaseVolume(step) { const volume = this.media.muted ? 0 : this.volume; - this.volume = volume - (is.number(step) ? step : 1); + this.volume = volume - (is.number(step) ? step : 0); } /** -- cgit v1.2.3 From 39c7bd40c205700e7b1df677b8aaacc6cb8100db Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Tue, 19 Jun 2018 16:29:52 +0200 Subject: Make decreaseVolume wrap increaseVolume for code reuse --- src/js/plyr.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/js/plyr.js') diff --git a/src/js/plyr.js b/src/js/plyr.js index 9e00e836..374251e6 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -561,8 +561,7 @@ class Plyr { * @param {boolean} step - How much to decrease by (between 0 and 1) */ decreaseVolume(step) { - const volume = this.media.muted ? 0 : this.volume; - this.volume = volume - (is.number(step) ? step : 0); + this.increaseVolume(-step); } /** -- cgit v1.2.3