This commit is contained in:
botsy 2025-11-04 17:11:16 +02:00 committed by GitHub
commit 75e90bdf6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,6 +46,7 @@ const Player = ({ urlParams, queryParams }) => {
const platform = usePlatform(); const platform = usePlatform();
const toast = useToast(); const toast = useToast();
const lastVolumeRef = React.useRef(video.state?.volume || 0);
const [seeking, setSeeking] = React.useState(false); const [seeking, setSeeking] = React.useState(false);
const [casting, setCasting] = React.useState(() => { const [casting, setCasting] = React.useState(() => {
@ -535,6 +536,12 @@ const Player = ({ urlParams, queryParams }) => {
} }
}, [settings.pauseOnMinimize, shell.windowClosed, shell.windowHidden]); }, [settings.pauseOnMinimize, shell.windowClosed, shell.windowHidden]);
React.useEffect(() => {
if (video?.state?.volume) {
lastVolumeRef.current = video.state.volume;
}
}, [video.state.volume]);
// Media Session PlaybackState // Media Session PlaybackState
React.useEffect(() => { React.useEffect(() => {
if (!navigator.mediaSession) return; if (!navigator.mediaSession) return;
@ -678,6 +685,17 @@ const Player = ({ urlParams, queryParams }) => {
onIncreaseSubtitlesDelay(); onIncreaseSubtitlesDelay();
break; break;
} }
case 'KeyM': {
if (!menusOpen && !nextVideoPopupOpen && video.state.volume !== null) {
if (video.state.volume) {
onVolumeChangeRequested(0);
} else {
onVolumeChangeRequested(lastVolumeRef.current);
}
}
break;
}
case 'Minus': { case 'Minus': {
onUpdateSubtitlesSize(-1); onUpdateSubtitlesSize(-1);
break; break;