Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bandwidth/node-webrtc
Node SDK for Bandwidth's WebRTC API
https://github.com/bandwidth/node-webrtc
webrtc
Last synced: 4 months ago
JSON representation
Node SDK for Bandwidth's WebRTC API
- Host: GitHub
- URL: https://github.com/bandwidth/node-webrtc
- Owner: Bandwidth
- License: other
- Created: 2020-06-11T14:53:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T23:21:56.000Z (5 months ago)
- Last Synced: 2024-09-17T20:51:43.960Z (5 months ago)
- Topics: webrtc
- Language: TypeScript
- Homepage:
- Size: 785 KB
- Stars: 1
- Watchers: 9
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Bandwidth WebRTC
[![Test](https://github.com/Bandwidth/node-webrtc/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/node-webrtc/actions/workflows/test.yml)
| **OS** | **Node** |
|:---:|:---:|
| Windows 2016 | 12, 14, 16 |
| Windows 2019 | 12, 14, 16 |
| Ubuntu 20.04 | 12, 14, 16 |
| Ubuntu 22.04 | 12, 14, 16 |## Installation
Use the following command to install the package.
```
npm install @bandwidth/webrtc
```## SDK Setup
The following code will initialize the SDK client.
```typescript
import { Client } from '@bandwidth/webrtc';const client = new Client({
basicAuthUserName: 'user',
basicAuthPassword: 'pass'
})
```## Create Session
```typescript
import { Client, Session, ApiController } from '@bandwidth/webrtc';const client = new Client({
basicAuthUserName: 'user',
basicAuthPassword: 'pass',
})
const controller = new ApiController(client);
const accountId = 'accountId0';
const body: Session = {
tag: 'session1'
};const response = await controller.createSession(accountId, body);
console.log(response.result.id);
```## Create Participant
```typescript
import {
Client,
Participant,
ApiController,
ParticipantSubscription,
Subscriptions,
} from '@bandwidth/webrtc';const client = new Client({
basicAuthUserName: 'user',
basicAuthPassword: 'pass',
})
const controller = new ApiController(client);
const accountId = 'accountId0';const body: Participant = {
callbackUrl: 'https://example.com/callback',
tag: 'participant1',
deviceApiVersion: 'v3'
};const response = await controller.createParticipant(accountId, body);
console.log(response.result.participant.id);
```## Add Participant to Session
```typescript
import {
ApiController,
Client
} from '@bandwidth/webrtc';const client = new Client({
basicAuthUserName: 'user',
basicAuthPassword: 'pass',
})
const controller = new ApiController(client);const accountId = '01234';
const sessionId = '56789';
const participantId = '012';const participant1 = {
participantId: '456'
};const participant2 = {
participantId: '789',
streamAliases: ['alias1', 'alias2']
};const sessionIdArg = '012345';
const subscriptions = {
sessionId: sessionIdArg,
participants: [participant1, participant2]
};controller.addParticipantToSession(accountId, sessionId, participantId, subscriptions);
```
## Bandwidth's WebRTC References
Please visit our [WebRTC home page](https://dev.bandwidth.com/docs/webrtc) for more information on Bandwidth's WebRTC platform.