mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
feat: createImageBitmap
This commit is contained in:
1 parent
710f9477f8
commit
a74e7bbff4
5 files changed
+15
-13
No files matched your search
@@ -63,9 +63,13 @@ export default 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);
|
||||
|
||||
@@ -3,8 +3,4 @@ import type Artplayer from 'artplayer';
|
||||
export = artplayerProxyCanvas;
|
||||
export as namespace artplayerProxyCanvas;
|
||||
|
||||
type Option = (video: HTMLVideoElement, url: String, art: Artplayer) => void;
|
||||
|
||||
type Result = HTMLCanvasElement;
|
||||
|
||||
declare const artplayerProxyCanvas: (option: Option) => (art: Artplayer) => Result;
|
||||
declare const artplayerProxyCanvas: () => (art: Artplayer) => HTMLCanvasElement;
|
||||
Reference in new issue
Block a user