first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import {useCallback, useRef} from 'react';
import {usePlayerActions} from '@common/player/hooks/use-player-actions';
export function usePlayerClickHandler() {
const clickRef = useRef(0);
const player = usePlayerActions();
const togglePlay = useCallback(() => {
if (player.getState().isPlaying) {
player.pause();
} else {
player.play();
}
}, [player]);
return useCallback(() => {
if (!player.getState().providerReady) return;
clickRef.current += 1;
togglePlay();
if (clickRef.current === 1) {
setTimeout(() => {
if (clickRef.current > 1) {
player.toggleFullscreen();
}
clickRef.current = 0;
}, 300);
}
}, [player, togglePlay]);
}