Added track success & muted events (#1308)
Related to livekit/protocol#273 This PR adds: - ParticipantResumed - for when ICE restart or migration had occurred - TrackPublishRequested - when we initiate a publication - TrackSubscribeRequested - when we initiate a subscription - TrackMuted - publisher muted track - TrackUnmuted - publisher unmuted track - TrackPublish/TrackSubcribe events will indicate when those actions have been successful, to differentiate.
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
monitorInterval = 3 * time.Second
|
||||
monitorInterval = 1 * time.Second
|
||||
)
|
||||
|
||||
type ParticipantSupervisorParams struct {
|
||||
@@ -92,7 +92,7 @@ func (p *ParticipantSupervisor) SetPublisherPeerConnectionConnected(isConnected
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
||||
func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID, trackType livekit.TrackType) {
|
||||
func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID, onSuccess func(track types.LocalMediaTrack)) {
|
||||
p.lock.Lock()
|
||||
pm, ok := p.publications[trackID]
|
||||
if !ok {
|
||||
@@ -102,12 +102,13 @@ func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID, trackTyp
|
||||
TrackID: trackID,
|
||||
IsPeerConnectionConnected: p.isPublisherConnected,
|
||||
Logger: p.params.Logger,
|
||||
OnSuccess: onSuccess,
|
||||
},
|
||||
),
|
||||
}
|
||||
p.publications[trackID] = pm
|
||||
}
|
||||
pm.opMon.PostEvent(types.OperationMonitorEventAddPendingPublication, trackType.String())
|
||||
pm.opMon.PostEvent(types.OperationMonitorEventAddPendingPublication, nil)
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user