ability to disable auto subscribe per participant
This commit is contained in:
@@ -57,6 +57,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
roomName := r.FormValue("room")
|
||||
reconnectParam := r.FormValue("reconnect")
|
||||
protocolParam := r.FormValue("protocol")
|
||||
autoSubParam := r.FormValue("auto_subscribe")
|
||||
planBParam := r.FormValue("planb")
|
||||
|
||||
claims := GetGrants(r.Context())
|
||||
@@ -66,10 +67,18 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
pi := routing.ParticipantInit{
|
||||
Reconnect: boolValue(reconnectParam),
|
||||
Identity: claims.Identity,
|
||||
UsePlanB: boolValue(planBParam),
|
||||
Reconnect: boolValue(reconnectParam),
|
||||
Identity: claims.Identity,
|
||||
UsePlanB: boolValue(planBParam),
|
||||
AutoSubscribe: true,
|
||||
}
|
||||
if autoSubParam != "" {
|
||||
pi.AutoSubscribe = boolValue(autoSubParam)
|
||||
}
|
||||
if pv, err := strconv.Atoi(protocolParam); err == nil {
|
||||
pi.ProtocolVersion = int32(pv)
|
||||
}
|
||||
|
||||
// only use permissions if any of them are set, default permissive
|
||||
if claims.Video.CanPublish || claims.Video.CanSubscribe {
|
||||
pi.Permission = &livekit.ParticipantPermission{
|
||||
@@ -77,9 +86,6 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
CanPublish: claims.Video.CanPublish,
|
||||
}
|
||||
}
|
||||
if pv, err := strconv.Atoi(protocolParam); err == nil {
|
||||
pi.ProtocolVersion = int32(pv)
|
||||
}
|
||||
|
||||
onlyName, err := EnsureJoinPermission(r.Context())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user