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 Flutter SDK provides the following methods:

  • getDevices() - To obtain a list containing all the audio devices.
  • getSelectedDevice() - To get the currently selected or in-use audio device for the stream.

Get a list of Audio Devices

You will need to specify audio or video device ID (microphone and camera device ID) or use the default microphone device ID of your mobility device to initiate a stream. EnableX provides API support to get a list of audio devices available with your device running the client endpoint application along with their device IDs.

The EnxRtc.getDevices() method provides a list of all the microphones connected to your device. You can build the UI Element with the list to choose a microphone for the stream.

Class: EnxRtc

Method: public List <String> getDevices()

Returns: List of devices

Sample Code

List<dynamic> deviceList= EnxRtc.getDevices();

Get the Selected Audio Device by User

The EnxRtc.getSelectedDevice() method provides the selected/in-use Audio Device for the Stream.

Class: EnxRtc

Method: static Future<String> getSelectedDevice()

Sample Code

String deviceName = EnxRtc.getSelectedDevice();