Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

html - NodeWebRTC Videostream not displaying in chrome

I have been getting familiar with webRTC for videostreaming. My goal was to display a videostream by gstreamer in a browser while still having a low latency.

I am using nodewebrtc for this and tried out the example from there github repo here. So far I have tested it with this code and only exchanged some code at the start with a gstreamer pipeline, like so:

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

It actually worked great like this when testing it in Firefox.

But here is the problem now: when I try to visit the same site in chrome it doesn't display the video. The html tag for the video obviously is there but it doesn't get filled with any frames. In the console there is no error or warning message so I don't know what the problem could be and how to debug it. Has anyone experienced something similar?

The only thing I could think of was printing the MediaStreamObject to the console and it looks the same in firefox and chromium (only values filled there are an id and a boolean named 'active' set to true, 'onaddtrack' and 'onremovetrack' are both null. Chrome also prints two other values which firefox doesn't display which are 'onactive' and 'oninactive' both set to null)

  • Chrome version: Chromium 80.0.3987.162
  • Firefox version: Mozilla Firefox 68.9.0esr

Thanks in advance!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...