Getting Started
The solution consists of:
- a Javascript API that webpages can consume
- a native ChromeHost
- a Chrome Extension for the ChromeHost
Web Extension and Chrome Host must be installed separately on the host operating system.
Javascript/typescript API
Developers must use the versioned Javascript library file with the format jabra.browser.integration.<majorVersion>.<minorVersion>.js
and the associated typescript \*.d.ts
definition file which documents the API in detail, including exactly what each API method expect for parameters and what each method returns.
These files adhere to semantic versioning so increases in majorVersion between releases indicate breaking changes so developers using the softwaremay need to change their code when updating. Increases in minorVersion indicates that all changes are backwards compatible.
Tip: Javascript developers can use the supplied typescript file with a reference path comment on top of your javascript files to get code completion for the Jabra API in many development tools.
The API v3.0 is fully backward compatible with v2.0 and works with the current 2.x version of the Chrome Host and the Browser Extension.
The library internally checks for dependencies – and will report this to the app using the library. An example: When trying to initialize Jabra library the promise might fail with an error “You need to use this Extension and then reload this page” if the browser extension is missing.
Getting started with using the API in your web applications
First, make sure the Javascript API Client File
is included in your HTML page.
Secondly, the library must be initialized using javascript like this:
jabra
.init()
.then(() => {
// Handle success
})
.catch(err => {
// Handle error
});
Generally, you will also need to setup various event handlers, like for example for when a new Jabra device has been attached to the computer or when the device has requested to be muted (just be aware that some events are only send if the device is in a specific state. For example, mute is only send when the device is off hook):
jabra.addEventListener("device attached", event => {
// Handle new device
});
jabra.addEventListener("mute", event => {
// Handle mute event.
});
When issuing commands, this API only works with one (active/selected) jabra device at the time (only an issue if you have multiple Jabra devices connected at the same time). You can easily issue specific commands to the active device like this example:
jabra.offHook();
Importantly, please do consult the Typescript Definition File
for a full description of how to use the API.
For many editors and IDE's, the above typescript definition file can be used to provide code completion and context sensitive help. For example, for Visual Code, this requires top-level comment like this to your javascript source file:
/// <reference path="<your-path-to-a-local-copy-here>/jabra.browser.integration-3.0.d.ts" />
Dongle Devices
Some Jabra headsets connect via Bluetooth to a USB-connected dongle. In the getDevices
list, dongle and headset will appear separately, and the SDK will automatically sort out sending commands to the headset if called on the connected dongle and vice versa.
However, the devlog
event needs to be subscribed to the headset only.