react native baidu vtts
1.0.0
Dies ist eine reagierende Bibliothek, die Text-zu-Sprache durchführen kann
Bitte folgen Sie dieser Seite reaktnativ 集成百度语音合成 Einstellung machen.
Current ist nur Unterstützung von Android, iOS kommt bald.
$ npm install react-native-baidu-vtts --save
$ react-native link react-native-baidu-vtts
bald kommen
android/app/src/main/java/[...]/MainActivity.javaimport com.wayne.baiduvoice.RNBaiduvoicePackage; zu den Importen oben in der DateigetPackages() -Methode zurückgegebenen Liste new RNBaiduvoicePackage() hinzu.android/settings.gradle an: include ':react-native-baidu-vtts'
project(':react-native-baidu-vtts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-baidu-vtts/android')
android/app/build.gradle : implementation project(':react-native-baidu-vtts')
import RNBaiduvoice from 'react-native-baidu-vtts' ;
// TODO: What to do with the module?
class App extends Component {
componentDidMount ( ) {
// 填写百度语音官网申请的appid, apikey, secretkey
const appid = ''
const apikey = ''
const secretkey = ''
RNBaiduvoice . initBaiduTTS ( appid , apikey , secretkey )
}
_speechText = ( ) => {
RNBaiduvoice . speak ( '百度语音' )
}
render ( ) {
return (
< View style = { styles . container } >
{ /*<TwoList/>*/ }
< TouchableOpacity onPress = { this . _speechText } >
< Text style = { { fontSize : 20 , height : 30 } } >测试语音</ Text >
</ TouchableOpacity >
</ View >
) ;
}
}