Tilen
Tilen

Reputation: 337

EXPO : Export Filesystem to file ,into android folder

Good morning , Actually i'm working on this recorder .

https://snack.expo.io/@riwu/audio-recorder

How to save the file to device’s folder like download?

Thanks

async _stopRecordingAndEnablePlayback() {
        this.setState({
            isLoading: true,
        });
        try {
            await this.recording.stopAndUnloadAsync();
        } catch (error) {
            // Do nothing -- we are already unloaded.
        }
        const info = await FileSystem.getInfoAsync(this.recording.getURI());

        console.log(`FILE INFO: ${JSON.stringify(info)}`);

        await Audio.setAudioModeAsync({
            allowsRecordingIOS: false,
            interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
            playsInSilentModeIOS: true,
            playsInSilentLockedModeIOS: true,
            shouldDuckAndroid: true,
            interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
            playThroughEarpieceAndroid: false,
            staysActiveInBackground: true,
        });


Upvotes: 0

Views: 1125

Answers (1)

Tilen
Tilen

Reputation: 337

Added this. And it Work !!!!

    takePictureAndCreateAlbum = async () => {

        const asset = await MediaLibrary.createAssetAsync(this.recording.getURI());
        MediaLibrary.createAlbumAsync('Expo', asset)
          .then(() => {
            console.log('Album created!');
          })
          .catch(error => {
            console.log('err', error);
          });
      }

Thank you very much !

Upvotes: 1

Related Questions