W3cubDocs

/DOM

CanvasCaptureMediaStream.canvas

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The CanvasCaptureMediaStream.canvas read-only property returns the HTMLCanvasElement associated with the stream.

Syntax

var elt = stream.canvas;

Example

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

Specifications

Specification Status Comment
Media Capture from DOM Elements
The definition of 'HTMLCanvasElement' in that specification.
Editor's Draft Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support Not supported 41 (41)[1] Not supported Not supported Not supported
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support Not supported 41.0 (41)[1] Not supported Not supported Not supported

[1] Disabled by default; set the preference canvas.capturestream.enabled to true to activate.

See also

© 2005–2017 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/CanvasCaptureMediaStream/canvas