Created
July 5, 2017 10:09
-
-
Save lab101/cd21aa15150f1033a2339b6f433642d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
THREE.HowlerLoader = function(manager){ | |
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; | |
}; | |
THREE.HowlerLoader.prototype = { | |
constructor: THREE.HowlerLoader, | |
load: function(url, onLoad, onProgress, onError){ | |
var scope = this; | |
scope.manager.itemStart( url ); | |
var sound = new Howl({ | |
src: [url], | |
onloaderror : function(){ | |
scope.manager.itemError( url ); | |
} | |
}); | |
sound.once('load', function(){ | |
scope.manager.itemEnd( url ); | |
onLoad(sound); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment