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

メニュー

Expand
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

CameraCapturerクラスは、あるCameraCapturer.CameraSourceからのLocalVideoTrack用のビデオフレームを提供するため使用されます。

// 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
primaryVideoView.setMirror(true);

// Render camera to view
localVideoTrack.addRenderer(primaryVideoView);

// Switch the camera source
CameraSource cameraSource = cameraCapturer.getCameraSource();
cameraCapturer.switchCamera();
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
audioManager.setSpeakerphoneOn(true);

// Route audio through headset
audioManager.setSpeakerphoneOn(false);
Rate this page:

ヘルプが必要ですか?

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