Bug 232835 - A MediaStreamTrack ended due to a capture failure - When using Airpods
Summary: A MediaStreamTrack ended due to a capture failure - When using Airpods
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 11
: P2 Major
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-08 12:39 PST by Daniel Limia
Modified: 2023-01-20 11:07 PST (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Limia 2021-11-08 12:39:50 PST
Hello,

We run a video interviewing company and our software records video interviews from candidates.

We are experiencing MediaStreamTracks crashing with the error "A MediaStreamTrack ended due to a capture failure" when a user is using Airpods as mic input. (Not sure if other earbuds also cause these issues). The user does not necessarely have to remove the Airpods in order for the track to crash. It happens automatically.

Using the same hardware and running the same software the issue does not occur on Chrome, Edge and Mozilla.

There is no issue on iPhone/iPad either.
Comment 1 Radar WebKit Bug Importer 2021-11-15 12:40:24 PST
<rdar://problem/85424679>
Comment 2 Smoley 2021-12-03 12:01:47 PST
Thanks for filing, is there some way we can reproduce this issue on our end? Do you have a test case or test credentials you can share? This can be via email if that works better than posting here. Thanks.
Comment 3 Tal Bar 2021-12-16 06:02:41 PST
We are also encountering this error with Safari 15.1 on MacOS. 
For us, it seems to only occur when the application makes use of the AudioContext API. 
The issue occurs without using Airpods, and is also reproducible on iOS. 

This is a significant problem, as our application includes WebRTC based video-chat and outputs dynamic sounds. 

In Chrome / Firefox and Safari versions pre 15, this issue doesn't occur at all. 

It seems that there are other bug reports in Bugzilla which may be related to this one, but it's really hard to pin point exactly.. 

As more users are gradually updating their Safari version to 15.1, this issue is affecting more and more users.
Comment 4 Tal Bar 2021-12-20 07:38:24 PST
Actually, I'm no longer sure that AudioContext is related.. but I'm not ruling it out. 

I'm able to reproduce the issue in many video chat platforms, such as Google Meet and Twilio quickstart React app. 

Steps to reproduce on Google Meet: 

1. Before starting, make sure that your default audio input device is set as your built-in microphone. 
2. Visit https://meet.google.com -> New Meeting -> Start an instant meeting.
3. Allow “meet.google.com” to use your camera and microphone.
4. Go to settings and select a Bluetooth device (I tried with Sony WH-1000XM2) or a USB device (I tried with Logitech C922 Pro Stream Webcam).

The console shows the error "A MediaStreamTrack ended due to a capture failure".
The microphone volume indicator is not moving anymore.

Safari Version 15.2 (17612.3.6.1.6)
macOS Monterey Version 12.1 (21C52)
Comment 5 Dan Jenkins 2022-03-23 07:45:05 PDT
Would just like to say this is also impacting my clients too
Comment 6 youenn fablet 2022-03-23 07:54:54 PDT
Is it still an issue in the latest Safari 15.4 release?
If so, can you provide some repro steps?
Comment 7 Dan Jenkins 2022-03-23 08:37:46 PDT
hey @youenn !

yes, m1 mac, safari 15.4, monterey 12.3

Open up https://yourclinic.doxy.me/tvk
open up the web inspector console
type in a name like testing
allow permissions
once it loads... top right... hover over the video and change your mic device a few times between airpods and others available and you'll eventually get the capture failure error.
Comment 8 Dan Jenkins 2022-03-23 08:41:46 PDT
Forgot to say, I can do a sysdiagnose if you'd like...
Comment 9 youenn fablet 2022-03-23 10:13:28 PDT
Thanks, I was able to reproduce.
Comment 10 szsinh 2022-06-23 15:28:13 PDT
We are seeing the same error randomly when we use MediaDevice Interface in Media stream API to change the audio source device in Safari 15.5.

The issue is not specific to airpods for us. The error appears when an audio source is changed. It doesn't appear consistently, and can be seen only once in multiple attempts to change the device. It doesn't occurs in chrome.
Comment 11 makarand 2022-06-24 08:58:59 PDT
I am also seeing the same issue on Safari Version 15.5 (17613.2.7.1.8).
running on MacOS Monterey (12.4)

Steps to repro were:
0. Pair a bluetooth headset with audio input/output capabilities with the Mac.
1. Kill any existing instance of Safari
2. Start off with your in-built input output device.
2. Start a new instance of Safari
3. open https://makarandp0.github.io/audioRender/
4. Click on GetLocalAudio (This will acquire local audio track)
5. Click on RenderLocalTrack (This will render acquired track on canvas element)
6. start your bluetooth headset, so that it connects to MacOS.
7. After few seconds turn off your bluetooth headset.
8. Notice that the audio rendering stops although the readyState=live.
. 

Repeat step 5-7 few times, and you will see a "MediaStream ended due to capture failure"
Comment 12 Anna Vasilko 2022-07-13 13:10:39 PDT
Hi, we are getting many reports of this issue. Can it be escalated please?
Comment 13 youenn fablet 2023-01-20 03:13:04 PST
https://github.com/WebKit/WebKit/commit/b818b253da1d92e9e5f802dea4a735b8adeb1994 should help.
Playing with https://makarandp0.github.io/audioRender/, our timer heuristic is a bit too harsh when using as output to a BT headset that is just being switched on. It easily takes 5 seconds or more, so 10 seconds might be too small, I'll increase it.
Comment 14 youenn fablet 2023-01-20 03:17:56 PST
Pull request: https://github.com/WebKit/WebKit/pull/8870
Comment 15 EWS 2023-01-20 11:07:23 PST
Committed 259150@main (24cb5e231498): <https://commits.webkit.org/259150@main>

Reviewed commits have been landed. Closing PR #8870 and removing active labels.