sheshank sharma
sheshank sharma

Reputation: 3

capture MediaStream in reactjs (video component)

I want to capture a local video, MediaStream object from a react video component and pass it into WebRTC. captureStream() method is not present in React may be, can someone share me the code of this???

when i try to run captureStream() in react it shows me error that (captureStream is not present in reactjs)

Upvotes: 0

Views: 3278

Answers (1)

Minal
Minal

Reputation: 183

 <video ref={videoElementRef} muted id="video-element-ids" className="video" /> 

const url = URL.createObjectURL(file);
 this.videoElementRef.current.src = url;
 await this.videoElementRef.current.play();
 const mediaSream = this.videoElementRef.current.captureStream();

Upvotes: 1

Related Questions