![Speechly](https://www.speechly.com/images/logo.png)
speechly-browser-client
![npm version](https://badge.fury.io/js/%40speechly%2Fbrowser-client.svg)
This repository contains source code for the browser client for Speechly SLU API. Speechly allows you to easily build applications with voice-enabled UIs.
Usage
Install the package:
# Using Yarn
yarn add @speechly/browser-client
# Using NPM
npm install --save @speechly/browser-client
Start using the client:
import { Client, Segment } from '@speechly/browser-client'
const client = new Client({
appId: 'your-app-id',
language: 'en-US'
})
client.initialize((err?: Error) => {
if (err !== undefined) {
console.error('Failed to initialize Speechly client:', err)
}
})
client.onSegmentChange((segment: Segment) => {
console.log('Received new segment from the API:', segment.intent, segment.entities, segment.words, segment.isFinal)
})
client.startContext((err?: Error) => {
if (err !== undefined) {
console.error('Failed to start recording:', err)
return
}
setTimeout(client.stopContext, 3000)
})
Check out the demo in examples directory.
Documentation
You can find the detailed API documentation in GitHub repository.
Contributing
If you found a bug, please submit an issue with steps to reproduce it. If you would like to contribute to the codebase, feel free to submit the PR and request one of the maintainers to review it.