Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just doesn't work !What is wrong? #82

Open
gwl002 opened this issue Mar 30, 2018 · 5 comments
Open

Just doesn't work !What is wrong? #82

gwl002 opened this issue Mar 30, 2018 · 5 comments

Comments

@gwl002
Copy link

gwl002 commented Mar 30, 2018

`export default class App extends Component{
constructor(props) {
super(props);
Voice.onSpeechStart = this.onSpeechStartHandler.bind(this);
Voice.onSpeechEnd = this.onSpeechEndHandler.bind(this);
Voice.onSpeechError = this.onSpeechError.bind(this);
Voice.onSpeechResults = this.onSpeechResultsHandler.bind(this);
this.state = {
listening: "pause"
};
}
onSpeechResultsHandler(result){
console.log("speech result: ",result)
}
onSpeechStartHandler(){
this.setState({listening:"started"})
console.log("speech started")
}

onSpeechEndHandler(){
	this.setState({listening:"pause"})
	console.log("speech ended")
}
onSpeechError(err){
	console.log(err)
}
componentDidMount(){
}
render(){
	return (
		<View style={styles.container}>
			<Text>002</Text>
			<Text>react-native-voice Test</Text>
			<Button title={this.state.listening} onPress={(e)=>{
				console.log("start")
				Voice.onSpeechStart = this.onSpeechStartHandler.bind(this);
				Voice.start("en-US");
			}}/>
		</View>
	)
}

}`
I press the button.Just "start" show in the console.No any listener is triggered!Thanks for any help!

@shrinandhini2801
Copy link

Same here . It doesnt work in iOS device. It works perfectly fine in simulator , but when i run in actual device , its not even asking with the permission popup that usually comes if we are accessing microphone .

@siarhei-zharnasek
Copy link

@gwl002 you don't need
Voice.onSpeechStart = this.onSpeechStartHandler.bind(this);
Voice.start("en-US");
in Button onPress
try to change that lines to this.onSpeechStartHandler()
and you need button to stop recording to see results I think

@lfoliveir4
Copy link
Collaborator

@siarhei-zharnasek Did you solve your problem?

@js-cowboy
Copy link

@siarhei-zharnasek Did you solve your problem?

I didn't have it, just wanted to help :)

@ChampionRoy
Copy link

ChampionRoy commented May 17, 2020

Same here. Still have no idea; no callback is invoked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants