Bluetooth devices not showing in mediaDevices.enumerateDevices();

Hey, I was testing on physical devices and doing something like this and expecting it to show bluetooth device (headphones) connected to my phone

import { mediaDevices } from 'react-native-webrtc';


export const getAllMediaDevices = async () => {
	const devices = await mediaDevices.enumerateDevices();

	//Android
	//0: {kind: "videoinput", label: "0", deviceId: "0", groupId: "", facing: "environment"}
	// 1: {kind: "videoinput", label: "1", deviceId: "1", groupId: "", facing: "front"}
	// 2: {kind: "audioinput", label: "Audio", groupId: "", deviceId: "audio-1"}
	// IOS 
	// 0: {groupId: "", deviceId: "com.apple.avfoundation.avcapturedevice.built-in_video:0", label: "Back Camera", facing: "environment", kind: "videoinput"}
	// 1: {groupId: "", deviceId: "com.apple.avfoundation.avcapturedevice.built-in_video:1", label: "Front Camera", facing: "front", kind: "videoinput"}
	// 2: groupId: "", deviceId: "com.apple.avfoundation.avcapturedevice.built-in_audio:0", label: "iPhone Microphone", kind: "audioinput
	console.log(devices)
	return devices;
};

But it isn’t showing bluetooth device (headphones). Is this normal behavior? If yes, then how can I get bluetooth (headphones)?

1 Like

The problem have been not working in android 12 version or more. I have same problem.
why no answer…?

It is definitely not normal behavior. Many users including me are facing it. Someone should take a look at it.

What permissions did you set in the android manifest for Bluetooth?

You need these.

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />