如何让 iOS 拥有 2 个视频流?

发布于 2025-01-18 02:53:20 字数 757 浏览 5 评论 0原文

现在,如果我使用iPhone或iPad并尝试显示两个流,一个是黑色,另一个是作品。我该怎么做才能使两者都起作用?这在我的笔记本电脑上都可以在所有浏览器上工作。

<script>
 navigator.mediaDevices.getUserMedia({ audio: true, video: true})
      .then(function(camera) { document.getElementById("video1").srcObject = camera;})
      .catch(function(error) { console.error("ERROR", error) });

 navigator.mediaDevices.getUserMedia({audio: true, video: { width: 400, height: 200}})
      .then(function(remote_camera) { document.getElementById("video2").srcObject =  remote_camera;})
      .catch(function(error) { console.error("ERROR", error) });

</script>

<video id="video1" controls autoplay playsinline></video>
<video id="video2" controls autoplay playsinline></video>

Right now if I use my iPhone or iPad and try to display two streams, one is black and the other works. What can I do to get both working? This works fine on all browsers with my laptop.

<script>
 navigator.mediaDevices.getUserMedia({ audio: true, video: true})
      .then(function(camera) { document.getElementById("video1").srcObject = camera;})
      .catch(function(error) { console.error("ERROR", error) });

 navigator.mediaDevices.getUserMedia({audio: true, video: { width: 400, height: 200}})
      .then(function(remote_camera) { document.getElementById("video2").srcObject =  remote_camera;})
      .catch(function(error) { console.error("ERROR", error) });

</script>

<video id="video1" controls autoplay playsinline></video>
<video id="video2" controls autoplay playsinline></video>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隐诗 2025-01-25 02:53:20

iOS 上的 Safari 一次不支持多个活动相机。

https://bugs.webkit.org/show_bug.cgi?id=238492 是关于它的最新错误报告,但这种行为早在 2018 年就已经记录在案:https://webrtchacks.com/guide-to-safari-webrtc/

Safari on iOS does not support more than a single active camera at a time.

https://bugs.webkit.org/show_bug.cgi?id=238492 is the most recent bug report about it but this behavior has been documented back in 2018 already: https://webrtchacks.com/guide-to-safari-webrtc/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文