Playing back mp3 in Buffer - onEnded doesn't fire
Closed this issue · 2 comments
drscottlobo commented
Currently using smplr 12.1. I'm playing back a single mp3 file in a buffer per the instructions in the docs, and when the mp3 finishes I need to set "isPlaying" state back to false with onEnded event but it doesn't fire using Sampler to play back an mp3. Can onEnded be added to the Sampler class when playing back from a buffer or perhaps it just needs a fix?
const sampler = new Sampler(ctx, {buffers: {example: 'audio/example.mp3'}}).load
sampler.start({note: 'example'}, {onEnded: () => console.log('ended!))})
Thanks!
danigb commented
If I'm not wrong, it should be:
sampler.start({
note: 'example',
onEnded: () => console.log('ended!),
})
start
only receives one parameter
See: https://github.com/danigb/smplr?tab=readme-ov-file#events
drscottlobo commented
OMG, yes, that was a silly mistake. Totally works fine. Sorry to waste your time danigb!