react-video-recorder
react-video-recorder copied to clipboard
Preload video
This isnt a bug. i just need help. I know its probably a basic question but i need guidance on how i can pass a url (or a video blob) to the video component. I am able to save video to my server but do not know how to play back the video on the component. I know about this props useVideoInput which presents a button through which you can load a video but this doesnt solve my problem. I need to be able to auto load a video when the component loads and not via some action triggered by the user.
Hello ! Same question here, did you find a answer @mbaochaEHA ?
I would be interested as well!
Hi there! If anyone else is wondering how to achieve this, I found a hacky workaround that might get you by. Basically you call the handler that loads the video from an input with a fake event.
const videoRecorderRef = useRef(null);
<ReactVideoRecorder ref={videoRecorderRef} ...otherProps />
//...
const loadVideo = (aVideo) => {
if(videoRecorderRef.current) {
const fakeVideoSelectedEvent = { target: { files: [ aVideo ] } };
videoRef.current.handleVideoSelected(fakeVideoSelectedEvent);
}
}
//...
loadVideo(someBlob)
It's not great, but it does the trick...