<?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>248964</bug_id>
          
          <creation_ts>2022-12-08 11:29:40 -0800</creation_ts>
          <short_desc>Screen share does not work when pass width &amp; height for the video constraint in &quot;getDisplayMedia&quot;</short_desc>
          <delta_ts>2023-03-02 01:44:06 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebRTC</component>
          <version>Safari 16</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 13</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>247310</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="Maksim Ryzhikov">rv.maksim</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>eric.carlson</cc>
    
    <cc>jer.noble</cc>
    
    <cc>ltsg0317</cc>
    
    <cc>ralphbliu</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1917642</commentid>
    <comment_count>0</comment_count>
    <who name="Maksim Ryzhikov">rv.maksim</who>
    <bug_when>2022-12-08 11:29:40 -0800</bug_when>
    <thetext>Demo source: https://codesandbox.io/s/a-mediastreamtrack-ended-due-to-a-capture-failure-mxrpxc?file=/src/index.js
Demo url: https://mxrpxc.csb.app


Steps to reproduce (A):
- Open &quot;Demo url&quot;
- Press &quot;Share screen&quot; button
- &quot;Allow to share screen&quot;

Expected result: video tag display screen
Actual result: Exception &quot;A MediaStreamTrack ended due to a capture failure&quot;


Steps to reproduce (B):
- Open &quot;Demo url&quot;
- Press &quot;Share screen&quot; button
- &quot;Allow to share window&quot;

Expected result: video tag display window stream
Actual result: nothing


Source code (for history):

```javascript
function main() {
  console.clear();

  const video = document.createElement(&quot;video&quot;);
  video.autoplay = true;
  video.width = 250;
  video.style.display = &quot;block&quot;;
  video.style.border = &quot;1px solid red&quot;;

  const button = document.createElement(&quot;button&quot;);
  button.innerText = &quot;Share screen!&quot;;
  button.onclick = async () =&gt; {
    const stream = await navigator.mediaDevices.getDisplayMedia({
      video: {
        width: 100,
        height: 100
      }
    });
    video.srcObject = stream;
  };
  document.body.append(video);
  document.body.append(button);
}

main();

```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1917647</commentid>
    <comment_count>1</comment_count>
    <who name="Maksim Ryzhikov">rv.maksim</who>
    <bug_when>2022-12-08 11:33:47 -0800</bug_when>
    <thetext>I have built WebKit from the main branch but problem still present :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1917896</commentid>
    <comment_count>2</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2022-12-09 02:17:19 -0800</bug_when>
    <thetext>This is probably fixed in https://bugs.webkit.org/show_bug.cgi?id=247310.
I cannot reproduce the issue in mini browser.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1917899</commentid>
    <comment_count>3</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2022-12-09 02:44:14 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 247310 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1924267</commentid>
    <comment_count>4</comment_count>
    <who name="Brian Liu">ralphbliu</who>
    <bug_when>2023-01-09 20:42:16 -0800</bug_when>
    <thetext>See the solution https://stackoverflow.com/a/75065525/4796724</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1924316</commentid>
    <comment_count>5</comment_count>
    <who name="Maksim Ryzhikov">rv.maksim</who>
    <bug_when>2023-01-10 01:11:48 -0800</bug_when>
    <thetext>(In reply to Brian Liu from comment #4)
&gt; See the solution https://stackoverflow.com/a/75065525/4796724

Thanks, but this is not a solution. This is the one of possible workarounds which may or may not suite.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1924317</commentid>
    <comment_count>6</comment_count>
    <who name="Maksim Ryzhikov">rv.maksim</who>
    <bug_when>2023-01-10 01:12:30 -0800</bug_when>
    <thetext>(In reply to Brian Liu from comment #4)
&gt; See the solution https://stackoverflow.com/a/75065525/4796724

Thanks, but this is not a solution. This is the one of possible workarounds which may or may not suite.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1938091</commentid>
    <comment_count>7</comment_count>
    <who name="shuming">ltsg0317</who>
    <bug_when>2023-03-02 01:44:06 -0800</bug_when>
    <thetext>(In reply to Brian Liu from comment #4)
&gt; See the solution https://stackoverflow.com/a/75065525/4796724

Even though it can be called, there is still no limit to the collection resolution, so far the collection is always 1080, my version is Safari16.3.
Has anyone else been in this situation?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>