本文介绍了在 reactjs(视频组件)中捕获 MediaStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从 react 视频组件捕获本地视频 MediaStream 对象并将其传递到 WebRTC.captureStream() 方法可能在 React 中不存在,有人可以分享我的代码吗???
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???
当我尝试在 react 中运行 captureStream() 时,它向我显示错误(reactjs 中不存在captureStream)
when i try to run captureStream() in react it shows me error that (captureStream is not present in reactjs)
推荐答案
<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();
这篇关于在 reactjs(视频组件)中捕获 MediaStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!