You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to modify the onComplete function to accept a third argument and return the file object or make it available?
At the moment I'm not sure how I can relate the generated waveform with the file it was created for.
for (var i = 0; i < tracks.files.length; i++) {
var track = tracks.files[i];
track.id = i;
// Generate waveforms
SoundCloudWaveform.generate(track, {
onComplete: function(png, pixels) {
var id = track.id; // Returns the final value of i, not the current iteration
var canvas = document.createElement('canvas');
canvas.setAttribute('id', 'canvas' + id);
document.getElementById('track' + id).appendChild(canvas);
canvas.setAttribute('class', 'waveform');
var context = canvas.getContext('2d');
context.putImageData(pixels, 0, 0);
}
}
}
The text was updated successfully, but these errors were encountered:
Is it possible to modify the onComplete function to accept a third argument and return the file object or make it available?
At the moment I'm not sure how I can relate the generated waveform with the file it was created for.
The text was updated successfully, but these errors were encountered: