Refac jump to an empty player wrapper when opening the EmbeddableVideoPlayer

This commit is contained in:
MerlinScheurer 2025-01-28 17:41:01 +01:00
parent baf0c568a8
commit fe4ee6a2d7
1 changed files with 6 additions and 2 deletions

View File

@ -28,7 +28,7 @@ const EmbeddableVideoPlayer = ({ videoId }: EmbeddableVideoPlayerProps) => {
const [, setSearchParams] = useSearchParams();
const [refresh, setRefresh] = useState(false);
const [refresh, setRefresh] = useState(true);
const [loading, setLoading] = useState(false);
const [videoResponse, setVideoResponse] = useState<VideoResponseType>();
@ -72,8 +72,12 @@ const EmbeddableVideoPlayer = ({ videoId }: EmbeddableVideoPlayerProps) => {
})();
}, [videoId, refresh]);
useEffect(() => {
inlinePlayerRef.current?.scrollIntoView();
}, []);
if (videoResponse === undefined) {
return [];
return <div ref={inlinePlayerRef} className="player-wrapper" />;
}
const video = videoResponse.data;