Initialize the voice client object
How to initialize the Vivox voice client object.
Read time 1 minuteLast updated 16 days ago
You must create and initialize the voice client before other Vivox SDK actions can take place. During the voice client initialization process, the Vivox SDK sets up and starts all of its different subsystems. This can cause additional shared libraries to be loaded, and allows developers to customize a variety of Vivox SDK options before connecting to Vivox services. For example, a developer can select between audio ducking settings and logging level.
await VivoxService.Instance.InitializeAsync(VivoxConfigurationOptions config)The following code displays an example of how to create and initialize the voice client on Windows, macOS, Android, and iOS:
using UnityEngine;using Unity.Services.Authentication;using Unity.Services.Core;using Unity.Services.Vivox;public class VivoxInitializer : MonoBehaviour{ async void Start() { await UnityServices.InitializeAsync(); await AuthenticationService.Instance.SignInAnonymouslyAsync(); await VivoxService.Instance.InitializeAsync(); }}
For more details on the Unity Authentication Service, refer to Sign-in with the Authentication package. For alternative authentication approaches, refer to Sign-in with Custom IDs, or if you are already using Vivox Access Tokens in your application, refer to Using VATs with UAS.