Reputation: 1555
I want to save recorded audio messages of my user in his phone for that I need to access his phone to save the audio in any file from where later I can retrieve back but I have no idea how can I do that? A possible solution I get to see is to store in Firebase storage or AWS bucket and store the URL in the database but I want to store that audio files in the user phone.
async function startRecording() {
try {
console.log("Requesting permissions..");
await Audio.requestPermissionsAsync();
await Audio.setAudioModeAsync({
allowsRecordingIOS: true,
playsInSilentModeIOS: true,
});
console.log("Starting recording..");
const recording = new Audio.Recording();
await recording.prepareToRecordAsync(
Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY
);
await recording.startAsync();
setRecording(recording);
console.log("Recording started");
} catch (err) {
console.error("Failed to start recording", err);
}
}
async function stopRecording() {
console.log("Stopping recording..");
setRecording(undefined);
await recording.stopAndUnloadAsync();
const uri = recording.getURI();
handleStoringFilesInPhone(uri)
console.log("Recording stopped and stored at", uri);
console.error("URI", uri);
}
I want to store the URI getting back from expo audio in the user's phone how can I do that?
Upvotes: 1
Views: 1650
Reputation: 2017
the file is saved in the phone by default. The uri you have is a local uri
Upvotes: 1