Last active
March 16, 2024 09:01
-
-
Save Reqwey/62017d0581ec3aeae885928f19e19030 to your computer and use it in GitHub Desktop.
Type Declaration for DIYgod/DPlayer, generated by GPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'dplayer' { | |
interface DPlayerOptions { | |
container: HTMLElement; | |
autoplay?: boolean; | |
theme?: string; | |
loop?: boolean; | |
lang?: string; | |
screenshot?: boolean; | |
hotkey?: boolean; | |
preload?: string; | |
logo?: string; | |
volume?: number; | |
mutex?: boolean; | |
video: { | |
url: string; | |
pic?: string; | |
thumbnails?: string; | |
type?: string; | |
customType?: { | |
[type: string]: (video: HTMLVideoElement, player: DPlayer) => void; | |
}; | |
}; | |
subtitle?: { | |
url: string; | |
type?: string; | |
fontSize?: string; | |
bottom?: string; | |
color?: string; | |
}; | |
// more options... | |
} | |
interface DPlayerEvents { | |
play?: () => void; | |
pause?: () => void; | |
canplay?: () => void; | |
playing?: () => void; | |
ended?: () => void; | |
error?: () => void; | |
// more events... | |
} | |
class DPlayer { | |
constructor(options: DPlayerOptions); | |
play(): void; | |
pause(): void; | |
seek(time: number): void; | |
volume(percentage: number): void; | |
switchVideo(video: { url: string; type?: string; }, thumbnail?: string): void; | |
on(event: string, handler: () => void): void; | |
off(event: string, handler: () => void): void; | |
destroy(): void; | |
// more methods... | |
} | |
export default DPlayer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment