Hi
I am trying to record audio and upload it to genesys
when i try to send blob file in formData i am getting 200Ok but audio is not getting reflected
based on this https://developer.genesys.cloud/forum/t/upload-prompt-audio/10851 link we need to record audio in wav format, I tried recording in wav format but still facing same issue
const handleStartRecording = () => {
setBlobUrl("")
console.log("entered start")
navigator.mediaDevices.getUserMedia({ audio: {sampleRate:11025} })
.then((stream) => {
mediaChunksRef.current = [];
mediaRecorderRef.current = new MediaRecorder(stream,{audioBitsPerSecond: 16000});
//mediaRecorderRef.current.addEventListener('dataavailable', handleDataAvailable);
mediaRecorderRef.current.ondataavailable = handleDataAvailable;
let date,time
mediaRecorderRef.current.onstart=()=>{
date = new Date()
time = date.getTime()
console.log(typeof(time))
setDuration(time)
}
mediaRecorderRef.current.onstop = handleRecordingStop;
mediaRecorderRef.current.start();
setRecording(true);
})
.catch((error) => {
console.error('Error accessing microphone:', error);
});
};
const handleRecordingStop = () => {
if (mediaChunksRef.current.length > 0) {
const audioBlob = new Blob(mediaChunksRef.current, { type: 'audio/wav' });
const downloadUrl = URL.createObjectURL(audioBlob);
console.log(audioBlob.type)
// Calculate duration using recorded start time and current time
setBlobUrl(downloadUrl);
}
setRecording(false);
};
how to upload the audio to genesys?