1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-22 14:57:40 +01:00
smov/src/components/video/controls/SourceControl.tsx

20 lines
425 B
TypeScript
Raw Normal View History

2023-01-08 13:15:32 +01:00
import { useContext, useEffect } from "react";
import { VideoPlayerDispatchContext } from "../VideoContext";
interface SourceControlProps {
source: string;
}
export function SourceControl(props: SourceControlProps) {
const dispatch = useContext(VideoPlayerDispatchContext);
useEffect(() => {
dispatch({
type: "SET_SOURCE",
url: props.source,
});
}, [props.source, dispatch]);
return null;
}