diff --git a/packages/react/src/components/layout/Frame.tsx b/packages/react/src/components/layout/Frame.tsx index 9681d82fe..3640691ec 100644 --- a/packages/react/src/components/layout/Frame.tsx +++ b/packages/react/src/components/layout/Frame.tsx @@ -32,7 +32,11 @@ import { ErrorBoundary } from "react-error-boundary"; import { Loading } from "../common/Loading"; import ReactPlayer from "react-player"; import { MiniPlayer } from "../player/MiniPlayer"; -import { currentVideoAtom, miniPlayerAtom } from "@/store/player"; +import { + currentVideoAtom, + miniPlayerAtom, + playerRefAtom, +} from "@/store/player"; export const VideoPortalContext = createContext( createHtmlPortalNode(), @@ -94,6 +98,7 @@ export function Frame() { } const VideoPortalContainer = React.memo(() => { + const setPlayerRef = useSetAtom(playerRefAtom); const portalNode = useContext(VideoPortalContext); const currentVideo = useAtomValue(currentVideoAtom); @@ -104,6 +109,7 @@ const VideoPortalContainer = React.memo(() => { return ( +
playerRef?.seekTo(video_offset, "seconds")} + > - + e.stopPropagation()}>
{ url?: string; } +export const playerRefAtom = atom(null); + export const currentVideoAtom = atomWithStorage( "currentvideo", null,