Managing Audio Sessions in iOS with Vonage Video API Managing Audio Sessions in iOS with Vonage Video API

Managing Audio Sessions in iOS with Vonage Video API

Maria Scieranska

How It Works

All of the code that controls audio playback and recording in the Vonage Video iOS SDK is open sourced as a sample application [link]. If no audio device is set prior to the first instantiation of OTSession, the default driver internal to the SDK will be used. Using the sample audio device is the best way to debug runtime audio issues encountered during app development.

Common Issues

Interruption and Route Handling

Apart from debugging, another reason to adopt an external audio driver is to override default behaviors for handling audio events on the end user's device. Incoming phone calls, Siri activations, app switches, and device plugins are some of the events that will interrupt an active audio session working with Vonage Video. The default implementation in the SDK attempts to handle all of these situations gracefully, however in some cases it may be prudent to provide alternative event handling behavior.

Corrupted Audio

In some situations, audio may become corrupted by misconfigured sessions or interfering other audio classes, for example MPMoviePlayerController or AVAudioPlayer. The best approach for diagnosing and solving audio integrity issues is to make sure that compatible sample rates and formats are used, and to ensure that the audio session for the app is being properly managed between contending resources.

Sample Formats and Rates

The notes in the README for the external audio device sample application have the most up to date information on known working (and breaking) configurations.