Skip to main content

Methods

note

All Canvas methods are available in this class.

render

Pre-renders the media resource onto the canvas.
For video elements, this renders the current frame.
This method is called automatically after initialization and resize.

const canvas = new CanvasMedia({
container: document.getElementById("container"),
media: document.querySelector("img"),
append: true,
});

canvas.render();

destroy

Destroys the instance and cleans up resources.

canvas.destroy();