From 7d040066c475807907668be8edbb78999d2a9da6 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Wed, 28 Apr 2021 00:51:24 -0400 Subject: [PATCH] 4.21.3 * Fixed: When built-in volume control is being replaced with gain control, automatically unmute the player when adjusting the gain control. * Fixed: Issue with the webpack compatibility module not correctly flagging modules as available. --- package.json | 2 +- src/sites/shared/player.jsx | 27 +++++++++++++++++++++++---- src/utilities/compat/webmunch.js | 21 ++++++++++++++++++--- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7f95299e..8aae5659 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.21.2", + "version": "4.21.3", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/sites/shared/player.jsx b/src/sites/shared/player.jsx index c61e1980..07ef2736 100644 --- a/src/sites/shared/player.jsx +++ b/src/sites/shared/player.jsx @@ -875,6 +875,7 @@ export default class PlayerBase extends Module { cls.prototype.ffzScrollHandler = function(event) { const vol_scroll = t.settings.get('player.volume-scroll'), gain_scroll = t.settings.get('player.gain.scroll'), + no_vol = t.settings.get('player.gain.no-volume'), matches_gain = gain_scroll && matchesEvent(gain_scroll, event, this.ffz_rmb), matches_vol = vol_scroll && matchesEvent(vol_scroll, event, this.ffz_rmb); @@ -915,9 +916,15 @@ export default class PlayerBase extends Module { value = max; video._ffz_gain_value = value; + + if ( no_vol && value !== 0 ) { + player.setMuted(false); + localStorage.setItem('video-muted', JSON.stringify({default: false})); + } + t.updateGain(this); - } else if ( matches_vol && ! (video._ffz_compressed && t.settings.get('player.gain.no-volume')) ) { + } else if ( matches_vol && ! (video._ffz_compressed && no_vol) ) { const old_volume = video?.volume ?? player.getVolume(), volume = Math.max(0, Math.min(1, old_volume + (delta > 0 ? amount : -amount))); @@ -1135,7 +1142,7 @@ export default class PlayerBase extends Module { if ( min >= max || max <= min ) gain = null; - let tip, input, extra, fill, cont = container.querySelector('.ffz--player-gain'); + let tip, tipcont, input, extra, fill, cont = container.querySelector('.ffz--player-gain'); if ( ! gain ) { if ( cont ) cont.remove(); @@ -1154,6 +1161,17 @@ export default class PlayerBase extends Module { if ( value > max ) value = max; + if ( value == video._ffz_gain_value ) + return; + + const player = inst.props.mediaPlayerInstance, + core = player.core || player; + + if ( value > 0 && this.settings.get('player.gain.no-volume') && core?.isMuted?.() ) { + core.setMuted(false); + localStorage.setItem('video-muted', JSON.stringify({default: false})); + } + video._ffz_gain_value = value; gain.gain.value = value; @@ -1187,12 +1205,12 @@ export default class PlayerBase extends Module { -