|
|
|
|
@ -16,7 +16,7 @@ const supportsFullscreen = (video: HTMLVideoElement | null): video is IOSVideo = |
|
|
|
|
&& 'webkitExitFullscreen' in video, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
export const useFullscreen = () => { |
|
|
|
|
export const useFullscreen = (activePlayer: React.RefObject<HTMLVideoElement>) => { |
|
|
|
|
const wrapperRef = useRef<HTMLDivElement>(null) |
|
|
|
|
const { |
|
|
|
|
isOpen: isFullscreen, |
|
|
|
|
@ -43,12 +43,8 @@ export const useFullscreen = () => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const getPlayingVideoElement = () => ( |
|
|
|
|
wrapperRef.current?.querySelector('video') as HTMLVideoElement | null |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const toggleIOSFullscreen = () => { |
|
|
|
|
const video = getPlayingVideoElement() |
|
|
|
|
const video = activePlayer?.current |
|
|
|
|
if (!video || !supportsFullscreen(video)) return |
|
|
|
|
|
|
|
|
|
if (isFullscreen) { |
|
|
|
|
|