Hey im trying to create a callback function that will update an atomic<float> that will will reference the percentage of the upload, but the callback is never being called:
url = url.withFileToUpload("file", userAudioFile, "audio/wav")
.withParameter("token", token)
.withParameter("bpm", String(globalVars.getBpm()))
.withParameter("genre", globalVars.getGenere());
DBG("API URL: " + url.toString(true));
// Create input stream with progress tracking
auto progressCallback = [&globalVars](int bytesSent, int totalBytes) {
DBG("Bytes sent: " + String(bytesSent) + " Total bytes: " + String(totalBytes));
//this is never printed
if (totalBytes > 0)
{
float progress = static_cast<float>(bytesSent) / totalBytes;
DBG("Raw progress: " + String(progress));
globalVars.setUploadProgress(progress);
}
return true;
};
URL::InputStreamOptions options(URL::ParameterHandling::inPostData);
options.withProgressCallback(progressCallback);
