0

I am new HTML5 developer, am using soundjs library for play audio in html5 web application. But soundjs is not able play sound in iPad1, Window Phone and some of android mobile. It seem to be not initialized audio plugin, that's hwy his not able to load file and dispatch complete event. Using code is (soundjs library import in script tag) :

                    if (!createjs.Sound.initializeDefaultPlugins())
                    {
                        alert("return")
                        return;
                    }

                    var audioPath = "assets/audio/";
                    var manifest = [
                        {id:"Music", src:audioPath+"waterSplash.mp3|"+audioPath+"waterSplash.ogg"},
                        {id:"Thunder", src:audioPath + "ohh.mp3|"+audioPath + "ohh.ogg"}
                    ];

                    this.displayMessage.innerHTML = "loading audio";
                    //var loadProxy = createjs.proxy(this.handleLoad, this);
                    createjs.Sound.addEventListener("loadComplete", createjs.proxy(this.handleLoad, this));
                    createjs.Sound.registerManifest(manifest);


                    function handleLoad(data)
                    {
                       createjs.Sound.play("Music");
                       this.displayMessage.innerHTML = "Playing " + event.src;
                    }

In iPad1 and Window Phone, it retrun from this case "createjs.Sound.initializeDefaultPlugins()".

Please help me or suggest any other library which has work in all mobile and system browser.

Thanks....!

Harry
  • 3
  • 3

1 Answers1

2

You may want to review the SoundJS FAQ and the known browser limitations in the documentation. SoundJS is not supported in iOS versions less than 6 by default because of extreme limitations in html audio functionality. You can enable audio in older iOS, but it is not recommended. Audio works to varying degrees in Android phones. Windows Phone has not be directly tested, but I would expect newer phones to work. Also note that audio on mobile devices generally requires a user initiated event (touch) to begin playback.

You may find the SoundJS mobile safe tutorial useful.

Hope that helps

OJay
  • 1,249
  • 7
  • 14
  • Ojay, You know any other sound library which has work in all browser included mobile ?? – Harry Aug 08 '13 at 10:25
  • 1
    I am not aware of other libraries that can do everything SoundJS can do. SoundJS is awesome, although I may be biased because I work on it. :) The problem is mobile browsers do not always implement html 5 standards for audio, or they force limitations on them. This has been improving with the adoption of Web Audio, which is currently in Chrome beta and already on iOS 6+ and is planed for firefox. – OJay Aug 08 '13 at 15:41
  • Okey, SoundJS is superb, I am using it and it's playing multiple channel on iPhone 4, 5 and Ipad3 but in other mobile(android played only one channel at a time. And no any sound in Latest Window phone ) :( . Let see. Alright, thanks for given right suggestion. – Harry Aug 09 '13 at 06:45