Closed damngamerz closed 3 years ago
thanks for the input and for the code snippet. i will try to recreate the issue this week and will update this thread with my findings
setAudio is asynchronous, then when you try to access audio.recordDataBase64 in the next line you will find an empty string, this could be the problem.
VoiceRecorder.stopRecording()
.then((result: RecordingData) => setAudio(result.value));
const blob = b64toBlob(
audio.recordDataBase64,
'audio/aac'
);
Im using the plugin to record and now want to use it with native-audio plugin for playing. What I found as a problem? This plugin give base64 string. I found a solution to use it with cordova https://ourcodeworld.com/articles/read/279/how-to-create-an-audio-file-from-a-mp3-base64-string-on-the-device-with-cordova In this given solution we convert it to blob object which in turn taken by cordova FileSystem plugin to write it to a file.
Although to use it with capacitor we need to convert it to string. Because Filesystem Plugin by capacitor accepts a string as data then encodes it with utf-8, utf-16 or ascii to save it. Which can be consumed by native audio.
Implementation.
I'm still getting
Error 00x00
by native-audio. Or am I doing something wrong? How can we achieve this?