Skip to content

Embla core session functionality in the form of a JavaScript library

License

Notifications You must be signed in to change notification settings

mideind/EmblaCoreJS

Repository files navigation

License: GPL v3 Language Release NPM Build

EmblaCoreJS

EmblaCoreJS is a TypeScript/JavaScript library containing the core session functionality in Embla, a cross-platform mobile Icelandic-language voice assistant client. EmblaCoreJS is packaged both for modern browser and React Native environments.

For the Dart/Flutter library see EmblaCoreFlutter.

Browser usage

The bundled web version of EmblaCoreJS, along with a minified version, can be found in the releases. See the browser example for example usage.

Important note:

Using the library requires an API key for the Ratatoskur server instance you wish to communicate with. To prevent the Ratatoskur API key from being sent to clients, it is recommended you set up an API endpoint which proxies the Ratatoskur authentication token endpoint. See endpoint documentation here.

Installation

Use npm or yarn to install dependencies:

npm install
# Needed for web version
npm install recordrtc
# Needed for React Native version
npm install react-native-sound-player @dr.pogodin/react-native-audio

To build the project run:

npm run build

This compiles the code into JavaScript libraries found in lib/web/ and lib/react-native.

Documentation

Documentation can be generated by running:

npm run docs

Documentation is then found in docs/ (open docs/index.html in a browser).

Testing

Tests can be run with:

npm run test

Example usage

Examples can be found in the directories example/web and example/react-native.

Information on running them is found in the corresponding README.md files.

React Native usage

The React Native version of EmblaCoreJS is published to npm as @mideind/embla-core.

In order to work, apps making use of EmblaCoreJS must have permission to record audio. iOS apps must add the following to their Info.plist file:

<key>NSMicrophoneUsageDescription</key>
<string>Microphone permission is required for speech recognition.</string>

Android apps must have the following in their AndroidManifest.xml file:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

The app must also request permission to record audio from the user. This can be done using e.g. the react-native-permissions library.

License

EmblaCoreJS is Copyright © 2023 Miðeind ehf.

Miðeind ehf.

This set of programs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This set of programs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

The full text of the GNU General Public License v3 is included here and also available here: https://www.gnu.org/licenses/gpl-3.0.html.

If you wish to use this set of programs in ways that are not covered under the GNU GPLv3 license, please contact us at mideind@mideind.is to negotiate a custom license. This applies for instance if you want to include or use this software, in part or in full, in other software that is not licensed under GNU GPLv3 or other compatible licenses.

Attributions

EmblaCoreJS bundles the following libraries:

The following libraries are peer dependencies (not included when bundled):