JSFiddle - React, Tailwind, and code Playground

JavaScript

function getMedia(constraints) {
  return navigator.mediaDevices.getUserMedia(constraints)
    .then(gotMedia)
    .catch(console.error)
}

function gotMedia(stream) {
	console.log('gotStream', stream.id);
  console.log(stream.getAudioTracks()[0].label);
}

function audioInputs(device) {
	return device.kind === 'audioinput';
}

navigator.mediaDevices
	.enumerateDevices()
  .then(deviceInfos => {
  	return deviceInfos.filter(audioInputs);
  })
  .then(audioInputs => {
		const c1 = { audio: { deviceId: { exact: audioInputs[0].deviceId } } }
    const c2 = { audio: { deviceId: { exact: audioInputs[1].deviceId } } }
    const c3 = { audio: { deviceId: { exact: audioInputs[2].deviceId } } }
		getMedia(c1)
    	.then(() => getMedia(c2))
      .then(() => getMedia(c3));
  })