jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 537 forks source link

where is file storing how can i see my aac file #234

Open rizwan92 opened 6 years ago

rizwan92 commented 6 years ago

"react": "16.2.0", "react-native": "0.53.0", "react-native-audio": "^3.6.0", "react-native-sound": "^0.10.5"

i am on android where is my .aac file storing ? , how can i get link of my record file ?, how much file can i record ? , is it possible to directly save audio file to s3 bucket , can i change the path of recorded file ? help me thanks is advance

Biplovkumar commented 6 years ago

1.where is my .aac file storing ?

in enternal in android in data in project name. 2.how can i get link of my record file ? u can print ur audio store path in log. give path name in android and u can get ur file.

3.how much file can i record ?

approx cache memory.

4.can i change the path of recorded file ?

yup, u need to change AudioUtils.documentDirectoryPath to MusicDirectory path and u can store it in ur internal music folder then u store audio more than cache .

sorry if language problem. but really it works fine.

rizwan92 commented 6 years ago

i want to store file inside my /internal storage/music/ so this library can store test.aac file inside this directory ?

i want to upload my record file to server for this i need uri of my audio file but this recording is saving on chache memory i dont know how to upload this test.aac file to the server, so i though first i need to store this file to my local directory and then upload it my server , so please tell me is it a good way or not if its can this library solve my problem

Biplovkumar commented 6 years ago

1.i want to store file inside my /internal storage/music/ so this library can store test.aac file inside this directory ? ans:- //this is for /internal storage/music/test.aac

state = { currentTime: 0.0, recording: false, stoppedRecording: false, finished: false, audioPath: AudioUtils.MusicDirectoryPath + '/test.aac', hasPermission: undefined, };

prepareRecordingPath(audioPath){
  AudioRecorder.prepareRecordingAtPath(audioPath, {
    SampleRate: 22050,
    Channels: 1,
    AudioQuality: "Low",
    AudioEncoding: "aac",
    AudioEncodingBitRate: 32000
  });
}

2.if u send on server from cache really it is more fasty but it is not safe and not we use again that data. so i always need to store this file to my local directory and then upload it my server but it take more time than cache audio but it is safe,our data is also kept in my memory.

_upload = async () => {

    let apiUrl = 'http://---.---.---.---/api_for_solutions/upload_recording';

    if (this.state.recording) {
        Alert.alert('Can\'t upload, now on recording!');
    }
    else {
        const path = 'file://' + this.state.audioPath;
      // const path1 = this.state.audioPath;
      // console.error("Path : "+path1)

      let file = {uri:path, type:'audio/aac', name:'test.aac'};
        const formData = new FormData();
        formData.append('recording',file);
        fetch(apiUrl, {
            method: 'POST',
            headers: {

                'content-type': 'multipart/form-data; boundary=----',

            },
            body: formData
        }).then((res) => res.json())
            .then(response => {
           Alert.alert(
                'Success : '+response.success,
                'Audio Uploaded Successfully',
                [

                    {text: 'OK', onPress: () => console.log('OK Pressed')}
                ],
                { cancelable: false }
            )
        }).catch(err => {
            console.error(err)
        })

    }
               }

//render the button

{this._renderButton("UPLOAD", () => {this._upload()} )}

rizwan92 commented 6 years ago

when i start recording and store file into download directory , then i stop it, file saved to the download directory, suddenly i pressed button to play it it says playback failed due to audio decoding errors what is i am doing wrong here

it might be because of i am creating new file every time, i put this code let d = new Date(); let n = d.getTime(); let path = this.state.audioPath+"/"+n+".aac" console.log(path); this.prepareRecordingPath(path);

link to see code image

rizwan92 commented 6 years ago

thank you so much Biplovkumar i successfully uploaded my first audio file into the s3 this is my first audio which i uploaded link thank you so much

Biplovkumar commented 6 years ago

most welcome. this is really awesome library.

Thanks & Regards. Biplov kumar

Student Mca Vivekananda Institute of Professional Studies https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwiv8qXam_nLAhVWC44KHT3AA1cQFggcMAA&url=http%3A%2F%2Fwww.vips.edu%2F&usg=AFQjCNEKnNl-jafsVVUbN7tTK-CWiPRlFQ&sig2=lUiba0eZIFSPdVFZWg5Z5g&bvm=bv.118443451,d.c2E New Delhi, IndiaMob: +91-9835773216

Email:biplovkumar.kumar@gmail.com Email:biplov@algofocus.com

On Fri, Feb 16, 2018 at 10:25 PM, MD. Rizwan Raza notifications@github.com wrote:

thank you so much Biplovkumar i successfully uploaded my first audio file into the s3 this is my first audio which i uploaded link https://message-hosting-mobilehub-2133437836.s3.amazonaws.com/files%2Ftest.aac thank you so much

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jsierles/react-native-audio/issues/234#issuecomment-366293200, or mute the thread https://github.com/notifications/unsubscribe-auth/Ac_icFp9OhaL0g7zWcp8LkxaWDoTisD0ks5tVbL3gaJpZM4SIIRt .

tlweiii6465 commented 5 years ago

hi my app was crash after i change my audiopath to this audioPath: AudioUtils.MusicDirectory + '/audio.aac' is that any solution about this issue?

ivanfranchi commented 5 years ago

hi my app was crash after i change my audiopath to this audioPath: AudioUtils.MusicDirectory + '/audio.aac' is that any solution about this issue?

It could be file system access, use the cache dir if no specific needs.

when i start recording and store file into download directory , then i stop it, file saved to the download directory, suddenly i pressed button to play it it says playback failed due to audio decoding errors what is i am doing wrong here

it might be because of i am creating new file every time, i put this code let d = new Date(); let n = d.getTime(); let path = this.state.audioPath+"/"+n+".aac" console.log(path); this.prepareRecordingPath(path);

link to see code image

You need to change a bit your code according to this comment (from 2016): https://github.com/zmxv/react-native-sound/issues/20#issuecomment-205683378

liuweicom commented 4 years ago

1.where is my .aac file storing ?

in enternal in android in data in project name. 2.how can i get link of my record file ? u can print ur audio store path in log. give path name in android and u can get ur file.

3.how much file can i record ?

approx cache memory.

4.can i change the path of recorded file ?

yup, u need to change AudioUtils.documentDirectoryPath to MusicDirectory path and u can store it in ur internal music folder then u store audio more than cache .

sorry if language problem. but really it works fine. hello ,dou you konw how much file can record,now?

Praveensahu365 commented 4 years ago

api_for_solutions/upload_recording

formData is undefined

Praveensahu365 commented 4 years ago

1.i want to store file inside my /internal storage/music/ so this library can store test.aac file inside this directory ? ans:- //this is for /internal storage/music/test.aac

state = { currentTime: 0.0, recording: false, stoppedRecording: false, finished: false, audioPath: AudioUtils.MusicDirectoryPath + '/test.aac', hasPermission: undefined, };

prepareRecordingPath(audioPath){
  AudioRecorder.prepareRecordingAtPath(audioPath, {
    SampleRate: 22050,
    Channels: 1,
    AudioQuality: "Low",
    AudioEncoding: "aac",
    AudioEncodingBitRate: 32000
  });
}

2.if u send on server from cache really it is more fasty but it is not safe and not we use again that data. so i always need to store this file to my local directory and then upload it my server but it take more time than cache audio but it is safe,our data is also kept in my memory.

_upload = async () => {

    let apiUrl = 'http://---.---.---.---/api_for_solutions/upload_recording';

    if (this.state.recording) {
        Alert.alert('Can\'t upload, now on recording!');
    }
    else {
        const path = 'file://' + this.state.audioPath;
      // const path1 = this.state.audioPath;
      // console.error("Path : "+path1)

      let file = {uri:path, type:'audio/aac', name:'test.aac'};
        const formData = new FormData();
        formData.append('recording',file);
        fetch(apiUrl, {
            method: 'POST',
            headers: {

                'content-type': 'multipart/form-data; boundary=----',

            },
            body: formData
        }).then((res) => res.json())
            .then(response => {
           Alert.alert(
                'Success : '+response.success,
                'Audio Uploaded Successfully',
                [

                    {text: 'OK', onPress: () => console.log('OK Pressed')}
                ],
                { cancelable: false }
            )
        }).catch(err => {
            console.error(err)
        })

    }
               }

//render the button

{this._renderButton("UPLOAD", () => {this._upload()} )}

formData is undefined