crewdle-js-sdk v1.0.16
Crewdle JS SDK for Video API
This package is the Javascript SDK for the Crewdle Video API. To use this package you will need an API access. If you don't have one, you can request one by sending an email to support@crewdle.com
.
Installation
You can install this package in your own project using npm:
npm i crewdle-js-sdk
Getting started
We made a simple project to showcase how to use this package: Crewdle JS SDK Sample.
Here's how it works. First, you need to import it in your code.
import { CrewdleJsSdk, CrewdleEvents, CrewdleFeatures } from 'crewdle-js-sdk';
Then, you need to instantiate it.
const crewdle = new CrewdleJsSdk();
Once it's instantiated, you can bind to events.
crewdle.on(CrewdleEvents.ready, () => console.log('Room ready'));
See the section below for available events.
Finally, you can open the meeting room.
const features = [CrewdleFeatures.chat];
crewdle.openRoom(roomId, accessKey, accessToken, features, containerElementId)
.then(() => console.log('Room loaded'))
.catch((err) => console.error(err));
The roomId can be retrieved by creating a new room from the API. The accessKey is your API accessKey provided by Crewdle. The accessToken can be retrieved by creating a new user from the API. The list of available features is described in the section below. The containerElementID is the HTML element where the Crewdle IFrame will be inserted.
CrewdleEvents
You can bind to the following events using the on
method:
CrewdleEvents.authFailed - the accessToken is not valid
CrewdleEvents.ready - the room is loaded and ready to use
CrewdleEvents.roomLeft - the participant left the room
CrewdleEvents.unauthorized - the accessKey is not valid
CrewdleFeatures
The following features are available to be used when opening a room:
chat - text chat
fullscreen - Open the room view in fullscreen
participantsList - the list of participants
recording - paid plan only, meeting recording
remoteControls - remote controls
roomPermissions - room permissions
screenSharing - paid plan only, screen sharing
streaming - paid plan only, live streaming on social networks
virtualBackgrounds - paid plan only, virtual background
API reference
Authentication
We use a Basic authorization for the API using the access key and secret that was provided to you by Crewdle.
Authorization: Basic base64(accessKey:secret)
Users
Create a user
POST
https://api.crewdle.com/v1/users
This method is used to create an access token for a new or existing user.
JSON body
uid
- a unique user identifier
name
- the name of the user
email
- the email of the user
language
- the language of the user, can be en
or fr
for now
Update a user
PUT
https://api.crewdle.com/v1/users/:userId
JSON body
name
- the name of the user
email
- the email of the user
language
- the language of the user, can be en
or fr
for now
List all users
GET
https://api.crewdle.com/v1/users
Query parameters
page
- the current page of users, default is 0
perPage
- the number of users per page, default is 10
Retrieve a specific user
GET
https://api.crewdle.com/v1/users/:userId
Delete a user
DELETE
https://api.crewdle.com/v1/users/:userId
Rooms
Create a room
POST
https://api.crewdle.com/v1/users/:userId/rooms
JSON body
accessType
- the access type of the room, can be ask
, passcode
or url
forceViewMode
- to force a view mode for the room, can be default
, collaboration
or presentation
roomCloseWhenHostLeave
- the room close when the host leave, can be true
or false
isHostRequired
- can the meeting start without the host, can be true
or false
Update a room
PUT
https://api.crewdle.com/v1/users/:userId/rooms/:roomId
JSON body
accessType
- the access type of the room, can be ask
, passcode
or url
forceViewMode
- to force a view mode for the room, can be default
, collaboration
or presentation
roomCloseWhenHostLeave
- the room close when the host leave, can be true
or false
isHostRequired
- can the meeting start without the host, can be true
or false
List all rooms
GET
https://api.crewdle.com/v1/users/:userId/rooms
Query parameters
page
- the current page of users, default is 0
perPage
- the number of users per page, default is 10
Retrieve a specific room
GET
https://api.crewdle.com/v1/users/:userId/rooms/:roomId
Delete a room
DELETE
https://api.crewdle.com/v1/users/:userId/rooms/:roomId
Recordings
List all recordings
GET
https://api.crewdle.com/v1/users/:userId/recordings
Retrieve a specific recording
GET
https://api.crewdle.com/v1/users/:userId/recordings/:recordingId
This method can be used to retrieve the download link of the recording.
Delete a recording
DELETE
https://api.crewdle.com/v1/users/:userId/recordings/:recordingId