How do I upload recorded audio to a server?

Please provide the following:

  1. SDK Version: Expo version 4.6.0
  2. Platforms(Android/iOS/web/all): Android & iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I start and stop my recordings like so:

async componentDidMount() {


            allowsRecordingIOS: true,

            interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,

            interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,

            shouldDuckAndroid: true,

            staysActiveInBackground: true,

            playsInSilentModeIOS: true,



    async startRecordingButtonPressed() {

        if (!recording) {

            recording = new Audio.Recording();


        let permissions = await Audio.requestPermissionsAsync();

        if (permissions.granted) {

            await recording.prepareToRecordAsync(Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY);

            await recording.startAsync();

            this.setState({ isRecording: true });


        else {

            throw new Error('Permissions not granted.');



    async stopRecording() {

        await recording.stopAndUnloadAsync();

        this.setState({ isRecording: false, recordingFinished: true });

        recordingURI = recording.getURI();

        if (recordingURI === "" || recordingURI === null || recordingURI === undefined) {

            throw new Error("Whoops! Didn't get that audio.");


        const { sound, status } = await recording.createNewLoadedSoundAsync();

        sound.setOnPlaybackStatusUpdate(x => {

            if (x.didJustFinish)



        if (!sound)

            throw new Error("Whoops!");

        this.sound = sound;



After recording, I get a valid URI. Currently, I pass this URI into a FormData object and submit that FormData object to a server. Is this how you’re supposed to do it?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.