-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play music using a Web Worker #105
Comments
@devongovett experimented with worker processing at some point, but IIRC it didn't improve the user experience too much because of the current design of the Web Audio API. I think worker processing should be revisited once the new AudioWorker functionality of the Web Audio API becomes more finalized and there's an implementation to test against (especially considering that the ScriptProcessorNode has been deprecated so the current approach has to be redone anyway). |
Yeah, basically we can do the decoding in a worker but we'd have to send all the buffers back to the main thread for actual audio output to your speakers via the web audio api. When I tried it a couple years ago, this overhead actually resulted in things being slower, even with transferrable objects. Things might have changed now, but as @jussi-kalliokoski said, we were basically waiting for audio workers. 😦 |
It would be nice to be able to decode an Asset inside a worker, and pass the entire data to the main thread when it is fully loaded. |
Try this: https://github.com/brion/ogv.js/ (it is a fork of this project that makes it into a proper audio/video player) It has support for workers (it does decoding/demuxing with them). |
@nampdn sure with pleasure. if you want to improve the worker support there by using |
OK. so ogv.js uses workers to do the decoding, and that works very well. But it doesn't have MP3 support in there afaics because that project is about supporting "open" codec support - so no patent/license issues. Why do you want to use aurora to decode MP3 anyway? Any specific reason why you can't use MediaSource or WebAudio for your purpose? |
OK cool. Sounds like you could use I think we are working on very similar problems. Chrome can play MP3 downloaded chunks directly via that API (given that you decrypt them). In Firefox you need to re-pack it into fMP4 before. To do the parsing of MP3, decryption and re-packing I am working on this currently. It's a pipelining framework that does exactly that. Take a look at the example in the README: https://github.com/tchakabam/multimedia.js |
You might also be able decode the MP3 with WebAudio btw :) What you use as a backend doesn't really matter - but you should be aware that browser have MP3 decoding capabilities already - your problem is just the parsing and eventual transmuxing. Also shipping an MP3 decoder like Aurora with you app witll get you into licensing/patent issues - you 'd have to use an open codec like OGG or OPUS ;) |
Is there any news on the WebWorker stuff? Especially since it seems AudioWorkers won't be available to a large public before long =( Would it be of any interest to improve performance? In particular, the demo of ogv.j seems to actually suffer the same performance issues as Aurora.JS, with lagging when performing other actions in the browser (although it may not be directly comparable as it is decoding video, which is more difficult than audio in Aurora). |
In my fork I has implemented WebWorker for Opus codec: https://github.com/Kukunin/aurora.js and https://github.com/Kukunin/opus.js. The main change in Aurora.js is that decoder can return a promise instead of buffer, and it's up to a decoder to implement web worker decoding |
Hello;
Is it possible to play music with Aurora.js through a Web Worker?
I'm facing some sound problems when listening to a music and doing something else like reading my mails on a new tab. This happens specially on Firefox. This way launching music with a web worker could solve this issue.
Thanks all for helping me;
The text was updated successfully, but these errors were encountered: