3

I have an webGL canvas rendering an 3D hologram image using Three.js and I want to stream it as a video to another pc.

I already tried the code below and didn't work.

  var gl = renderer.getContext();       //get webGl context 
  var canvas = gl.canvas;               //get gl's canvas 

  var video = document.querySelector('video');
  var stream = canvas.captureStream();
  video.srcObject = stream;

Is it possible to stream and webGl canvas with WebRTC?

1 Answer 1

3

this is not yet fully supported in Chrome (Firefox should work since 43), you need "Experimental Web Platform features" in chrome://flags. See this demo for a classical teapot example.

2
  • Exactly. I based my code my on this teapot without the peer connection link here. I don't know if I have to do more than that, but on the main.js it only has the code that I wrote and an call for the main method of demo.js, which I don't undestand what it does.
    – Patricia
    Commented May 22, 2016 at 18:21
  • Oh my god! My code works just fine.For some reason the video was beeing place underneath the canvas, so I was thinking that it was not working. Thanks for trying to help.
    – Patricia
    Commented May 22, 2016 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.