Pass along mime type with TrackInfo (#292)

This commit is contained in:
David Zhao
2021-12-27 23:43:30 -08:00
committed by GitHub
parent 87a799bae2
commit b747cdb822
3 changed files with 27 additions and 18 deletions
+10 -4
View File
@@ -306,14 +306,14 @@ func (c *RTCClient) Run() error {
return err
}
case *livekit.SignalResponse_Update:
participants := make(map[string]*livekit.ParticipantInfo)
c.lock.Lock()
for _, p := range msg.Update.Participants {
if p.State != livekit.ParticipantInfo_DISCONNECTED {
participants[p.Sid] = p
c.remoteParticipants[p.Sid] = p
} else {
delete(c.remoteParticipants, p.Sid)
}
}
c.lock.Lock()
c.remoteParticipants = participants
c.lock.Unlock()
case *livekit.SignalResponse_TrackPublished:
@@ -389,6 +389,12 @@ func (c *RTCClient) RemoteParticipants() []*livekit.ParticipantInfo {
return funk.Values(c.remoteParticipants).([]*livekit.ParticipantInfo)
}
func (c *RTCClient) GetRemoteParticipant(sid string) *livekit.ParticipantInfo {
c.lock.Lock()
defer c.lock.Unlock()
return c.remoteParticipants[sid]
}
func (c *RTCClient) Stop() {
logger.Infow("stopping client", "ID", c.ID())
_ = c.SendRequest(&livekit.SignalRequest{