チャンネルへの参加を開始する
How to initiate a channel join request in Vivox.
読み終わるまでの所要時間 1 分最終更新 8ヶ月前
以下のコードは、チャンネルへの参加を開始する方法の例を示します。
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.ChannelJoinedChannelLeftVivoxService.Instance.JoinGroupChannelAsyncVivoxService.Instance.JoinEchoChannelAsyncVivoxService.Instance.JoinPositionalChannelAsync