mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
feat: update artplayerProxyCanvas to accept a callback for custom rendering options
This commit is contained in:
1 parent
92654e911f
commit
1605df2943
4 files changed
+10
-4
No files matched your search
@@ -1,4 +1,4 @@
|
||||
export default function artplayerProxyCanvas() {
|
||||
export default function artplayerProxyCanvas(callback) {
|
||||
return (art) => {
|
||||
const { constructor } = art;
|
||||
const { createElement } = constructor.utils;
|
||||
@@ -66,6 +66,7 @@ export default function artplayerProxyCanvas() {
|
||||
} else {
|
||||
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
callback && callback(ctx, video);
|
||||
art.emit('artplayerProxyCanvas:draw', ctx, video);
|
||||
} catch (error) {
|
||||
art.emit('artplayerProxyCanvas:error', error);
|
||||
|
||||
@@ -3,4 +3,8 @@ import type Artplayer from 'artplayer';
|
||||
export = artplayerProxyCanvas;
|
||||
export as namespace artplayerProxyCanvas;
|
||||
|
||||
declare const artplayerProxyCanvas: () => (art: Artplayer) => HTMLCanvasElement;
|
||||
type Option = (ctx: CanvasRenderingContext2D, video: HTMLVideoElement) => void;
|
||||
|
||||
type Result = HTMLCanvasElement;
|
||||
|
||||
declare const artplayerProxyCanvas: (option: Option) => (art: Artplayer) => Result;
|
||||
Reference in new issue
Block a user