qiuxiang / react-native-recording

React Native audio recording module used for DSP with Android + iOS
MIT License
110 stars 62 forks source link

Stop dont work #6

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello, I want to use your library but there is something wrong, stop button isn't working, after I press the start button, I cant press the stop button and even if I press it, it wont do anything the numbers continue to be display in the log and after certain duration it stops itself. this is my code

import React, { Component } from 'react' import { View, Text, Button } from 'react-native' import Recording from 'react-native-recording'

export default class Main extends Component {

componentDidMount() {
    Recording.init({
        bufferSize: 4096,
        sampleRate: 44100,
        bitsPerChannel: 16,
        channelsPerFrame: 1,
    })
    Recording.addRecordingEventListener(data => console.log(data))
}

startRecord() {
    Recording.start()
}

stoptRecord() {
    Recording.stop()
}

render() {

    return (
        <View>
            <Text>Melody</Text>
            <Button title='record' onPress={() => { this.startRecord() }} />
            <Button title='stop' onPress={() => { this.stoptRecord() }} />
        </View>
    )
}

}

qiuxiang commented 6 years ago

What is your device? Android or iOS?

ghost commented 6 years ago

my device is android, it did work out but when i stop the recording i cant record again using the record button