更新 VAST 插件文档和类型定义,修复描述和版本号,增强广告播放器功能

This commit is contained in:
Harvey Zack committed 2025-05-30 10:45:31 +08:00
1 parent 19756e8224
commit e773e2c44f
4 files changed
+106 -36

No files matched your search

@@ -1,20 +1,34 @@
import type Artplayer from 'artplayer';
import { Player } from '@glomex/vast-ima-player';
export = artplayerPluginVast;
export as namespace artplayerPluginVast;
type Option = (params: {
declare global {
interface Window {
artplayerPluginVast?: typeof artplayerPluginVast;
}
}
type PlayUrlFn = (url: string) => void;
type PlayResFn = (res: string) => void;
interface VastPluginContext {
art: Artplayer;
id: string;
ima: any;
imaPlayer: any;
$container: HTMLDivElement;
playUrl: (url: string) => void;
playRes: (res: string) => void;
}) => void;
ima: typeof google.ima;
imaPlayer: Player;
playUrl: PlayUrlFn;
playRes: PlayResFn;
container: HTMLDivElement | null;
}
type Result = {
export type ArtplayerPluginVastOption = (params: VastPluginContext) => void | Promise<void>;
export interface ArtplayerPluginVastInstance {
name: 'artplayerPluginVast';
};
destroy?: () => void;
}
declare const artplayerPluginVast: (option: Option) => (art: Artplayer) => Result;
declare function artplayerPluginVast(
option: ArtplayerPluginVastOption,
): (art: Artplayer) => ArtplayerPluginVastInstance;