mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
- Implemented the audio track plugin for ArtPlayer, allowing audio to be synchronized with video playback. - Added main functionality in `src/index.js` to handle audio playback, synchronization, and event listeners for play, pause, seek, and volume changes. - Created TypeScript definitions for the plugin in `types/artplayer-plugin-audio-track.d.ts`. - Included necessary build files in `dist/` for various module formats (CommonJS, ES Module, and legacy). - Updated package metadata in `package.json` and added a README for documentation. - Added `.npmignore` to exclude unnecessary files from the package.
35 lines
693 B
TypeScript
35 lines
693 B
TypeScript
interface Option {
|
|
/**
|
|
* Audio track URL
|
|
*/
|
|
url: string
|
|
|
|
/**
|
|
* Time offset in seconds between video and audio
|
|
* Positive value means audio plays ahead of video
|
|
* Negative value means audio plays behind video
|
|
* @default 0
|
|
*/
|
|
offset?: number
|
|
|
|
/**
|
|
* Synchronization threshold in seconds
|
|
* @default 0.3
|
|
*/
|
|
sync?: number
|
|
}
|
|
|
|
interface Result {
|
|
name: 'artplayerPluginAudioTrack'
|
|
/**
|
|
* The audio element
|
|
*/
|
|
audio: HTMLAudioElement
|
|
}
|
|
|
|
declare const artplayerPluginAudioTrack: (option: Option) => (art: Artplayer) => Result
|
|
|
|
export default artplayerPluginAudioTrack
|
|
|
|
export = artplayerPluginAudioTrack;
|
|
export as namespace artplayerPluginAudioTrack; |