Skip to content

Instantly share code, notes, and snippets.

@lab101
Created July 5, 2017 10:09
Show Gist options
  • Save lab101/cd21aa15150f1033a2339b6f433642d4 to your computer and use it in GitHub Desktop.
Save lab101/cd21aa15150f1033a2339b6f433642d4 to your computer and use it in GitHub Desktop.
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