Bug 233473 - audio track error: A MediaStreamTrack ended due to a capture failure
Summary: audio track error: A MediaStreamTrack ended due to a capture failure
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-24 07:05 PST by Vadim
Modified: 2023-03-01 03:50 PST (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim 2021-11-24 07:05:21 PST
In Safari on macOS 15.1 Beta when audio track is acquired in Safari it always ended immediately with error 'A MediaStreamTrack ended due to a capture failure'.
Could be reproduced using https://webrtc.github.io/samples/src/content/getusermedia/audio/
Comment 1 Radar WebKit Bug Importer 2021-11-24 08:32:51 PST
<rdar://problem/85729477>
Comment 2 Tal Bar 2021-12-16 05:51:35 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 example provided by Vadim doesn't reproduce this error for us. 

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 3 Charlie 2022-01-10 11:17:39 PST
A lot of our customers are also starting to see this error. For us, it happens on USB and Bluetooth devices and when the application uses Web Audio API.
Comment 4 Francesco Durighetto (kekkokk) 2022-02-08 03:27:47 PST
Safari 15.3 bug still present.

Can riproduce even without webAudio APIs.

Steps to reproduce:
- connect bluetooth headphones
- go to system preferences, audio, input. Set the default input device as the internal microphone instead of Bluetooth device.
- open: https://jsfiddle.net/bkwLzcjo/1/
- allow permission to capture and inspect console
- select from the dropdown menu the bluetooth input
- "A MediaStreamTrack ended due to a capture failure" appears after few seconds in console

It's P2 an adequate priority?

If we add audioContexts to the page this became even more messy and broken and the majority of conference apps uses the audioContext to display audioLevel...
Comment 5 daginge 2022-02-08 08:00:03 PST
Possibly dupe or related to https://bugs.webkit.org/show_bug.cgi?id=221192. I guess in this case a PC isn't involved so might be a separate issue.
Comment 6 Peter 2022-02-22 09:22:49 PST
Happening to us regularly now with USB audio devices, Safari is (once again) basically unusable for WebRTC.
Comment 7 Andrew McGregor 2022-02-27 09:19:38 PST
I get the same error on Safari on both Intel and iPhone with this app https://mdn.github.io/web-dictaphone/
Comment 8 Abror 2022-06-21 04:55:19 PDT
Any updates on this? We are still facing this problem in our webrtc app?
For us, capturing an audio device is failing when AudioContext API is used in Safari 15.x.
Comment 9 Abror 2022-07-20 23:52:27 PDT
The issue is fixed for me in Safari 15.6
Comment 10 Joshua Smith 2022-07-27 08:50:00 PDT
Although the error message is no longer being reported, switching audio devices still does not work. If you open the audio device you want, it now will work correctly with the device chosen (this wasn't working before). But if you then close that and try to open a different device, things still fall apart.
Comment 11 Peter 2022-07-27 08:51:06 PDT
Are you sure about that? I tested it and was able to change devices.
Comment 12 Joshua Smith 2022-07-27 09:14:12 PDT
After some more testing, it turns out that changing devices *does* work. The problem is that when I have bluetooth headphones connected, the gain on the internal mic is dropping to almost zero. This only happens in Safari (I can switch audio input no problem in Firefox, for example, and the gain stays correct).

This seems to be a new problem, in that the internal mic gain is super low even if that's the only device I ever use. So it's not related to switching.
Comment 13 youenn fablet 2022-07-27 09:28:37 PDT
(In reply to Joshua Smith from comment #12)
> After some more testing, it turns out that changing devices *does* work. The
> problem is that when I have bluetooth headphones connected, the gain on the
> internal mic is dropping to almost zero. This only happens in Safari (I can
> switch audio input no problem in Firefox, for example, and the gain stays
> correct).
> 
> This seems to be a new problem, in that the internal mic gain is super low
> even if that's the only device I ever use. So it's not related to switching.

This seems like a different bug, could you file a bug?
Also, which Safari version are you using?
Comment 14 Joshua Smith 2022-07-27 09:33:28 PDT
I'll file a bug. I'm using Version 15.6 (16613.3.9.1.7, 16613) on MacOS 11.6.7
Comment 15 Joshua Smith 2022-07-27 12:47:55 PDT
Here's the bug, including a test app to demonstrate it.
https://bugs.webkit.org/show_bug.cgi?id=243260
Comment 16 Tal Bar 2022-10-27 02:38:57 PDT
This bug is definitely NOT resolved! 
I'm still encountering this bug on Safari Version 16.0 (17614.1.25.9.10, 17614).
When selecting bluetooth headphones (WH-1000XM2) as audio input device, I'm getting "A MediaStreamTrack ended due to a capture failure".
I was able to reproduce it in Google Meet. 
This bug makes using Safari + bluetooth headphones for video calls impossible!
Comment 17 Tal Bar 2022-10-27 02:51:05 PDT
As Francesco Durighetto described, this error occurs when the OS default input device is set at anything other than bluetooth headphones. 
Still, this issue doesn't occur using Chrome or Firefox. Only Safari..
Comment 18 youenn fablet 2022-10-27 02:55:33 PDT
@Tal Bar, can you file a new bug?
And mention the macOS version (plus ideally send me a sysdiagnose to me at youenn@apple.com)