이벤트

Vivox Unity는 C# EventHandler 델리게이트를 사용하여 애플리케이션이 SDK 상태 변경 사항, 들어오는 텍스트 메시지, 들어오는 구독 요청, 또는 오디오 디바이스 가용 상태 변경을 수신할 수 있도록 합니다. 애플리케이션에서 이러한 알림을 수신하려면 해당 이벤트 핸들러를 구독해야 합니다.

오디오 입력 디바이스 변경으로 인해 발생하는 이벤트를 구독 및 구독 해지하는 방법의 코드 예제는 다음과 같습니다.

using UnityEngine;
using Unity.Services.Vivox;

class EventExample : MonoBehaviour
{
    . . .
    // Bind or unbind event handler for Client AudioInputDevices property changes
    private void BindHandlers(bool doBind, Client client)
    {
        if (doBind)
        {
            client.AudioInputDevices.PropertyChanged += onAudioInputDeviceChanged;
        }
        else
        {
            client.AudioInputDevices.PropertyChanged -= onAudioInputDeviceChanged;
        }
    }

    private void onAudioInputDeviceChanged(object sender,System.ComponentModel.PropertyChangedEventArgs propertyChangedEventArgs)
    {
        . . .
    }
    . . .
}