From 226e0a6aa99c38e56e3351702914a1f42cf468fe Mon Sep 17 00:00:00 2001 From: Zibbp Date: Sun, 18 Feb 2024 17:21:05 +0000 Subject: [PATCH] fix(vod): set correct isFullscreen value when entering/leaving theater mode --- src/components/Vod/VideoPlayer.tsx | 12 ------------ src/pages/vods/[vodId].tsx | 6 +----- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/components/Vod/VideoPlayer.tsx b/src/components/Vod/VideoPlayer.tsx index 5e65359..15706c4 100644 --- a/src/components/Vod/VideoPlayer.tsx +++ b/src/components/Vod/VideoPlayer.tsx @@ -1,6 +1,5 @@ import getConfig from "next/config"; import React, { useEffect, useRef, useState } from "react"; -import { ActionIcon } from "@mantine/core"; import vodDataBus from "./EventBus"; import { useApi } from "../../hooks/useApi"; import useUserStore from "../../store/user"; @@ -11,23 +10,12 @@ import '@vidstack/react/player/styles/default/layouts/video.css'; import { MediaPlayer, MediaPlayerInstance, MediaProvider, Poster, Track } from '@vidstack/react'; import { defaultLayoutIcons, DefaultVideoLayout } from '@vidstack/react/player/layouts/default'; -import { IconDotsVertical, IconMaximize, IconMinimize } from "@tabler/icons-react"; -import ReactDOM from "react-dom"; import TheaterModeIcon from "./TheaterModeIcon"; import { escapeURL } from "../../util/util"; import { useSearchParams } from 'next/navigation' import { showNotification } from "@mantine/notifications"; import classes from "./VideoPlayer.module.css" import eventBus from "../../util/eventBus"; -// const useStyles = createStyles((theme) => ({ -// playerContainer: { -// "--media-max-height": "87vh" -// }, -// playerMediaOutlet: { -// paddingBottom: "0", -// height: "100%", -// }, -// })); const NewVideoPlayer = ({ vod }: any) => { const { publicRuntimeConfig } = getConfig(); diff --git a/src/pages/vods/[vodId].tsx b/src/pages/vods/[vodId].tsx index 9de6106..477b7aa 100644 --- a/src/pages/vods/[vodId].tsx +++ b/src/pages/vods/[vodId].tsx @@ -55,16 +55,12 @@ const VodPage = (props: any) => { queryFn: () => fetchVod(props.vodId), }); - - - - // Theater mode support useEffect(() => { eventBus.on("theaterMode", (data) => { + setIsFullscreen(data); console.debug(`vodId: toggling theater mode: ${data}`) console.debug(`theaterMode: is mobile: ${isMobile} is fullscreen: ${isFullscreen}`) - setIsFullscreen(!isFullscreen); if (window.innerWidth < 1000) { try { toggle();