jsierles / react-native-audio

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

app is running but return nothing. #231

Open Biplovkumar opened 6 years ago

Biplovkumar commented 6 years ago

Version

Tell us which versions you are using ( you can see the versions in your package.json ):

react-native-audio : 3.5.1 react-native :0.52.2 react : 16.2.0 using react-native-sound ? Yes/No 1.2.6 yes

Expected behaviour :

What were you trying to do and what did you expect to happen ?

import React, { Component } from 'react'; import {Alert} from 'react-native'; //import Record from 'react-native-record-sound'; import {AudioRecorder, AudioUtils} from 'react-native-audio'; let audioPath = AudioUtils.DocumentDirectoryPath + '/test.aac';

let isRecording = false;

import { / Platform,/ StyleSheet, Text, View, Button } from 'react-native';

/const instructions = Platform.select({ ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu', });/

export default class App extends Component<{}> { render() { return

This is audio demo
      <Button
          onPress={App.recordSound.bind(this)}
          title='Start Recording'
          color='green'
      />
  </View>;

}

static recordSound() { if (isRecording === false) {

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

        // Record.startRecord( audioPath + 'sound.aac' );
         // this.recordSound(audioPath);
          Alert.alert('recording_start:'+ audioPath);

      }
      else
      {
          Alert.alert('recording stop');
        // Record.stopRecord();
   //  isRecording = !isRecording;
  }}

}

const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, });

What happened when your issue occurred ? The more details you provide here the better the odds are that someone will help you resolve your issue

app is working well but not recording start and return nothing.

Please provide us with some code that we can run to reproduce your error.

above i already provided.

If you put a GitHub repo that reproduces your issue then you significantly increase your chances of getting help !

Biplovkumar commented 6 years ago

its working fine when i giving music directory path instead of Document directory path.