Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.41k stars 976 forks source link

Using tonejs in a webview component #935

Closed firelex closed 2 years ago

firelex commented 3 years ago

I've got a JS app with a moderately complex ToneJS object - seven instruments (all samplers), couple of FX chains, a single Tone.js sequence.

The thing works like a charm in any mobile browser.

Ditto for a nativescript app on iPhone where tonejs is attached via a webciew component.

On Android, things are getting hairy. While the Chrome version of the app plays the audio without breaking a sweat, the webview throws up glitches almost immediately and stops playing within half a second. It's kind of sad that after 15 years Android webview is still shit, but maybe I'm missing a trick. Is this a known issue with a known workaround?

Thanks!

Specy commented 3 years ago

This doesnt really fix the issue but you can try looking into TWA (trusted web activity), its a more advanced version of webview.

Your website needs to be PWA and then you can feed it into https://www.pwabuilder.com/ to create the .apk and .aab

firelex commented 3 years ago

Thanks. We'll try that. I should have an update this week - will leave the issue open until then so I can close with comment.