import type FirePlayer from 'fireplayer'

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: 'fireplayerPluginAudioTrack'
  /**
   * The audio element
   */
  audio: HTMLAudioElement

  /**
   * Update option
   */
  update: (option: Option) => void
}

declare const fireplayerPluginAudioTrack: (option: Option) => (fire: FirePlayer) => Result

export default fireplayerPluginAudioTrack
