Wizcorp / AudioManager

play sounds using Web Audio, fallback on HTML5 Audio
11 stars 5 forks source link

Remove wizAssets dependency #10

Closed cstoquer closed 9 years ago

cstoquer commented 9 years ago

Removed wizAssets dependency from AudioManager. Instead, a custom loader function can be specified in settings.getFileUri

Add the following code to use wizAssets as loader:

if (window.wizAssets) {
    audioManager.settings.getFileUri = function wizAssetsGetUri(audioPath, id, cb) {
        window.wizAssets.downloadFile(audioPath + id + '.mp3', 'audio/' + id + '.mp3', 
            function onSuccess(uri) {
                cb(null, uri)
            }, 
            cb // onFail callback
        );
    }
}
cstoquer commented 9 years ago

updated

ronkorving commented 9 years ago

I would've totally dropped the check, but you gotta do what you gotta do :) Go for it and merge this please.