Open
Description
The loadSound()
function's callbacks (success, error, and whileLoading) aren't being triggered as expected in the p5.sound prerelease. This prevents handling events during the loading process and confirming a successful or failed load.
Function Signature
loadSound(path, [successCallback], [errorCallback], [whileLoading])
Example
let player;
function preload() {
player = loadSound(
'https://tonejs.github.io/audio/berklee/gong_1.mp3',
() => { console.log("success"); }, // Success callback
() => { console.log("failure"); }, // Error callback
(progress) => { console.log(`Loading: ${progress * 100}%`); } // While loading callback
);
}
function setup() {
createCanvas(100, 100);
background(220);
}
function mousePressed() {
player.play();
}
Expected Behavior
- The whileLoading callback should print the loading progress percentage.
- The callback should print "success" to the console when the sound is loaded.
Actual Behavior
- The whileLoading callback isn't triggered, and loading progress isn't shown.
- The callback isn't triggered, and "success" isn't printed.
Metadata
Assignees
Labels
No labels