1

I'm using RTCMultiConnection library in a project I'm working on and I'm facing a problem. When I tried to share my screen in Firefox (63.0.3 Version), it works for some application window, at the same time some application window just show a black screen instead of actual content(like Chrome and Teams). Also, is it possible to share full desktop instead of single application window in Firefox?

jib
  • 40,579
  • 17
  • 100
  • 158
Mariam
  • 11
  • 1

1 Answers1

0

There's a new standard API available for this: getDisplayMedia.

Unfortunately, it isn't implemented in all browsers yet, but it's available using adapter.js in Firefox, like this:

adapter.browserShim.shimGetDisplayMedia(window, "screen"); // or "window"

(async () => {
  try {
    video.srcObject = await navigator.mediaDevices.getDisplayMedia({video: true});
  } catch(e) {
    console.log(e);
  }
})();

It polyfills an older non-standard API in Firefox. Check out my blog for how to configure Chrome.

Unfortunately, Firefox makes the JS app pick between asking for "screen" and "window" atm, which is non-standard, so the adapter polyfill can only ask for one or the other.

Assuming you're on Windows, the black screen with "Aero" windows is a known bug.

Browsers are working to implement this API natively as we speak.

jib
  • 40,579
  • 17
  • 100
  • 158
  • Thanks for your answer, but it didn't solve the problem I'm facing. The problem is when I'm trying to share my entire screen or another browser window on Firefox it appears as black screen and I don't know if it is an issue in Firefox or in my code – Mariam Nov 18 '18 at 11:05
  • Are you on Windows? Did you check out the [bug I referenced](https://bugzilla.mozilla.org/show_bug.cgi?id=1252021)? That seems to fit—you said some windows worked and others didn't—I haven't heard of a black screen problem when sharing fullscreen however. Consider filing a [new bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=WebRTC%3A%20Audio%2FVideo) if that's the case. – jib Nov 18 '18 at 22:44
  • Yes, I'm on windows and the bug you referenced is talking about black screen with window is minimized but in my case my window isn't minimized at all. – Mariam Nov 19 '18 at 13:36