简体   繁体   English

webRTC - 多房间视频会议

[英]webRTC - Video conferece multiple rooms

I'm using Pion SFU-WS, basically a golang based webRTC application Pion- SFU .我正在使用 Pion SFU-WS,基本上是基于 golang 的 webRTC 应用程序 Pion- SFU

Although things work like a charm, I'm clueless about how to run multiple conferences (like we know from Microsoft Teams or Zoom).尽管事情就像一个魅力,但我对如何运行多个会议一无所知(就像我们从 Microsoft Teams 或 Zoom 知道的那样)。 Here is an example of what I'm trying to do:这是我正在尝试做的一个例子:

Room 1: https://localhost:7676/?room-id=12345房间 1: https://localhost:7676/?room-id=12345

Participants of room 1 = A, B, C, D房间 1 的参与者 = A、B、C、D

Room 2: https://localhost:7676/?room-id=67890房间 2: https://localhost:7676/?room-id=67890

Participants of room 2 = E, F, G, H房间 2 的参与者 = E、F、G、H

I can imagine that a static session-id must be passed to我可以想象一个static session-id必须传递给

peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{})

However, all my efforts/approaches have failed.但是,我所有的努力/方法都失败了。

Any help would be immensely appreciated.任何帮助将不胜感激。

After some debugging, I have come up with the following "solution".经过一番调试,我想出了以下“解决方案”。 Though I can now isolate peers to a particular room, I'm not sure if this is the correct way of handling multiple rooms with webRTC.虽然我现在可以将对等方隔离到特定房间,但我不确定这是否是使用 webRTC 处理多个房间的正确方法。

Hence, I'm not accepting the answer yet.因此,我还不接受答案。 In particular, I'm hoping that one of the Pion experts would comment on the performance issues with this approach.特别是,我希望 Pion 的一位专家能够评论这种方法的性能问题。

The idea is to bind the list of peer connections to a specific room id:这个想法是将对等连接列表绑定到特定的房间 ID:

// make list of peer connections globally accessable
// example: peerconnections[1234][..]peerConnectionState{peerConnection, c}
var peerConnections map[string][]peerConnectionState

// Create new PeerConnection
// peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{})
peerConnection, err := webrtc.NewPeerConnection(peerConnectionConfig)


// the list of connections
// initialize connections list
if peerConnections == nil {
    peerConnections = make(map[string][]peerConnectionState, 0)
}

// push peer connection to the list of peer connections of a specific room
if peerConnections[roomId] == nil {
    peerConnections[roomId] = []peerConnectionState{peerConnectionState{peerConnection, c}}
}else{
    peerConnections[roomId] = append(peerConnections[roomId], peerConnectionState{peerConnection, c})
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM