react-video-recorder icon indicating copy to clipboard operation
react-video-recorder copied to clipboard

Preload video

Open mbaochaEHA opened this issue 4 years ago • 3 comments

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.

mbaochaEHA avatar Jul 06 '20 16:07 mbaochaEHA

Hello ! Same question here, did you find a answer @mbaochaEHA ?

jmazier-j2d avatar Apr 15 '21 14:04 jmazier-j2d

I would be interested as well!

sebastianrueckerai avatar May 18 '21 16:05 sebastianrueckerai

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...

juanmjacobs avatar Jun 14 '22 00:06 juanmjacobs