Bug 295887
| Summary: | (iOS) getUserMedia() incorrectly emit 'devicechange' listener | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ronan Chi <wbxl2000> |
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Critical | ||
| Priority: | P2 | ||
| Version: | Safari 18 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 18 | ||
Ronan Chi
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ronan Chi
*** This bug has been marked as a duplicate of bug 295888 ***