Description
Thanks for Soundjs. and Createjs in general, I really like them. This is my issue: when users turn off their phone, my nice animated website goes on playing music and effects. That is ok if I have a way to pause them.
There should be a way to pause all sounds and restart them without knowing which sounds are playing, which are looping, what volume, at what point in time, etc.. for situations like when the main window goes off view or device is locked (standby button).
$(window).focus(function() {
createjs.Sound.pauseAllSounds();
}).blur(function() {
createjs.Sound.resumeAllSounds();
});
The problem is I don't have knowledge of what sounds are currently playing and what needs to be looping, and tracks volume, so if I just stop() how can I resume a situation similar to the one before the pause?
I have a list of all instances played since site startup. Maybe I could iterate all sound instances that have been started and, for each one, test if it is playing and if it is looping, maybe its position, and save all that info. Then stop() all sounds. Or pause them one by one. At resume, collect all sounds information and for each one issue a play (or remove paused state).
This sounds a bit complicated and more like it should be part of the library.