@signalwire/js v3.7.0
Today we are announcing the latest release of the JavaScript SDK.
This release focuses on the room previews feature, which allows you to access a link to a temporary video stream displaying a preview of what is going on in a room.
Highlights
Room Previews
We now support displaying a video preview of a room to the users before joining the room. For this to work you need to specify a enable_room_previews: true
flag when creating a room (either from your Signalwire Space, from the REST APIs, or from a Token).
For example, let's say we want to create a new room using the REST APIs. To enable room previews, you can add the enable_room_previews
flag:
curl --request POST \
--url https://yourspace.signalwire.com/api/video/rooms \
--header 'Accept: application/json' \
--header 'Authorization: Basic <your auth info here>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "my_new_room",
"display_name": "My New Room",
"enable_room_previews": true
}
'
Then, from the JavaScript SDK you can obtain the URL of the recording after joining a room by calling
roomSession.previewUrl
// Returns a URL such as 'https://files.signalwire.com/.../video-room-previews/..3251e299741a.mp4'
(note that it may take a few seconds for the URL to be ready)
Or, to obtain it before joining a room, simply use the REST APIs to list room sessions: you'll find the URL in there too.
You can then download the video and use it however you need to. The video will be refreshed periodically: make sure to download it again when you want to display updated previews.