Rate this page:

Configuring Audio, Video Input and Output devices - Android

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 provides video frames via the Camera API 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);
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);


The Camera2Capturer provides video frames via the Camera 2 API for a LocalVideoTrack from a given camera ID.

// Get the device camera IDs
CameraManager cameraManager =
        (CameraManager) cameraCapturerActivity.getSystemService(Context.CAMERA_SERVICE);
String[] cameraIds = cameraManager.getCameraIdList();

// This example uses the first Camera ID but applications can make their own decisions
// about which Camera ID to use 
String cameraId = cameraIds[0];

// Share your camera
Camera2Capturer camera2Capturer = new Camera2Capturer(context, cameraId, camera2Listener);
LocalVideoTrack localVideoTrack = LocalVideoTrack.create(context, true, camera2Capturer);

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

// Switch the camera source from the first camera ID to the second camera ID

For more details and other best practices capturing video from the camera capturers, please reference the Video Android Quickstart.

Managing Audio With AudioSwitch

The Twilio Video Android SDK does not officially support audio device management. Please use AudioSwitch to manage audio focus and audio devices in your application.

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 by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.


        Thank you for your feedback!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more