Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now


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?


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


// 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(R.id.local_video);

// 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:


誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。