3 ms·
Would love a blog post explaining how you did it and some of the challenges you had to overcome!
by mxstbr 10y ago
Would love a blog post explaining how you did it and some of the challenges you had to overcome!
- rich_harris 10y agoWe'll definitely be writing about this in the next few days or so. The two biggest hurdles were getting our heads around service workers – which prompted me to write https://gist.github.com/Rich-Harris/fd6c3c73e6e707e312d7c5d7d0f3b2f9 https://gist.github.com/Rich-Harris/fd6c3c73e6e707e312d7c5d7... – and audio. Audio on mobile is just a disaster, because you can't trigger media playback without a user gesture unless you use an AudioBufferSourceNode, which we found can easily crash a phone (because the entire clip has to be decoded and held in memory, and we can have several clips that are several minutes long in playback or standby at any given moment). We created a library called Phonograph to work around these limitations by decoding small snippets of audio on the fly (using the fetch API to stream, where possible): https://gitlab.com/Rich-Harris/phonograph https://gitlab.com/Rich-Harris/phonograph