mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-23 15:07:43 +01:00
19 lines
425 B
TypeScript
19 lines
425 B
TypeScript
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;
|
|
}
|