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

Get Audio/Video Device List

To initiate a stream, you need to specify the ID of the audio or the video device (microphone and camera device ID) or specify the ID of the default microphone of your mobility device.

SDK provides getDevices() method to fetch a list of all the microphones and cameras available/connected to your device along with their device IDs. You can also use this method to build the UI element allowing users to choose an audio device from the list.

  • Method: getDevices(successCallback, errorCallback)
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.
window.EnxRtc.getDevices(function (data) {
console.log(JSON.stringify(data.data));
}, function (err) {
console.log(JSON.stringify(err));
}
);

Get the Selected Audio/Video Device

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

  • Method: getSelectedDevice( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.
window.EnxRtc.getSelectedDevice(function (data) {
console.log(JSON.stringify(data.data));
}, function (err) {
console.log(JSON.stringify(err));
}
);