如何使用 getUserMedia() api 模拟类似 WebRTC 的行为?

发布于 2025-01-09 06:49:55 字数 915 浏览 1 评论 0原文

我的主要目的是在 2 个用户 A 和 A 之间建立 VoIP 会话。 B;这里,从 A 的浏览器获取的原始音频/视频媒体字节在 B 的浏览器中播放,反之亦然。
原因是,当用户C& D 被添加到此调用中,我们不必创建限制性能的 P2P 网状网络。

尝试使用 getUserMedia() 录制媒体并播放,但它不是实时的。它还给用户带来了糟糕的体验。 (但是,还没有尝试过 200 毫秒的小块视频)

是否有任何方法可以获取媒体的原始字节并在其他浏览器上播放它?目前我有一个服务器,如果需要的话可以连接到两个对等点。
欢迎任何在线示例或库。


已经在这方面提出了 2 个问题,并获得了 100-100 赏金,但没有多大用处:

相关:如何流式传输直播视频在我的浏览器上播放到另一个用户的浏览器?

My primary intention is to setup a VoIP session between 2 users A & B; Here the raw audio / video media bytes are fetched from A's browser are played in B's browser and vice versa.
The reason is that, when the user C & D are added into this call, we need not have to create a P2P mesh network which limits the performance.

Tried recording media with getUserMedia() and playback, but it is not real time. It also gives a bad user experience. (However, haven't experimented yet with videos of small chunks as 200 ms)

Is there any approach where I can get the raw bytes of the media and play it on other browser? Currently I have a server in between which can connect to both peers if required.
Any online examples or libraries are welcome.


Have already asked 2 questions in this regard with 100-100 bounties, but not much of use:

Related: How to stream, live video playing on my browser to browser of another user?

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

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

发布评论

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

评论(2

三生殊途 2025-01-16 06:49:55

如果我很理解你的意思,你正在寻找如何在会话中拥有两个以上的用户,对吧?不使用网状拓扑,

这也是可能的和可配置的,因为某些可能是活动发言者或每个人都是活动发言者不仅接收您选择的任何配置,而且对我来说,您似乎要求进行视频会议
有几种工具可以实现此目的,我推荐的最好的工具是 mediasoup,它是一个 SFU 作为选择性转发单元mediasoup

If i understand you well is you're looking on how to have more than two users on the session right? without using mesh topology

thats possible and configurable as well by means that some maybe active speaker or everyone is active speaker not only receiver whatever configuration you choose but to me it seems that you're asking for video conferencing
there are couple of tools for this the best one i might recommend is mediasoup its a SFU as selective fowarding unit mediasoup

北风几吹夏 2025-01-16 06:49:55

我不知道我是否理解正确,但您不太可能获得原始视频数据并在浏览器上播放它,它只会杀死您的带宽和性能,因为原始数据很大。

您需要使用压缩数据(媒体编解码器,例如H264),并且需要一个协议来发送和接收它。如果您正在寻找亚秒级延迟,那么 webrtc 已经是您的最佳选择。如果中间有服务器,请通过该服务器而不是 Mesh 分发媒体。查看 webrtc 网络拓扑:

https://antmedia.io/webrtc-servers/

I don't know if I understand correctly, but it is not likely that you will get raw video data and play it on the browser, it will just kill your bandwith and performance because the raw data is huge.

You need to use the compressed data ( media codec ex.H264 ) and you need a protocol to send and receive it. If you are looking for sub-second latency than webrtc is your best choice in here already. If you have a server in between, distribute your media through that server instead of Mesh. Check this out for webrtc network topologies:

https://antmedia.io/webrtc-servers/

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