Skip to content

the text-to-speech is not working after built #3

@sumanbogati

Description

@sumanbogati

I can successfully built your project, however the text-to-speech is not working, I can't hear the audio after clicked on "button" text, the apk file is installed in android phone.
Here is my index.android.js

` import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Platform,
TouchableHighlight,
TouchableNativeFeedback
} from 'react-native';

var tts = require('react-native-android-speech')

function buttonClicked () {
    tts.speak({
        text:'Please provide some text to speak.', // Mandatory
        pitch:1.5, // Optional Parameter to set the pitch of Speech,
        forceStop : false , //  Optional Parameter if true , it will stop TTS if it is already in process
        language : 'en' // Optional Paramenter Default is en you can provide any supported lang by TTS
    }).then(isSpeaking=>{
        //Success Callback
        console.log(isSpeaking);
    }).catch(error=>{
        //Errror Callback
        console.log(error)
    });

     setTimeout(function(){ alert("finished here"); }, 3000);

}
class mysound extends Component {

  render() {
    var TouchableElement = TouchableHighlight;
    if (Platform.OS === 'android') {
        TouchableElement = TouchableNativeFeedback;
    }
    return (
      <View style={styles.container}>
          <Text style={styles.welcome}>
            Tap me as fast as you can!
          </Text>

          <TouchableElement
            onPress={buttonClicked}>
            <View>
              <Text>Button!</Text>
            </View>
          </TouchableElement>
  </View>
    );
  }
}

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,
  },
});
AppRegistry.registerComponent('mysound', () => mysound);

`
Can you please tell me why this is not working ? I have downloaded your code before one month and since then I have been working on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions