CanvasCaptureMediaStreamTrack:canvas 属性

canvasCanvasCaptureMediaStreamTrack 接口的只读属性,它返回正在捕获帧的 HTMLCanvasElement

一个 HTMLCanvasElement,指示画布,它是正在捕获的帧的来源。

示例

js
// Find the canvas element to capture
const canvasElt = document.querySelector("canvas");

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

// Do things to the stream
// …

// Obtain the canvas associated with the stream
const canvas = stream.canvas;

规范

规范
来自 DOM 元素的媒体捕获
# dom-canvascapturemediastreamtrack-canvas

浏览器兼容性

BCD 表格仅在启用 JavaScript 的浏览器中加载。

另请参阅