L. Desjardins
L. Desjardins

Reputation: 1495

WebRTC samples fail on Chrome and Firefox when running locally

When trying out the WebRTC sample where video is streamed to a peer connection:

https://github.com/webrtc/samples/tree/gh-pages/src/content/capture/video-pc

In Firefox, I see only a black video rendered on the right video :-(

In Chrome I encounter a cross-origins error: Uncaught DOMException: Failed to execute 'captureStream' on 'HTMLMediaElement': Cannot capture from element with cross-origin data at HTMLVideoElement.maybeCreateStream

I have made no code changes, I simply cloned the repo and opened the index.html. I also tried serving the pages without luck in seeing the video.

How can I run this sample locally on Windows using either Chrome or Firefox?

Upvotes: 1

Views: 684

Answers (1)

Pallab Gain
Pallab Gain

Reputation: 336

How can I run this sample locally on Windows using either Chrome or Firefox?

The code base contains a server.js file under web_server folder. You can run it locally using nodejs.

  • Make sure you have nodejs, and npm installed.
  • Run npm install from the base directory to install the dependencies.
  • Goto web_server folder, and run the server.js file using node server.js
  • It should start the server, and the sample(s) will be available at
    https://localhost:8080

You should be able to access your demo https://localhost:8080/src/content/capture/video-pc/

The demo runs in my machine. You have not mentioned which browser version you are using. I used Chrome : Version 75.0.3770.100 for testing.

Upvotes: 6

Related Questions