Partial connection failure
Learn how to handle media stream updated events.
読み終わるまでの所要時間 1 分最終更新 23日前
In some cases, such as when an application is suspended in the background, the connection to Vivox services can be disrupted so that voice communication terminates without signing out the user. In that case, a
vx_evt_media_stream_updatedsession_media_disconnectedstatus_code
The following sample code is an example of how to handle media stream updated events.
void HandleMediaStreamUpdatedEvent(vx_evt_connection_state_changed &evt){ vx_session_media_state media_state = evt.state; if (evt.state == session_media_connected) { printf("Connected to voice session %s\n", evt.session_handle); } else if (evt.state == session_media_disconnected) { if (evt.status_code != 0) { printf("Disconnected from voice session %s with status %d:%s\n", evt.session_handle, evt.status_code, vx_get_error_string(evt.status_code)); // Expect a session_removed event to follow. // Wait to re-join the session until after the network connection is restored. } else { printf("Disconnected from voice session %s\n", evt.session_handle); } }}