1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-23 15:07:43 +01:00
smov/src/components/video/controls/SourceControl.tsx
2023-01-10 19:53:55 +01:00

21 lines
472 B
TypeScript

import { useContext, useEffect } from "react";
import { VideoPlayerDispatchContext } from "../VideoContext";
interface SourceControlProps {
source: string;
type: "m3u8" | "mp4";
}
export function SourceControl(props: SourceControlProps) {
const dispatch = useContext(VideoPlayerDispatchContext);
useEffect(() => {
dispatch({
type: "SET_SOURCE",
url: props.source,
sourceType: props.type,
});
}, [props, dispatch]);
return null;
}