Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/circuit/webrtc-bot-example
Electron-based Bot utilizing the WebRTC capabilities of the Circuit JS SDK
https://github.com/circuit/webrtc-bot-example
bot circuit circuit-sdk electron webrtc
Last synced: about 1 month ago
JSON representation
Electron-based Bot utilizing the WebRTC capabilities of the Circuit JS SDK
- Host: GitHub
- URL: https://github.com/circuit/webrtc-bot-example
- Owner: circuit
- License: apache-2.0
- Created: 2017-09-21T01:20:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T17:22:19.000Z (about 2 years ago)
- Last Synced: 2024-04-11T15:42:31.022Z (9 months ago)
- Topics: bot, circuit, circuit-sdk, electron, webrtc
- Language: JavaScript
- Size: 69.3 KB
- Stars: 5
- Watchers: 10
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webrtc-bot-example
[Electron](https://electron.atom.io/)-based Bot utilizing the WebRTC capabilities of the [Circuit JS SDK](https://github.com/circuit/circuit-sdk).
> Electron is based on node.js and Chromium and is therefore able to utilize the Circuit JS WebRTC APIs unlike a regular node.js app.
## Scenarios covered in this example:
### Greet participants by name when joining a conference
* Using `callStatus` event listen for participants joining
* Use [IBM Text to Speech](https://www.ibm.com/watson/services/text-to-speech/) service to generate audio buffer for greeting
* Use the [AudioContext]((https://developer.mozilla.org/en-US/docs/Web/API/AudioContext)) of the Web Audio API to convert the audio buffer to a MediaStream
* Use the new [`setAudioVideoStream`](https://circuitsandbox.net/sdk/classes/Client.html#method_setAudioVideoStream) API to transmit the greeting to the conference### Detect 5s of silence and play an announcement
* Use `client.getRemoteStreams` and attach remote audio stream to an audio element (could also be done via `call.remoteAudioStream`)
* Use `client.getLastRtpStats` to get `AudioLevelOutput` statistics to detect 5s of silence
* Use IBM Text to Speech, Web Audio API and `setAudioVideoStream` to play audio as in scenario above## Getting Started
* [Register an account](https://circuit.github.io/) on circuitsandbox.net (if you didn't yet)
* [Register a bot](http://circuit.github.io/oauth) on the sandbox (OAuth 2.0 Client Credentials)### Run the app
```bash
git clone https://github.com/circuit/webrtc-bot-example.git
cd webrtc-bot-example
cp config.json.template config.json
// Edit config.json with your credentials
npm install
npm start // or npm run dev
```