WebRTC:如何在提供和回答后添加流? [英] WebRTC: How to add stream after offer and answer?

查看:129
本文介绍了WebRTC:如何在提供和回答后添加流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展webRTC视频通话。我已成功实施datachannel。现在我想将视频流添加到同一个对等连接。

I am working on webRTC video calling. I got datachannel successfully implemented. Now I would like to add video stream to the same peer connection.

我已经读过应该在回答和提供之前添加流。有没有办法在回答或提议后添加流?

I have read that stream should be added before answer and offer. Is there a way to add stream after answer or offer?

如果我在提供或回答之前添加了流,我怎么能停止流媒体并在需要时再次启动它?

In case I have added stream before offer or answer, how could I stop streaming and start it again when needed?

维护这么多流可能有任何问题吗?

Could there be any issues in maintaining so many streams?

推荐答案

要在创建完整信号后添加流,Peer连接应重新协商与流。

To add stream after creating complete signalling, the Peer connection should renegotiate with stream.

pc1.addstream(stream)

然后再次创建商品并将其发送给其他同行。

Then once again create offer and send it to other Peer.

远程对等体将添加流并发送答案SDP。

Remote peer will add stream and send answer SDP.

要停止流:

stream.stop();
pc1.removeStream(stream);

这篇关于WebRTC:如何在提供和回答后添加流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆