amuireact-openspeech
v0.0.3
Published
The OpenSpeech component of xfyun.cn for Amaze UI React
Downloads
2
Readme
Amuireact-openspeech
The OpenSpeech component of 讯飞开放平台 for Amaze UI React
Feature
According to the speech of user, this component will transform speech into text which is based on the openspeech SDK.
~~## Live demo~~
~~demo: amazeui-opeenspeech-example~~
~~Open the web developer tool while using demo will be better.~~
Browser
!Note: Whether pass the test on special browser is subject to the official SDK.
Demo & Examples
To build the example locally, clone this repo and open example folder then run:
cd example
npm install
npm start
Then open localhost:3000
in a browser.
Installation
The easiest way to use amuireact-openspeech is to install it from NPM and include it in your own React build process (using Webpack, etc).
npm install amuireact-openspeech --save
At this point you can import amuireact-openspeech in your application as follows:
import OpeenSpeech from 'amuireact-openspeech';
And there are some base libraries you should import. (Because thinking about upgrade of the official openspeech component, this react component not includes there libs)
<script src="http://webapi.openspeech.cn/socket.io/socket.io.js"></script>
<script src="http://webapi.openspeech.cn/fingerprint.js"></script>
<script src="http://webapi.openspeech.cn/iat.min.js"></script>
Usages
Further options
Property | Type | Default | Description
:-----------------------|:--------------|:--------------|:-------------------------------- timestamp | string | new Date().toLocaleTimeString() | As same as the time stamp of signature expires | number | 10000 | As same as the expires of signature url | string | 'http://webapi.openspeech.cn/' | Server address reconnection | bool | true | whether client support reconnection after disconnecting resultType | string | 'json' | Format for result: json or plain resultCharset | string | 'utf8' | Format of result charset punctuationType | number | 1 | Whether result includes punctuation marks getVolume | func | empty function | A callback function to get the current volume getResult | func | empty function | A callback function to get the result from server getCurrentMessage | func | empty function | A callback function to get the current status