Skip to content

seeking on uncached tracks is broken #81

@JPGuillemin

Description

@JPGuillemin

Tracks have to be cached to be able to seek.

I think it "could" be related to race condition between audio.play() and metadata fecthing.

Here's some ideas , maybe :

  private async ensureDuration(audio: HTMLAudioElement, retries = 20, delay = 100) {
    for (let i = 0; i < retries; i++) {
      if (audio.duration && audio.duration !== Infinity && !isNaN(audio.duration)) {
        this.ondurationchange(audio.duration)
        return
      }
      await sleep(delay)
    }
    console.warn('AudioController: failed to resolve duration for', audio.src)
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions