Bluetooth Media Button to Mute/Unmute outbound audio

Hi,
I’m attempting to use the play/pause bluetooth headset media button to mute and unmute outbound webrtc audio. I’m using TrackPlayer for handling remote-pause and remote-play (mute/unmute by disabling/enabling tracks when these events are received) bluetooth control events and I’m testing several bluetooth headsets from different manufacturers. This works on android, but in ios, the button functions as if it were in a telephony call and “disconnects” the call instead of generating AVRCP play/pause commands. Specifically, console logging shows the following for the bluetoothd process when the button is pressed:

bluetoothd Received call hangup event (AT+CHUP) from device 54:B7:E5:63:4F:32
bluetoothd Found ongoing virtual call - Acking device and notifying upper layers.

Audio is not interrupted in any way when the button is pressed and the headsets work fine in spite of this hangup event. TrackPlayer continues playing test audio and audio from other conferenced webrtc endpoints is mixed correctly.

In addition, console logs other “virtual call” messages when a webrtc audio session is established with bluetooth enabled:

bluetoothd Setting up virtual call (webrtc audio is established)
bluetoothd Clearing virtual call (webrtc audio is torn down)

Without webrtc sessions, TrackPlayer receives AVRCP commands correctly in my app.

To me, this indicates that webrtc is somehow turning the bluetooth headset button functionality from media to telephony. While this might be desired default behavior, I’m wondering if there is any way to tell bluetooth to keep using the media profile after audio is established.

Any help is greatly appreciated.

Bit of a late response but here for future reference.
Take a look at this module.
It might assist in changing telephony modes and getting your bluetooth devices to switch over to the correct mode and thus make the buttons work as intended. That being said i haven’t tested such things myself so you’ll have to take what i’ve said with plenty of salt.