Merge pull request #874 from Stremio/chore/player-when-volume-is-0-set-as-mute
Some checks are pending
Build / build (push) Waiting to run

chore: ControlBar & VolumeChangeIndicator show volume=0 with muted icon
This commit is contained in:
Timothy Z. 2025-03-24 10:32:33 +02:00 committed by GitHub
commit 970538b087
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View file

@ -131,9 +131,10 @@ const ControlBar = ({
name={ name={
(typeof muted === 'boolean' && muted) ? 'volume-mute' : (typeof muted === 'boolean' && muted) ? 'volume-mute' :
(volume === null || isNaN(volume)) ? 'volume-off' : (volume === null || isNaN(volume)) ? 'volume-off' :
volume < 30 ? 'volume-low' : volume === 0 ? 'volume-mute' :
volume < 70 ? 'volume-medium' : volume < 30 ? 'volume-low' :
'volume-high' volume < 70 ? 'volume-medium' :
'volume-high'
} }
/> />
</Button> </Button>

View file

@ -14,11 +14,12 @@ const VolumeChangeIndicator = React.memo(({ muted, volume }) => {
const prevVolume = React.useRef(volume); const prevVolume = React.useRef(volume);
const iconName = React.useMemo(() => { const iconName = React.useMemo(() => {
return typeof muted === 'boolean' && muted ? 'volume-mute' : return (typeof muted === 'boolean' && muted) ? 'volume-mute' :
volume === null || isNaN(volume) ? 'volume-off' : volume === null || isNaN(volume) ? 'volume-off' :
volume < 30 ? 'volume-low' : volume === 0 ? 'volume-mute' :
volume < 70 ? 'volume-medium' : volume < 30 ? 'volume-low' :
'volume-high'; volume < 70 ? 'volume-medium' :
'volume-high';
}, [muted, volume]); }, [muted, volume]);
React.useEffect(() => { React.useEffect(() => {