Playing audio/sound files


Is there a way to play a sound file from a package? I naively tried using the audio html tag, which didn’t seem to work.


I was able to get this working, using the Web Audio API.


Can you explain how you do it?


You can see it in the package I wrote:

There is one problem though. Currently, it seems that only one AudioContext object can be created per window - so there might be issues if multiple packages create their own AudioContexts. Ideally, Atom should manage a singleton AudioContext for all packages to use.