RESOLVED FIXED295888
(iOS) getUserMedia() incorrectly emit 'devicechange' listener
https://bugs.webkit.org/show_bug.cgi?id=295888
Summary (iOS) getUserMedia() incorrectly emit 'devicechange' listener
Ronan Chi
Reported 2025-07-14 06:52:00 PDT
When I test getUserMedia() API in iOS, it incorrectly emit 'devicechange' listener. And I call getUserMedia() again in my web app, it will cause <strong>infinite</strong> 'devicechange' listener loop. It's ok in Chrome or PC Browser. Online Link: https://bug.qer.im/ios-getUserMedia-incorrectly-emit-devicechange-listener/index.html ```js navigator.mediaDevices.addEventListener('devicechange', () => { requestDevice(); }); async function requestDevice() { log('log', 'getUserMedia'); const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); stream.getTracks().forEach(track => { track.stop(); }); } requestDevice(); ```
Attachments
Reproduction Code (2.39 KB, text/html)
2025-07-14 06:54 PDT, Ronan Chi
no flags
Reproduction Video (5.93 MB, video/mp4)
2025-07-14 07:18 PDT, Ronan Chi
no flags
Reproduction Video 2 (6.17 MB, video/mp4)
2025-07-14 07:25 PDT, Ronan Chi
no flags
Ronan Chi
Comment 1 2025-07-14 06:54:02 PDT
Created attachment 475973 [details] Reproduction Code
Ronan Chi
Comment 2 2025-07-14 06:55:35 PDT
*** Bug 295887 has been marked as a duplicate of this bug. ***
Ronan Chi
Comment 3 2025-07-14 07:18:21 PDT
Created attachment 475975 [details] Reproduction Video
Ronan Chi
Comment 4 2025-07-14 07:25:22 PDT
Created attachment 475976 [details] Reproduction Video 2
Radar WebKit Bug Importer
Comment 5 2025-07-21 06:52:13 PDT
youenn fablet
Comment 6 2025-07-28 09:42:05 PDT
I am able to reproduce. It appears that stopping the tracks triggers the devicechange event, I am not yet sure why: https://codepen.io/youennf/pen/ogjYjZP Also, it appears that the devicechange event is fired twice after getUserMedia({audio:true}) while it should be fired only once I think.
youenn fablet
Comment 7 2025-07-30 05:15:48 PDT
EWS
Comment 8 2025-07-31 01:14:29 PDT
Committed 298074@main (913a59298c3e): <https://commits.webkit.org/298074@main> Reviewed commits have been landed. Closing PR #48716 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.