我有一个简单的脚本,可以在webRTC文档中找到,我试过运行它,但是似乎我缺少了一些东西
const leftVideo = document.getElementById('leftVideo');
const rightVideo = document.getElementById('rightVideo');
leftVideo.addEventListener('canplay', () => {
const stream = leftVideo.captureStream();
rightVideo.srcObject = stream;
});
我检查流捕获时收到此错误 未捕获的DOMException:无法在'HTMLMediaElement'上执行'captureStream':无法从具有跨域数据的元素捕获 在HTMLVideoElement.leftVideo.addEventListener处 这是我的index.html
<video id="leftVideo" playsinline controls loop muted>
<source src="test1.webm" type="video/webm"/>
<p>This browser does not support the video element.</p>
</video>
<video id="rightVideo" playsinline autoplay></video>
答案 0 :(得分:1)
thread1 = new Thread(DoWork);
您要确保链接使用的是https
参考: https://stackoverflow.com/a/35245146/8689969
<video crossOrigin="anonymous" src="https://cdn.myapp.com:81/video.mp4"></video>