Bug 248964 - Screen share does not work when pass width & height for the video constraint in "getDisplayMedia"
Summary: Screen share does not work when pass width & height for the video constraint ...
Status: RESOLVED DUPLICATE of bug 247310
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-08 11:29 PST by Maksim Ryzhikov
Modified: 2023-03-02 01:44 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Ryzhikov 2022-12-08 11:29:40 PST
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 "Demo url"
- Press "Share screen" button
- "Allow to share screen"

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


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

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


Source code (for history):

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

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

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

main();

```
Comment 1 Maksim Ryzhikov 2022-12-08 11:33:47 PST
I have built WebKit from the main branch but problem still present :(
Comment 2 youenn fablet 2022-12-09 02:17:19 PST
This is probably fixed in https://bugs.webkit.org/show_bug.cgi?id=247310.
I cannot reproduce the issue in mini browser.
Comment 3 youenn fablet 2022-12-09 02:44:14 PST

*** This bug has been marked as a duplicate of bug 247310 ***
Comment 4 Brian Liu 2023-01-09 20:42:16 PST
See the solution https://stackoverflow.com/a/75065525/4796724
Comment 5 Maksim Ryzhikov 2023-01-10 01:11:48 PST
(In reply to Brian Liu from comment #4)
> 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.
Comment 6 Maksim Ryzhikov 2023-01-10 01:12:30 PST
(In reply to Brian Liu from comment #4)
> 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.
Comment 7 shuming 2023-03-02 01:44:06 PST
(In reply to Brian Liu from comment #4)
> 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?