wavesjs / waves-loaders Goto Github PK
View Code? Open in Web Editor NEWSmall and simple library for audio buffer loading.
Home Page: http://wavesjs.github.io/loaders/
License: BSD 3-Clause "New" or "Revised" License
Small and simple library for audio buffer loading.
Home Page: http://wavesjs.github.io/loaders/
License: BSD 3-Clause "New" or "Revised" License
The error should be clearer, with the filename for example.
This could be achieve using index in map to get the filename.
In tests
instead of progressCallback
So far, we get the individual progress value of each file. That'd be great to also have the global progress value (which is the weighted average of the individual progress values).
At the moment when loading an unsupported audio format the browser returns an error without any explanations, perhaps we can support that in the loader?
here's an example of how one can check the browser's capabilities:
var myAudio = document.createElement('audio');
if (myAudio.canPlayType) {
// Currently canPlayType(type) returns: "", "maybe" or "probably"
var canPlayMp3 = !!myAudio.canPlayType && "" != myAudio.canPlayType('audio/mpeg');
var canPlayOgg = !!myAudio.canPlayType && "" != myAudio.canPlayType('audio/ogg; codecs="vorbis"');
console.log(canPlayMp3, canPlayOgg);
}
myAudioBufferLoader.progressCallback = function(val){
// Do something with the progress value
}
myAudioBufferLoader.load('sound/file/url').then(
function(buffer){
// Do something with the loaded audio buffer
},
function(error){
// Catch an error during the loading or decodeAudioData process
}
);
instead of
AudioBufferLoader.progressCallback = function(val){
// Do something with the progress value
}
AudioBufferLoader.load('sound/file/url').then(
function(buffer){
// Do something with the loaded audio buffer
},
function(error){
// Catch an error during the loading or decodeAudioData process
}
);
test progression or better, extrenalyze this event, nothing to do with promise => out of the scope of the lib !
It's a knows bug/feature: kriskowal/q#30
// We need an audio context to decode the file
// By default, buffer-loader search for audioContext in the window.
var audioContext = new AudioContext();
// Load the file passing the path
var myBufferLoader = createBufferLoader();
myBufferLoader.load('FILE_URL').then(
function(buffer){
// Here we throw an Error
// But without the done function below, the error would have been swallowed
throw new Error('Error');
}
).done(
function(result){
console.log(result); // Here we will get the error
}
);
So, for the moment, the solution to catch programmatic errors is to use done()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.