Close room if recorder is the only participant left, not hidden. (#787)
Also need to close participant connections
This commit is contained in:
+4
-1
@@ -508,7 +508,7 @@ func (r *Room) CloseIfEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range r.participants {
|
for _, p := range r.participants {
|
||||||
if !p.Hidden() {
|
if !p.IsRecorder() {
|
||||||
r.lock.Unlock()
|
r.lock.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -544,6 +544,9 @@ func (r *Room) Close() {
|
|||||||
close(r.closed)
|
close(r.closed)
|
||||||
r.lock.Unlock()
|
r.lock.Unlock()
|
||||||
r.Logger.Infow("closing room")
|
r.Logger.Infow("closing room")
|
||||||
|
for _, p := range r.GetParticipants() {
|
||||||
|
_ = p.Close(true, types.ParticipantCloseReasonRoomClose)
|
||||||
|
}
|
||||||
if r.onClose != nil {
|
if r.onClose != nil {
|
||||||
r.onClose()
|
r.onClose()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user