CanvasCaptureMediaStream.requestFrame()

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.requestFrame() method forces a frame to be captured and sent to the stream. This allows to capture partially rendered frames.

Syntax

stream.requestFrame();

Example

// Find the canvas element to capture
var canvasElt = document.getElementsByTagName("canvas")[0];

// Get the stream
var stream = canvasElt.captureStream(25); // 25 FPS

// Send the current state of the canvas as a frame to the stream
stream.requestFrame();

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 41 (41)[1] NotĀ supported ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ?[1] 34.0 (34) NotĀ supported ? ?

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

See also

Document Tags and Contributors

 Contributors to this page: Sebastianz, tstrokes, teoli
 Last updated by: Sebastianz,