在网页之间保持 webrtc streams/connections
Keeping webrtc streams/connections between webpages
我在使用 WebRTC(语音和视频)时遇到了一个具体问题。
我想在网站上的网页之间保持 connection/voice/video 流。我以为我可以在后台使用共享网络工作者 运行?
任何指导都会很棒。我看过其他帖子,但它们已经很老了,想知道是否有人有任何、更多、最新的信息或我可以解决这个问题的方法?
更新:
共享网络工作者是解决这个问题的错误方法。 Service Workers 是网页终止后维护的前进方向。
在页面加载之间保持 webRTC 连接活跃似乎是一个罕见的用例。通常,您开始通话并停留在一个页面上。我想如果您想在网站上嵌入客户支持(如 webRTC 小部件)并让该小部件在单个域下通过页面导航跟随用户,这可能是有意义的。
我认为 saving/reusing blob URL 不会允许您在页面重新加载时重新连接以确保安全 issues/hijacking 潜力。
IceRestart 约束可能会有所帮助。显然你可以将 SDP 信息保存到本地存储,重新使用协商的 SDP,然后调用 IceRestart 快速重新连接。
As described in section 3, the nominated ICE candidate pair is
exchanged during an SDP offer/answer procedure, which is maintained
by the JavaScript. The JavaScript can save the SDP information on
the application server or in browser local storage. When a page
reload has happened, a new JavaScript will be reloaded, which will
create a new PeerConnection and retrieve the saved SDP information
including the previous nominated candidate pair. Then the JavaScript
can request the previous resource by sending a setLocalDescription(),
which includes the saved SDP information. Instead of restart an ICE
procedure without additional action hints, the new JavaScript SHALL
send an updateIce() which indicates that it has happended because of
a page reload. If the ICE agent then can allocate the previous
resource for the new JavaScript, it will use the previous nominated
candidate pair for the first connectivity check, and if it succeeds
the ICE agent will keep it marked as selected. The ICE agent can now
send media using this candidate pair, even if it is running in
Regular Nomination mode.
https://bugs.chromium.org/p/webrtc/issues/detail?id=979
https://datatracker.ietf.org/doc/html/draft-li-rtcweb-ice-page-reload-02
我在使用 WebRTC(语音和视频)时遇到了一个具体问题。
我想在网站上的网页之间保持 connection/voice/video 流。我以为我可以在后台使用共享网络工作者 运行?
任何指导都会很棒。我看过其他帖子,但它们已经很老了,想知道是否有人有任何、更多、最新的信息或我可以解决这个问题的方法?
更新: 共享网络工作者是解决这个问题的错误方法。 Service Workers 是网页终止后维护的前进方向。
在页面加载之间保持 webRTC 连接活跃似乎是一个罕见的用例。通常,您开始通话并停留在一个页面上。我想如果您想在网站上嵌入客户支持(如 webRTC 小部件)并让该小部件在单个域下通过页面导航跟随用户,这可能是有意义的。
我认为 saving/reusing blob URL 不会允许您在页面重新加载时重新连接以确保安全 issues/hijacking 潜力。
IceRestart 约束可能会有所帮助。显然你可以将 SDP 信息保存到本地存储,重新使用协商的 SDP,然后调用 IceRestart 快速重新连接。
As described in section 3, the nominated ICE candidate pair is exchanged during an SDP offer/answer procedure, which is maintained by the JavaScript. The JavaScript can save the SDP information on the application server or in browser local storage. When a page reload has happened, a new JavaScript will be reloaded, which will create a new PeerConnection and retrieve the saved SDP information including the previous nominated candidate pair. Then the JavaScript can request the previous resource by sending a setLocalDescription(), which includes the saved SDP information. Instead of restart an ICE procedure without additional action hints, the new JavaScript SHALL send an updateIce() which indicates that it has happended because of a page reload. If the ICE agent then can allocate the previous resource for the new JavaScript, it will use the previous nominated candidate pair for the first connectivity check, and if it succeeds the ICE agent will keep it marked as selected. The ICE agent can now send media using this candidate pair, even if it is running in Regular Nomination mode.
https://bugs.chromium.org/p/webrtc/issues/detail?id=979
https://datatracker.ietf.org/doc/html/draft-li-rtcweb-ice-page-reload-02