Open mat100payette opened 4 years ago
Working on debugging the skip.
So far, I see that this line (Howler.js @ _refreshBuffer):
sound._node.bufferSource.buffer = cache[self._src];
(more specifically, cache[self._src]
)
takes ~300ms alone with the large audio file, while smaller audio files only take ~15ms on that.
By duplicating that single line many times, I can make a super fast play-pause sequence skip the audio by any amount of time.
After some testing, here's the patch I have that works for a single sound Howl (won't work with multiple sounds):
Change the following:
sound._node.bufferSource.buffer = cache[self._src];
To this:
sound._node.bufferSource.buffer = Object.values(cache)[0];
The reason why the original cache lookup scales so badly is because the keys of the cache
object are the full byte64 representations of the sounds, so a big audio file will make that key comparison super slow.
If there is a way to make that cache work by some id system, it'd effectively fix this problem completely.
This also seems to be a problem with streaming web radio, at least on some iOS devices. I don't know whether it's exactly the same problem, but it looks like.
I need to work with audio files that are (almost) arbitrarily big. The one I'm using is a mp3 file that is 28 minutes long, and takes 38Mb disk space.
I need high precision and high frequency seeking on the audio for animations.
That being said, when I call
pause()
, it takes about 10ms. However, when resuming usingplay()
, I get a massive skip of about 300ms forward in the audio. I don't know what exactly causes this, but with shorter mp3s I don't get such a big skip. Also, the audio seems late to begin with, but doesnt diverge over time; it just stays offsync even after the skips.When loading the sound as
html5: true
, I get really stuttery seek positions with all sizes of files, which is to be expected from that mode, however I do not get skipping on resuming large files.Is there anything I can do to avoid that skip ?