Skip to main content

RELAY JS SDK 3.19.0 Release

· 3 min read
Renae Sowald

We are happy to announce JavaScript SDK 3.19.0.

Upgrading is straightforward with our release process, which adheres to Semantic Versioning. Minor versions are guaranteed to not have breaking changes, so you can upgrade with confidence.

SignalWire Release Card

Version 3.19 of the JavaScript SDK introduces a new feature for Video: Interactive Live Streaming. Here are the highlights.

Interactive Live Streaming

Interactive Live Streaming is a Video product that provides a flexible middle ground between RTMP streaming and a Video conference. RTMP streaming allows users to stream their audio and video to a passive audience, while a video conference allows all users to transmit and receive audio and video. Interactive Live Streaming allows users to experience either state or switch between them in one Video room, depending on their role.

Join a Video Room as member or audience

As always, the JavaScript SDK join() method will join a Video room. Whether a user joins as member or audience depends on the room token passed. In the API, The join_as() parameter has been added to the Video Room Token request to give users member or audience permissions. A member will transmit and receive audio and video. An audience participant will only receive audio and video. baf34a8

curl -L -X POST "https://$SPACE_URL/api/video/room_tokens" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-u "$PROJECT_ID:$API_TOKEN" \
--data-raw '{
"room_name": "my_room",
"user_name": "John Smith",
"join_as": "audience"
}'
import * as SignalWire from '@signalwire/js'

const roomSession = new SignalWire.Video.RoomSession({
token: "<YourRoomToken>",
rootElement: document.getElementById("yourVideoElement"),
});

roomSession.join();

Read the Current Participant's Interactivity Mode

The new property interactivityMode is available on the RoomSession object to read the local member's current interactivity mode (member or audience). 6c4d4b3

Promote Audience or Demote Members

To change the interactivity mode of a participant, the methods promote() and demote() have been added to the RoomSession object. bc56cc4

promote requires the audience participant's ID, and you may choose to set specific Video Room permissions.

await roomSession.promote({
memberId: "de550c0c-3fac-4efd-b06f-b5b8614b8966",
mediaAllowed: "all",
permissions: [
"room.self.audio_mute",
"room.self.audio_unmute",
"room.self.video_mute",
"room.self.video_unmute",
"room.list_available_layouts",
],
});

Optional parameters on promote include meta, joinAudioMuted, and joinVideoMuted. bc56cc4

See the promote technical reference for a complete list of parameters.

demote removes the participant's ability to send audio and video. Technical reference

await roomSession.demote({
memberId: "de550c0c-3fac-4efd-b06f-b5b8614b8966",
mediaAllowed: "all",
});

Events to Support Interactive Live Streaming

member.promoted member.demoted and room.audience_count events are available on the RoomSession object to track members and audience changes. fb83b89