mirror of
https://github.com/p-stream/p-stream.git
synced 2026-01-11 20:10:32 +00:00
Add reset functionality to VideoTesterView on mount
This commit is contained in:
parent
a2446cf931
commit
50216a10d9
1 changed files with 9 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ const streamTypes: Record<StreamType, string> = {
|
|||
};
|
||||
|
||||
export default function VideoTesterView() {
|
||||
const { status, playMedia, setMeta } = usePlayer();
|
||||
const { status, playMedia, setMeta, reset } = usePlayer();
|
||||
const [selected, setSelected] = useState("mp4");
|
||||
const [inputSource, setInputSource] = useState("");
|
||||
const [extensionState, setExtensionState] =
|
||||
|
|
@ -236,6 +236,14 @@ export default function VideoTesterView() {
|
|||
}
|
||||
}, [playMedia, setMeta, extensionState]);
|
||||
|
||||
// player meta and streams cary over, so reset on mount
|
||||
useEffect(() => {
|
||||
if (status !== playerStatus.IDLE) {
|
||||
reset();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PlayerPart backUrl="/dev">
|
||||
{status === playerStatus.IDLE ? (
|
||||
|
|
|
|||
Loading…
Reference in a new issue