WebRTC samples Stream from canvas to peer connection

Due to autoplay policy the video seems not to be playing. Clicking the left teapot usually resolves this.

Click and drag on the canvas element (on the left) to move the teapot.

This demo requires Firefox 47 or Chrome 52 (or later).

The teapot is drawn on the canvas element using WebGL. A stream is captured from the canvas using its captureStream() method and streamed via a peer connection to the video element on the right.

View the browser console to see logging.

Several variables are in global scope, so you can inspect them from the console: canvas, video, localPeerConnection, remotePeerConnection and stream.

For more demos and information about captureStream(), see Media Capture from Canvas Implementation.

For more information about RTCPeerConnection, see Getting Started With WebRTC.

View source on GitHub