Socket
Socket
Sign inDemoInstall

react-native-baidu-tts-offline

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-baidu-tts-offline

This is an React-native library that can do text-to-speech make setting.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
28.0 MB
Created
Weekly downloads
 

Readme

Source

react-native-baidu-tts-offline

This is an React-native library that can do text-to-speech make setting.

notice

current is only support android, ios coming soon.

Getting started

$ npm install react-native-baidu-tts-offline --save

Mostly automatic installation

$ react-native link react-native-baidu-tts-offline

Manual installation

iOS

coming soon

Android
  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.wayne.baiduvoice.RNBaiduvoicePackage; to the imports at the top of the file
  • Add new RNBaiduvoicePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-baidu-vtts'
    project(':react-native-baidu-vtts').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-baidu-vtts/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    implementation project(':react-native-baidu-vtts')
    

Usage

import RNBaiduvoice from 'react-native-baidu-tts-offline';

// TODO: What to do with the module?
class App extends Component{

    componentDidMount() {
    	// 填写百度语音官网申请的appid, apikey, secretkey
    	const appid = ''
    	const apikey = ''
    	const secretkey = ''
      const sn =''
        RNBaiduvoice.initBaiduTTS(appid,apikey,secretkey,sn)
    }

    _speechText = () => {
        RNBaiduvoice.speak('百度语音')
    }

    render() {
        return (
            <View style={styles.container}>
                {/*<TwoList/>*/}
                <TouchableOpacity onPress={this._speechText}>
                    <Text style={{fontSize: 20, height: 30}}>测试语音</Text>
                </TouchableOpacity>
            </View>
        );
    }
}


FAQs

Last updated on 03 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc