synesthesia icon indicating copy to clipboard operation
synesthesia copied to clipboard

PreciseAudio queue stopping randomly after the end of a track.

Open ErnestoArtigas opened this issue 4 years ago • 0 comments

I'm trying to make an audio player and I'm using Precise Audio as the audio interface for a javascript code. It's using node and express to route the application, take files from a folder and pass to the updateTracks function :

const audio = new PreciseAudio();
// Array of all music files.
let sources = <%- JSON.stringify(audioSources) %>;
// Using the ... operator to split every element for the updateTracks function.
audio.updateTracks(...sources);

// A button was created in the html page so I'm just calling it with a querySelector
let button = document.querySelector("#play");
button.onclick = (event) => {
    audio.play();
}

The audio begins fine, but usually when i'm not active on the webpage it just stops and the end of the current tracks. Pushing the play button just continues the queue without any problems and printing the audio.trackStates() shows that it knows when to download the next track.

(19) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {src: "/audio/08 - Welcome To The Machine.flac", state: "ready", mode: "full"}
1: {src: "/audio/09 - Déjà Vu.flac", state: "download-scheduled", downloadingAt: 1844590.746666666}
2: {src: "/audio/10 - The Last Refugee.flac", state: "none"}
3: {src: "/audio/11 - Picture That.flac", state: "none"}
...

Is it a limitation of the audio backend, not being able to load all the music files because they are too large for the specifications ?

Hope it was clear, as my first real project working with audio api I'm lost. Thank you by advance !

ErnestoArtigas avatar Mar 27 '21 01:03 ErnestoArtigas