ParticipantUpdatedNotifier
Namespace: SynicSugar.RTC
public ParticipantUpdatedNotifier ParticipantUpdatedNotifier
Description
Events when an audio state is changed.
We register events to change speaking or not on GUI.
Event
| API | description |
|---|---|
| OnStartSpeaking | Invoke on ParticipantUpdated |
| OnStopSpeaking | Invoke on ParticipantUpdated |
| OnStartTargetSpeaking | Invoke on ParticipantUpdated with UserId as arg |
| OnStopTargetSpeaking | Invoke on ParticipantUpdated with UserId as arg |
Function
| API | description |
|---|---|
| Register | Set events |
using SynicSugar.P2P;
using SynicSugar.RTC;
using UnityEngine;
public class VCSample : MonoBehaviour {
void Start(){
RTCManager.Instance.ParticipantUpdatedNotifier.Register(() => OnStartSpeaking(), () => OnStopSpeaking());
}
void OnStartSpeaking(){
Debug.Log($"{RTCManager.Instance.LastStateUpdatedUserId.ToString()} is Speaking");
}
void OnStopSpeaking(){
Debug.Log($"{RTCManager.Instance.LastStateUpdatedUserId.ToString()} is Mute");
}
}