Dictation Bar Component

This component is available in the
libs/integrations/invox-bar folder of the SDK.Dictation Bar is a high-level component designed to be integrated quickly and easily in your web application.
Getting started
1. Import resources
Import the resources in the <head> of your index.html:
invox.min.js— contains the API of Invox Dictation.invox-bar-component.min.js— contains the Dictation Bar Component integration.invox-bar-component.css— contains the styles of the Dictation Bar Component.
<!-- Invox Dictation SDK - API -->
<script type="text/javascript" src="libs/invox.min.js" charset="UTF-8"></script>
<!-- Invox Dictation SDK - Dictation Bar Component -->
<script type="text/javascript" src="libs/integrations/invox-bar/invox-bar-component.min.js" charset="UTF-8"></script>
<link rel="stylesheet" href="libs/integrations/invox-bar/invox-bar-component.css">
2. Initialize the component
- Create a container in the DOM with a unique identifier:
<div id="invox-bar"></div> - Create and show the component:
const invoxbar = INVOXMDComponent_Bar.create("invox-bar"); invoxbar.show();
3. Login
The following code attempts connection to the Local Dictation Service first, then falls back to Remote:
const credentials = {
user: "provided_username",
password: "provided_password"
}
const connectToLocal = {
host: "localhost",
port: "8443",
useDictationService: false
}
const connectToRemote = {
host: "dev.invoxmedical.com",
port: "8443",
useDictationService: true
}
try {
await invoxbar.login(credentials, connectToLocal);
INVOX.LogInfo("Local Dictation Service connected successfully.");
} catch (error) {
INVOX.LogWarn("Local Dictation Service not found. Trying to connect to Remote Dictation Service...");
try {
await invoxbar.login(credentials, connectToRemote);
INVOX.LogInfo("Remote Dictation Service connected successfully.");
} catch (error) {
INVOX.LogError("Remote Dictation Service not found.");
}
}
4. Logout
invoxbar.logout()
.then((result) => console.log("Successful logout!"))
.catch((e) => console.error(e));
Public methods
create
| Function | Description | Parameters | Returns |
|---|---|---|---|
| create | Creates the element in the DOM. Not visible by default. | String | void |
const invoxbar = new INVOXMDComponent_Bar.create("invox-bar");
show
| Function | Description | Parameters | Returns |
|---|---|---|---|
| show | Displays component in the user interface. | — | void |
invoxbar.show();
hide
| Function | Description | Parameters | Returns |
|---|---|---|---|
| hide | Hides Dictation Bar Component to user. | — | void |
invoxbar.hide();
remove
| Function | Description | Parameters | Returns |
|---|---|---|---|
| remove | Removes the element from the DOM. | — | void |
invoxbar.remove();
login
| Function | Description | Parameters | Returns |
|---|---|---|---|
| login | Connect to Invox Dictation service. | Object, Object | Promise<void> |
Parameters:
credentials:Objectuser:Stringpassword:String
connectionConfig:Objecthost:Stringport:StringuseDictationService:Boolean—truefor Remote,falsefor Local
invoxbar.login(credentials, connectionConfig)
.then(() => console.log("Successful login!"))
.catch((e) => console.error(e));
logout
| Function | Description | Parameters | Returns |
|---|---|---|---|
| logout | Disconnect from Invox Dictation service. | — | Promise<boolean> |
invoxbar.logout()
.then((result) => console.log("Successful logout!"))
.catch((e) => console.error(e));
Customize design
At the beginning of invox-bar-component.css you can find the :root selector with CSS variables for easy customization:
| Variable | Description | Default |
|---|---|---|
--invox-bar-size__width | Width | 100% |
--invox-bar-size__height | Height | 30px |
--invox-bar-color__primary | Primary color | #52619f |
--invox-bar-color__secondary | Secondary color | #6d7cba |
--invox-bar-color__error | Error color | #ff9191 |
--invox-bar-color__microphone | Microphone button color | red |
--invox-bar-color__vumeter-bars--active | VUMeter active color | #3adf3a |
--invox-bar-font__color | Font color | white |
--invox-bar-font__size | Font size | 0.9rem |
How to use

- Loading progress percentage — Displays the load percentage at login.
- Progress status — Displays messages about the status of the session initialization.
- Dictation button (Recognizer) — Start or stop voice recognition.
- Audio level indicator — Displays the audio level activity during the session.
- Status bar & Hypothesis viewer — Displays session status messages and recognized hypothesis during dictation.
- Dictionary button — Opens the Dictionary dialog.
- Templates button — Opens the Templates dialog.
- Transformations button — Opens the Transformations dialog.
- Menu button — Displays more features (Profile, Help, Support, About).
- Adaptation indicator — Status of the recognition model adaptation process.
How to dictate

- Click the Dictation button to start recognizer.
- Dictate your medical report.
- Click again on the Dictation button to stop recognizer.
Reset component at runtime
For single-page applications (SPA) where you need to regenerate the Dictation Bar without reloading the page:
function resetComponent(credentials, connectionConfig) {
// Step 1. Logout is absolutely necessary even if an error has occurred.
invoxbar.logout()
.catch((e) => console.error(e))
.finally(() => {
// Step 2. Remove from the DOM.
invoxbar.remove();
// Step 3. Create the dictation bar again.
invoxbar = new INVOXMDComponent_Bar.create("invox-bar");
// Step 4. Connect to Invox Dictation service again.
invoxbar.login(credentials, connectionConfig)
.then(() => console.log("Successful login!"))
.catch((e) => console.error(e));
})
}