CreateJS / SoundJS

A Javascript library for working with Audio. It provides a consistent API for loading and playing audio on different browsers and devices. Currently supports WebAudio, HTML5 Audio, Cordova / PhoneGap, and a Flash fallback.
http://createjs.com/
MIT License
4.42k stars 838 forks source link

emit an event for the context changing from "suspended" to "running" #282

Open jeremyml opened 6 years ago

jeremyml commented 6 years ago

It would be great to emit an event for the context changing from "suspended" to "running". That way I can know if I can start playing sounds to the user on iOS.

Currently I simply monitor the same events _unlock() uses, but it would be cleaner to trigger from a SoundJS event.

document.addEventListener("mousedown", runAudio, true);
document.addEventListener("touchend", runAudio, true);