To accurately track joined channels and their connection states in Vivox, use the VivoxService.Instance.ActiveChannels list instead of maintaining your own. This list provides real-time information about channels and their states, such as connecting, connected, or disconnecting. The AudioState and TextStateproperties indicate each channel’s media status. Relying on the SDK’s built-in functionality ensures up-to-date and reliable channel management, avoiding synchronization issues.
Issue:
Attempting to maintain a list of joined channels, including the connection state, leads to inaccurate information when attempting to perform operations on the channel.
Cause:
Users should use the existing channel list and states provided by the SDK, rather than reimplementing that existing functionality.
Resolution:
VivoxService.Instance.ActiveChannels list should be used to determine what channels are currently active (connecting, connected, or disconnecting states). If a channel is found in that list, the AudioState and/or TextState properties will show what state the channel's media is in.In the following list, XState represents either the AudioState or TextState property:
| Channel State | ActiveChannels entry | XState Property | Note |
|---|---|---|---|
| Connecting | Will exist in the ActiveChannels list | ConnectionState.Connecting | |
| Connected | Will exist in the ActiveChannels list | ConnectionState.Connected | |
| Disconnecting | Will exist in the ActiveChannels list | ConnectionState.Disconnecting | |
| Disconnected | Will exist in the ActiveChannels list | ConnectionState.Disconnected | Only if ActiveChannelsis checked from the ChannelLeft event handler. |
Will not exist in the ActiveChannels list | N/A | If ActiveChannels is checked after the ChannelLeft event handler has run, the SDK will automatically remove the channel from ActiveChannels. |