feat: play downloads

This commit is contained in:
Adrian Castro
2024-03-21 14:14:30 +01:00
parent 13143a2664
commit 21b574ee87
8 changed files with 79 additions and 23 deletions

View File

@@ -56,6 +56,7 @@ export const VideoPlayer = () => {
const stream = usePlayerStore((state) => state.interface.currentStream);
const selectedAudioTrack = useAudioTrackStore((state) => state.selectedTrack);
const videoRef = usePlayerStore((state) => state.videoRef);
const asset = usePlayerStore((state) => state.asset);
const setVideoRef = usePlayerStore((state) => state.setVideoRef);
const setStatus = usePlayerStore((state) => state.setStatus);
const setIsIdle = usePlayerStore((state) => state.setIsIdle);
@@ -167,6 +168,12 @@ export const VideoPlayer = () => {
useEffect(() => {
const initializePlayer = async () => {
if (asset) {
setVideoSrc(asset);
setIsLoading(false);
return;
}
if (!stream) {
await dismissFullscreenPlayer();
return router.back();
@@ -214,6 +221,7 @@ export const VideoPlayer = () => {
void synchronizePlayback();
};
}, [
asset,
dismissFullscreenPlayer,
hasStartedPlaying,
router,