This question is about javascript on the browser side.
I am receiving chunks with audio in base64 format. Every chunk is up to 750 kB. When I wait and merge chunks in one the audio file plays well.
Can I start to play audio without waiting for all chunks to load?
This code is downloading the whole audio and playing it (works properly):
let after = ''
let hasNextPage = true;
let base64 = ''
while(hasNextPage){
let chunk = await downloadChunk(fileId, after)
base64 += chunk.base64
after = chunk.after
hasNextPage = chunk.hasNextPage
// break
}
const audio = new Audio()
audio.src = base64
audio.play()