The CanvasCaptureMediaStreamTrack canvas read-only property returns the HTMLCanvasElement from which frames are being captured.
var elt = stream.canvas;
An HTMLCanvasElement indicating the canvas which is the source of the frames being captured.
// Find the canvas element to capture
var canvasElt = document.getElementsByTagName("canvas")[0];
// Get the stream
var stream = canvasElt.captureStream(25); // 25 FPS
// Do things to the stream
...
// Obtain the canvas associated with the stream
var canvas = stream.canvas;
| Specification | Status | Comment |
|---|---|---|
| Media Capture from DOM Elements The definition of 'CanvasCaptureMediaStreamTrack.canvas' in that specification. | Working Draft | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | No | ? | 41
|
No | No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | No | No | ? | 41
|
No | No | No |
HTMLCanvasElement.captureStream() to create a stream to capture a given canvas element.<canvas>
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CanvasCaptureMediaStreamTrack/canvas