callback is not a function
shell1986 opened this issue · 4 comments
Hello everyone.
Thanks for such a useful development.
After installing the latest version and initializing the script, an error appears in the console that it does not exist is not a function.
In my case, it is callback(null, instance), which reports that the application is ready, but judging by the code, this function is responsible for reporting errors.
It would be great if you fixed this error.
Thank you :-) To help figure out what's going wrong, can you share the code you've written?
Yes
fetch('/ajax.php?getPeaks='+sid)
.then(response => {
return response.json();
})
.then(fdata => {
if (fdata.success) {
(function(Peaks) {
pks = Peaks.init({
container: document.getElementById('waveform-container'),
mediaElement: document.getElementById('video'),
playheadColor: '#fff',
playheadWidth: 3,
showAxisLabels:false,
showPlayheadTime: false,
axisTopMarkerHeight: 1,
axisBottomMarkerHeight: 1,
zoomLevels: [ 2048, 4096],
dataUri: {
arraybuffer: fdata.success
},
});
pks.on('peaks.ready', function() {
outputer(assArr[evid]);
});
})(peaks);
}
})
I first load the generated peak file and then initialize the script.
There needs to be a check that the callback is valid. But in the documentation we say peaks.ready
is deprecated, so I would recommend that you provide a callback to Peaks.init()
. The peaks.ready
event won't fire if there are any initialisation errors.
Thank you very much for the explanation.