Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Configuring Audio, Video Input and Output devices

In this guide we’ll show you how to configure Audio, Video input and output devices from your Twilio Video Rooms API application. Taking advantage of the ability to control input and output devices lets you build a better end user experience.

Selecting a specific Video Input

The CameraCapturer class is used to provide video frames for a LocalVideoTrack from a given CameraCapturer.CameraSource.

// Share your camera
CameraCapturer cameraCapturer = new CameraCapturer(context, CameraSource.FRONT_CAMERA);
LocalVideoTrack localVideoTrack = LocalVideoTrack.create(context, true, cameraCapturer);

// Render camera to a view
VideoView primaryVideoView = (VideoView) findViewById(;

// Mirror front camera

// Render camera to view

// Switch the camera source
CameraSource cameraSource = cameraCapturer.getCameraSource();
primaryVideoView.setMirror(cameraSource == CameraSource.BACK_CAMERA);

Selecting a specific Audio input

The Twilio Video Android SDK does not officially support switching the AudioSource and just defaults to the native Android API MediaRecorder.AudioSource.VOICE_COMMUNICATION

Selecting a specific Audio output

Using the AudioManager class provided by Android, you can specify if audio is routed through the headset or speaker.

// Get AudioManager
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

// Route audio through speaker

// Route audio through headset
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.