39948-vm/frontend/src/hooks/useGlobalAudioMute.ts
Dmitri 6413c7bdf0 implemented:
- three destinations for info panel thumbnails : the panel image preview, new page, external page (URL). Two destinations for other elements (other page, external URL)
- toggle for info panel media opening (fullscreen or in the panel)
- ability to replace background with info panel media (image, video, 360 panorama)
- ability to make 360 panorama as page background
- global mute button
-
2026-06-15 07:50:45 +02:00

28 lines
717 B
TypeScript

import { useCallback, useSyncExternalStore } from 'react';
import { backgroundAudioController } from '../lib/backgroundAudioController';
export function useGlobalAudioMute() {
const subscribe = useCallback(
(listener: () => void) => backgroundAudioController.subscribe(listener),
[],
);
const isMuted = useSyncExternalStore(
subscribe,
() => backgroundAudioController.isMuted(),
() => true,
);
const setMuted = useCallback((muted: boolean) => {
backgroundAudioController.setMuted(muted);
}, []);
const toggleMuted = useCallback(() => {
backgroundAudioController.toggleMuted();
}, []);
return { isMuted, setMuted, toggleMuted };
}
export default useGlobalAudioMute;