Java

Adding a Custom Audio Renderer

You will implement audio renderer for subscribed streams' audio.

The NoiseAudioDevice() constructor method sets up a file to save the incoming audio to a file. This is done to illustrate a use of the custom audio driver's audio renderer. The app requires the following permissions, defined in the AndroidManifest.xml file:

The BaseAudioDevice.initRenderer() method is called when the app initializes the audio renderer. The NoiseAudioDevice implementation of this method instantiates a new File object, to which the app will write audio data:

The BaseAudioDevice.startRendering() method is called when the audio device should start rendering (playing back) audio from subscribed streams. The NoiseAudioDevice implementation of this method starts the capturer thread to be run in the queue after 1 second:

The renderer thread gets 1 second worth of audio from the audio bus by calling the readRenderData() method of the AudioBus object. It then writes the audio data to the file (for sample purposes). And, if the audio device is still being used to render audio samples, it sets a timer to run the rendererHandler thread again after 0.1 seconds:

This example is intentionally for instructional purposes -- it writes the audio data to a file. In a more practical use of a custom audio driver, you could use the custom audio driver to play back audio to a Bluetooth device or to process audio before playing it back.

Custom Audio Driver

Add a custom audio driver to your application using the Vonage Video API.

以下の言語で利用可能:
Java Objective-C
手順
1
Introduction
2
Getting Started
3
Adding a Custom Audio Driver
4
Adding a Custom Audio Renderer
5
Conclusion