기술 자료

지원

Vivox Unity SDK

Vivox Unity SDK

채널 참여 시작

How to initiate a channel join request in Vivox.
읽는 시간 1분최근 업데이트: 19일 전

다음은 채널 참여를 시작하는 방법의 예제를 보여 주는 코드입니다.
using System;using System.ComponentModel;using UnityEngine;using Unity.Services.Vivox;class JoinChannelExample : MonoBehaviour{ // For this example, _loginSession is a signed in ILoginSession. . . . void OnLoggedIn() { //These events can be bound anywhere, but keeping them within the lifecycle of an active LoginSession is typically best VivoxService.Instance.ChannelJoined += OnChannelJoined VivoxService.Instance.ChannelLeft += OnChannelLeft } void OnChannelJoined(string channelName) { //Perform actions to react to joining the specific channel with name channelName //UI switches, participant UI setup, etc } void OnChannelLeft(string channelName) { //Perform cleanup to react to leaving a specific channel with name channelName } async void JoinChannelAsync(string channelName) { //Join channel with name channelName and capability for text and audio transmission VivoxService.Instance.JoinGroupChannelAsync(channelName, ChatCapability.TextAndAudio); } . . .}
채널에 참여할 때를 결정하려면, 반드시
VivoxService.Instance.ChannelJoined
이벤트를 바인드해야 합니다. 이벤트 자체는 해당 채널에 필요한 특정 이벤트를 트리거하는 데 사용되는 채널 이름으로 실행됩니다. 다양한 채널이 처리되는 방식을 구별하는 데 도움이 되는 채널 이름 구조를 사용하는 것이 좋습니다.
ChannelLeft
는 채널을 떠날 때 발생하는 액션이며 떠난 채널의 이름이 파라미터입니다.
VivoxService.Instance.JoinGroupChannelAsync
,
VivoxService.Instance.JoinEchoChannelAsync
,
VivoxService.Instance.JoinPositionalChannelAsync
에는 ChannelOptions라는 선택적 파라미터가 있습니다. ChannelOptions를 사용하여 채널 참여가 완료될 때 해당 채널을 전송할 활성 채널로 만드는 등의 동작을 설정합니다.