Closed jdgarvey closed 1 year ago
Over a year old but thought I would answer this thread.
The current version of the code does not require saving to temp directory.
Consider
const recordResult = await VoiceRecorder.stopRecording();
const recordData = result.value.recordDataBase64;
This gives you the base64 data.
From there you can play it with:
const audioRef = new Audio(`data:audio/aac;base64,${base64Sound}`);
audioRef.oncanplaythrough = () => audioRef.play();
audioRef.load();`
No need to save locally.
So the problem is actually in the swift plugin code itself, particularly https://github.com/tchvu3/capacitor-voice-recorder/blob/master/ios/Plugin/CustomMediaRecorder.swift#L29
From what I gather, it is actually creating a file on the system, recording to it, THEN streaming that file as base64.
However, I am not on this project anymore so if someone wants to close that's ok :D
Hello! We're doing a POC that has a special restriction on recorded audio: the audio cannot be saved to the device. Wanted to see how hard it would be to add an option for returning the raw recording data as base64 or a data URL instead of saving it to the device temp directory. Here's how the official Capacitor camera plugin handles this for reference. Thanks!
https://github.com/ionic-team/capacitor-plugins/blob/main/camera/ios/Plugin/CameraPlugin.swift#L263