androidlinphonelinphone-sdk

how to get the normal name of audio devices


I use the linphone sdk and i want to get a list of audio devices, or rather their type and driverName, but it outputs in the style of {2: Audio, 3: Audio, 1: AAudio} Although if you do this on ios, it gives out normally in the style of {3: Speaker}

And here I would also like to do it on android

code:

val devices = core.audioDevices
val devicesMap: Map<Int, String> = devices.associateBy({ it.type.ordinal }, { it.driverName })

Solution

  • I do not know about linphone sdk but there is an Api in android named AudioDeviceInfo and it has methods that would satisfy you requirements.

        AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
            AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
            for (AudioDeviceInfo device : devices) {
                Log.d("Type",device.getType()); 
                Log.d("Product Name",device.getProductName());
                
            }