Speechly Browser UI components
Ready made Speechly UI components to build a reactive voice interface to a web site or app. See these CodePens for a preview:
If you want to build a custom interface for you web app, you may want to check out browser-client (npm) for direct access to Speechly API.
Introduction To Components
- Push-To-Talk Button provides a button to control listening on/off. It comes integrated with browser-client.
- Big Transcript is an overlay-style component that displays real-time speech-to-text transcript and feedback to the user. Recognized entities are highlighted.
- Transcript Drawer is an alternative to Big Transcript that slides down from the top of the viewport. It displays usage hints along with the real-time speech-to-text transcript and feedback.
- Intro Popup provides a customizable introduction to voice features, guides the user through browser mic permission setup and helps recover from common problems.
Documentation
Browser Usage
Include the Web Components from a CDN that mirrors @speechly/browser-ui
npm package. The script tags register push-to-talk-button
, big-transcript
and intro-popup
with the browser's customElement registry so you can use them like regular tags.
<head>
<script type="text/javascript" src="https://unpkg.com/@speechly/browser-ui/core/push-to-talk-button.js"></script>
<script type="text/javascript" src="https://unpkg.com/@speechly/browser-ui/core/big-transcript.js"></script>
<script type="text/javascript" src="https://unpkg.com/@speechly/browser-ui/core/intro-popup.js"></script>
</head>
<body>
<big-transcript
placement="top">
</big-transcript>
<push-to-talk-button
placement="bottom"
appid="YOUR_APP_ID_FROM_SPEECHLY_DASHBOARD">
</push-to-talk-button>
<intro-popup>
<span slot="priming-body">You'll be able to control this web app faster with voice.</span>
</intro-popup>
</body>
Node Usage
This example illustrates using browser-ui Web Components with a JS framework. For React development, react-client and react-ui libraries offer a better developer experience.
npm i @speechly/browser-ui
In App.js:
import "@speechly/browser-ui/core/push-to-talk-button";
import "@speechly/browser-ui/core/big-transcript";
import "@speechly/browser-ui/core/intro-popup";
...
<big-transcript placement="top"></big-transcript>
<push-to-talk-button placement="bottom" appid="YOUR_APP_ID_FROM_SPEECHLY_DASHBOARD"></push-to-talk-button>
<intro-popup></intro-popup>
Building and developing
The build steps are needed if you want to contibute to the development of the components or need to fork them for customization.
Requirements
- Node (tested with v14.16.1+)
Built With
Install Rush (one-time only)
npm install -g @microsoft/rush
Running the development build
rush update
# Build dependencies
rush build --to-except browser-ui
# Compile the library, serve the testbench pages and watch changes
rushx dev
Open http://localhost:5000 or http://localhost:5000/extras to see the components on testbench pages.
Building for production
rush update
rush build --to browser-ui
# Check build artefacts
ls core/
Learn more