<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>295887</bug_id>
          
          <creation_ts>2025-07-14 06:51:46 -0700</creation_ts>
          <short_desc>(iOS) getUserMedia() incorrectly emit &apos;devicechange&apos; listener</short_desc>
          <delta_ts>2025-07-14 06:55:35 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>Safari 18</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 18</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>295888</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ronan Chi">wbxl2000</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2129810</commentid>
    <comment_count>0</comment_count>
    <who name="Ronan Chi">wbxl2000</who>
    <bug_when>2025-07-14 06:51:46 -0700</bug_when>
    <thetext>When I test getUserMedia() API in iOS, it incorrectly emit &apos;devicechange&apos; listener.
And I call getUserMedia() again in my web app, it will cause &lt;strong&gt;infinite&lt;/strong&gt; &apos;devicechange&apos; listener loop.
It&apos;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(&apos;devicechange&apos;, () =&gt; {
  requestDevice();
});
async function requestDevice() {
  log(&apos;log&apos;, &apos;getUserMedia&apos;);
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
  stream.getTracks().forEach(track =&gt; {
    track.stop();
  });
}
requestDevice();
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2129813</commentid>
    <comment_count>1</comment_count>
    <who name="Ronan Chi">wbxl2000</who>
    <bug_when>2025-07-14 06:55:35 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 295888 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>