Get Media Devices

The MediaStream API provides a way to access device cameras and microphones, which may be used to create media streams to publish into the video rooms. The API also provides information about the devices that can capture and render media.

The React Native SDK provides the following methods to obtain the information about media devices on a client platform:

  • getDevices(): To return a list of microphones available on your client platform.
  • getSelectedDevice(): To get the details about the audio device which is selected or used for a stream.

Get a List of All Audio Devices

A user needs to specify an audio device (Microphone) or use the default microphone of the client platform to initiate a stream. The Enx.getDevices() method returns a list of audio devices (Microphone) available on the client platform running the client endpoint application along with the name of the devices. You can build a UI element with the items in the list to choose a microphone.

Class: Enx

Method: getDevices(Callback)

Callback: Returns one or more enumerated values from the following list:

  • NONE

Sample Code

Enx.getDevices(devices=> {
// devices= Comma separated Device Names

Get Selected Audio Device by User

The Enx.getSelectedDevice() method returns the list of audio devices that are selected or used for a stream.

Class: Enx

Method: getSelectedDevice(Callback)

Sample Code

Enx.getSelectedDevice(device => {
// device = Current Device Name