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.44k stars 835 forks source link

Cant play on startup #292

Closed Cpin0312 closed 6 years ago

Cpin0312 commented 6 years ago

i have using soundjs when startup my game but it is not able to play. but,when i can play the other sound when triggered by mouse event and other. is it just a setting problem? html didnt show any error.

lannymcnie commented 6 years ago

WebAudio requires a user event to unlock the audio context on mobile devices. Until you cause that user event, audio will not play.

SoundJS listens for user events (specific touch events mainly) and unlocks the context for you. On mobile, it is a good idea to show some sort of "click to start" interaction. You don't have to do anything other than ensure that interaction happens before playing audio.