feat: createImageBitmap

This commit is contained in:
Harvey Zack committed 2024-09-15 10:56:51 +08:00
1 parent 710f9477f8
commit a74e7bbff4
5 files changed
+15 -13

No files matched your search

@@ -207,9 +207,11 @@ function artplayerProxyCanvas() {
}
async function draw() {
try {
const bitmap = await createImageBitmap(video);
ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
bitmap.close();
if (typeof createImageBitmap !== "undefined") {
const bitmap = await createImageBitmap(video);
ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
bitmap.close();
} else ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
art.emit("artplayerProxyCanvas:draw", ctx);
} catch (error) {
art.emit("artplayerProxyCanvas:error", error);