get the accesstoken (to add in my POST header to upload the prompt)
get the uploadUri from the prompt resource
I'm recording the prompt in my app using:
device = navigator.mediaDevices.getUserMedia({audio:true});
device.then(stream => {
recorder = new MediaRecorder(stream);
recorder.ondataavailable = e => {
chunks.push(e.data);
if (recorder.state == 'inactive'){
blob = new Blob(chunks, { type: 'audio/wav' });
audioURL = URL.createObjectURL(blob);
document.getElementById('audio').innerHTML = '';
}
}
recorder.start(1000);
});
My POST method for updating the prompt returns a 200 OK, but the prompt is not updated. Waht am I missing?
My method to upload the prompt:
let formData = new FormData();
let req = new XMLHttpRequest();
formData.append('file', blob);
req.open("POST", uploadUri);
req.setRequestHeader('Authorization', 'bearer '+ accesstoken);
req.send(formData);