Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,18 @@ func (e *RTCEngine) JoinContext(ctx context.Context, url string, token string, p
e.token.Store(token)
e.connParams = params

err = e.configure(res.IceServers, res.ClientConfiguration, proto.Bool(res.SubscriberPrimary))
usedIceServers := params.ICEServers
if len(usedIceServers) == 0 {
usedIceServers = res.IceServers
}
clientConfig := res.ClientConfiguration
if params.ForceRelay {
if clientConfig == nil {
clientConfig = &livekit.ClientConfiguration{}
}
clientConfig.ForceRelay = livekit.ClientConfigSetting_ENABLED
}
err = e.configure(usedIceServers, clientConfig, proto.Bool(res.SubscriberPrimary))
if err != nil {
return nil, err
}
Expand Down
14 changes: 14 additions & 0 deletions room.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ type SignalClientConnectParams struct {
Interceptors []interceptor.Factory

ICETransportPolicy webrtc.ICETransportPolicy
ICEServers []*livekit.ICEServer
ForceRelay bool
}

type ConnectOption func(*SignalClientConnectParams)
Expand Down Expand Up @@ -147,6 +149,18 @@ func WithDisableRegionDiscovery() ConnectOption {
}
}

func WithICEServers(iceServers []*livekit.ICEServer) ConnectOption {
return func(p *SignalClientConnectParams) {
p.ICEServers = iceServers
}
}

func WithForceRelay(forceRelay bool) ConnectOption {
return func(p *SignalClientConnectParams) {
p.ForceRelay = forceRelay
}
}

type PLIWriter func(webrtc.SSRC)

type Room struct {
Expand Down
Loading