1.0.0 • Published 7 years ago

react-voice-components v1.0.0

Weekly downloads
24
License
MIT
Repository
github
Last release
7 years ago

react-voice-components

Build Status

Set of React components that use the Web Speech API to bring voice experience to React applications. Check out the :sparkles: :gem: LIVE DEMO :gem: :sparkles:

Install

Install the components using npm:

$ npm install --save react-voice-components

Usage

  1. Import components:

    import { VoicePlayer, VoiceRecognition } from 'react-voice-components'
  2. Use it:

    ReactDOM.render(
      <VoicePlayer
        play
        text="React voice player demonstration"
      />,
      document.getElementById('root')
    )

API

<VoicePlayer />

Provides you a simple React component to do speech synthesis (text to speech).

Options

PropertyOptionsDescription
playbooleanSpecifies if the speech should be played when mounted.
pausebooleanSpecifies if the speech should pause
textstringSpecifies the text that shall be spoken.
langen-US, en-GB, es-ES, fr-FR, it-IT, de-DE, ja-JP, pt-BR, zh-CNSpecifies the accent and language the speech will be spoken.

Event Callbacks

PropertyDescription
onStartRuns when the speech starts to be spoken.
onEndRuns when the speech completes to be spoken.
onPauseRuns when te speech is paused.
onResumeRuns when the speech is resumed.

<VoiceRecognition />

Provides you a simple React component to do voice recognition (speech to text).

Options

PropertyOptionsDescription
continuousbooleanSpecifies if the recognition should continue when the user pauses while speaking.
stopbooleanSpecifies if the recognition should be stoped (when used with continuous=true)

Event Callbacks

PropertyDescription
onStartRuns when the recognition starts.
onEndRuns when the recognition ends.
onErrorRuns when there is a recognition error.
onResultRuns when there is a recognition result.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

LICENSE

MIT (c) 2017 Guilherme Rv Coelho