Dear All,
To overcome the iOS audio issue, I utilized the “mic-recorder-to-mp3” npm package. This package not only allows for seamless audio recording but also ensures compatibility across various platforms, including iOS.
As this record your microphone audio input and get an audio/mp3
file in the end so there will be no issue related to any file format.
Once you get the blog url, convert that in base64 by using below code:
useEffect(() => {
if (blobURL != null) {
fetch(blobURL)
.then(response => response.arrayBuffer())
.then(arrayBuffer => {
const base64Data = btoa(new Uint8Array(arrayBuffer).reduce((data, byte) => data + String.fromCharCode(byte), ''));
const rawData = `base64,${base64Data}`;
fetchData(rawData);
})
.catch(error => console.error(error));
}
}, [blobURL]);
And then use your transcribe API to return then text from using above base64.
And there will no invalid file format issue in iOS