Get a list of Audio Devices

You can initiate a Stream using either the browser’s default Audio Device or by specifying the ID of the Audio Device connected to the device running the client application which requires you to get the Device IDs of all the connected devices.   

The EnxRoom.getDevices() method provides a list of all the Microphones connected to your Device. You can also use this method to build UI Element allowing users to choose an Audio Device from the list.

Class: EnxRoom

Method: public List <String> getDevices() – No parameter required.

Returns: List of Devices.

List deviceList = enxRoom.getDevices();

// Returns [SPEAKER_PHONE, WIRED_HEADSET, EARPIECE, BLUETOOTH, NONE ] 

Get selected Audio Device by User

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

Class: EnxRoom

Method: public String getSelectedDevice() – No parameter required.

String selectedDevice = room.getSelectedDevice();

Handle Audio Device Updates

The notification on any addition or modification in the Audio Devices such as earphones or headphones connected to the Mobile device is provided through the following Callbacks:

Callbacks:

  • onNotifyDeviceUpdate – Acknowledgment to the user when a switch to alternate media devices is made at run-time.
  • onDeviceAdded – Notification to the user when a new Audio Device is connected.
  • onDeviceRemoved – Notification to the user when an Audio Device is disconnected.
public void onDeviceAdded(String message) {
	// New Device added
}

public void onDeviceRemoved(String message) {
	// Device removed
}

public void onNotifyDeviceUpdate (String message) {
	// Device switched
}