NodeWebRTC 视频流不显示在 chrome

问题描述

我已经熟悉用于视频流的 webRTC。我的目标是通过 gstreamer 在浏览器中显示视频流,同时保持低延迟。

我为此使用了 nodewebrtc 并尝试了 github repo here 中的示例。到目前为止,我已经使用此代码对其进行了测试,并且仅在开始时与 gstreamer 管道交换了一些代码,如下所示:

const gstreamer = require("gstreamer-superficial");
const { RTCVideoSource } = require('wrtc').nonstandard;

let numOfClients = 0
let pipeline = null

function beforeOffer(peerConnection) {
  if (numOfClients == 0) {
    console.log("starting new pipeline");
    pipeline = new gstreamer.Pipeline("videotestsrc is-live=True ! videoconvert ! videoscale ! clockoverlay shaded-background=true ! video/x-raw,format=I420,width=1024,height=576,framerate=25/1 ! appsink name=sink");
  }
  numOfClients++;
  console.log("new peer connected");
  console.log(numOfClients,"Clients connected");
  const appsink = pipeline.findChild('sink');
  const source = new RTCVideoSource();
  const track = source.createTrack();
  peerConnection.addTransceiver(track);

在 Firefox 中进行测试时,它实际上效果很好。

但现在的问题是:当我尝试在 chrome 中访问同一个网站时,它不显示视频。视频的 html 标签显然在那里,但它没有被任何帧填充。 在控制台中没有错误或警告消息,所以我不知道问题可能是什么以及如何调试它。有没有人遇到过类似的情况?

我唯一能想到的是将 MediaStreamObject 打印到控制台,它在 Firefox 和 Chromium 中看起来相同(只有填充的值有一个 id 和一个名为 'active' 的布尔值设置为 true、'onaddtrack' 和 ' onremovetrack' 都为 null。Chrome 还打印了两个 firefox 不显示的其他值,它们是 'onactive' 和 'oninactive' 都设置为 null)

  • Chrome 版本:Chromium 80.0.3987.162
  • Firefox 版本:Mozilla Firefox 68.9.0esr

提前致谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)