2

I use soundJS that works great, but when register the CordovaAudioPlugin I have problems with the path and/or safety! :(

Paths

  • Web / Ripple - disable the plugin to work
  • Android - "file:///android_asset/www/" then work fine
  • IOS - try "http://localhost:12344" (WKWebView) and cordova.file.dataDirectory but don't work, the event "fileload" never fire and don't have any execption. If I use the plugin directly without using soundJS work fine.

How to implement soundJS and Cordova Audio Plugin in IOS?

For better performance on iOS we use the WKWebView: https://github.com/Telerik-Verified-Plugins/WKWebView

Code:

createjs.Sound.registerPlugins([createjs.CordovaAudioPlugin]); 
createjs.Sound.alternateExtensions = ["mp3"];
createjs.Sound.on("fileload", this.loadHandler, this);
createjs.Sound.registerSound("path/to/mySound.mp3", "sound");
function loadHandler(event) {
    var instance = createjs.Sound.play("sound");
}

We use "cordovaaudioplugin-0.6.1.min.js" and "soundjs-NEXT.min.js"

p3c
  • 133
  • 7

0 Answers0