Known WebKit bug affecting speech recognition with Bluetooth audio devices
When iOS Safari activates the microphone (via webkitSpeechRecognition in READ mode), iOS automatically switches audio output from AirPods to the device's built-in speaker. This affects both audio input and output routing.
In WRITE mode, only text-to-speech is used (no microphone activation). The audio routing stays properly configured for AirPods.
READ mode activates speech recognition, which triggers iOS's microphone subsystem. iOS then switches to a phone-call-like audio profile, routing output to the built-in speaker instead of connected Bluetooth audio devices.
The Web Speech API's webkitSpeechRecognition internally uses the same audio subsystem as getUserMedia(). When the microphone is activated:
navigator.audioSession API that may help, but it has limited browser support and may not fully resolve the issue.
// Before starting speech recognition
if (navigator.audioSession) {
navigator.audioSession.type = 'play-and-record';
}
// After stopping speech recognition
if (navigator.audioSession) {
navigator.audioSession.type = 'playback';
navigator.audioSession.type = 'auto';
}
Unresolved
As of November 2024, this remains an unresolved WebKit bug. Apple has not provided an official fix or timeline for resolution.