const startRecording = async () => {
        try {
            const { status } = await Audio.getPermissionsAsync();
            if (status !== 'granted') {
                alert('You need to enable permissions in settings');
                return;
            }
            setIsRecordingActive(true);
            await Audio.setAudioModeAsync({
                allowsRecordingIOS: true,
                playsInSilentModeIOS: true,
            });
            const { recording } = await Audio.Recording.createAsync(Audio.RecordingOptionsPresets.HIGH_QUALITY);
            recording?.setProgressUpdateInterval(1000);
            setRecording(recording);
        } catch (error) {
            console.log(error);
            console.log('error');
        }
    }
const stopRecording = async () => {
        try {
            setRecording(null);
            setIsRecordingActive(false);
            await recording.stopAndUnloadAsync();
            await Audio.setAudioModeAsync({
                allowsRecordingIOS: false,
                playsInSilentModeIOS: false,
            });
            const uri = recording.getURI();
            const info = await FileSystem.getInfoAsync(uri);
        } catch (error) {
            console.log(error);
        }
    }
I recently followed this repo link but my code doesn't work I think it's an encoding problem. expo-av create '.m4a' file but it's needs  those
 "pcm" || "ogg-opus" || "flac"
 formats I tried with this also
RecordingOptionsPresets.HIGH_QUALITY = {
  isMeteringEnabled: true,
  android: {
    extension: '.m4a',
    outputFormat: AndroidOutputFormat.MPEG_4,
    audioEncoder: AndroidAudioEncoder.AAC,
    sampleRate: 44100,
    numberOfChannels: 2,
    bitRate: 128000,
  },
  ios: {
    extension: '.m4a',
    outputFormat: IOSOutputFormat.MPEG4AAC,
    audioQuality: IOSAudioQuality.MAX,
    sampleRate: 44100,
    numberOfChannels: 2,
    bitRate: 128000,
    linearPCMBitDepth: 16,
    linearPCMIsBigEndian: false,
    linearPCMIsFloat: false,
  },
  web: {
    mimeType: 'audio/webm',
    bitsPerSecond: 128000,
  },
};
link but nothing working How to solve it? Does anybody have any idea?
my approach for recording is to convert it to uriToBlob and make it a file, and upload it to local storage It is similar to the example code but repo audio worked perfectly and not mine.
 

 
    
Top comments (0)