|
|
|
|
@ -5,13 +5,13 @@ Node.js client that implements a subset of the WebSocket interface of the Janus
|
|
|
|
|
|
|
|
|
|
Note: For now it supports the videoroom plugin only.
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
## Initial setup
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
var JanusVideoroomClient = require('janus-videoroom-client').Janus;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Without authentication
|
|
|
|
|
Without authentication
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
var client = new JanusVideoroomClient({
|
|
|
|
|
@ -19,7 +19,7 @@ var client = new JanusVideoroomClient({
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Token based authentication
|
|
|
|
|
Token based authentication
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
var client = new JanusVideoroomClient({
|
|
|
|
|
@ -28,7 +28,7 @@ var client = new JanusVideoroomClient({
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Static secret authentication
|
|
|
|
|
Static secret authentication
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
var client = new JanusVideoroomClient({
|
|
|
|
|
@ -37,6 +37,30 @@ var client = new JanusVideoroomClient({
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
Create a new janus session
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
client.createSession().then((session)=>{
|
|
|
|
|
...
|
|
|
|
|
}).catch((err)=>{
|
|
|
|
|
...
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Create a new videoroom handle
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
client.createSession().then((session)=>{
|
|
|
|
|
return session.createVideoRoomHandle();
|
|
|
|
|
}).then((handle)=>{
|
|
|
|
|
...
|
|
|
|
|
}).catch((err)=>{
|
|
|
|
|
...
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Run tests
|
|
|
|
|
|
|
|
|
|
npm test
|
|
|
|
|
|