使用RTCMultiConnection在Firefox中共享屏幕 [英] Share screen in Firefox using RTCMultiConnection

查看:127
本文介绍了使用RTCMultiConnection在Firefox中共享屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个正在处理的项目中使用RTCMultiConnection库,但遇到了问题.当我尝试在Firefox(63.0.3版)中共享屏幕时,它适用于某些应用程序窗口,同时某些应用程序窗口仅显示黑屏而不是实际内容(例如Chrome和Teams).另外,是否可以在Firefox中共享完整的桌面而不是单个应用程序窗口?

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?

推荐答案

为此提供了一个新的标准API:

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

不幸的是,尚未在所有浏览器中实现,但可以使用 adapter.js 来使用.在Firefox中,像这样:

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);
  }
})();

它会在Firefox中填充旧的非标准API .查看我的博客,了解如何配置Chrome

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

不幸的是,Firefox使JS应用程序在要求"screen" "window" atm之间进行选择,这是非标准的,因此适配器polyfill只能询问一个或另一个.

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.

假设您使用的是Windows,则带有"Aero"窗口的黑屏是已知错误.

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

正如我们所说的,浏览器正在以本地方式实现此API.

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

这篇关于使用RTCMultiConnection在Firefox中共享屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆