Skip to content

Releases: signalwire/signalwire-js

@signalwire/js v3.8.0

04 Feb 15:28
512ece5
Compare
Choose a tag to compare

This release of the JavaScript SDK marks the introduction of Chat APIs. We have also made some additional improvements to our Video APIs to make it easier to use.

Highlights

Chat

You can now use our JavaScript SDK to create chat applications, or to add chat functionalities to your existing video applications. To get started, include the SDK as usual, for example from unpkg:

<script src="https://unpkg.com/@signalwire/js@3"></script>

You will now be able to access the SignalWire.Chat namespace. Joining a chat is similar to how you join Room Sessions:

const chatClient = new SignalWire.Chat.Client({
  token: token  // Get this from our REST APIs
});

// Subscribe to events
chatClient.on("message", message => { })

// Start receiving messages
await chatClient.subscribe(['channel1', 'channel2']);

// Publish a message
await chatClient.publish({
  channel: 'channel1',
  content: 'Hello!'
});

Please explore the following resources for more information:

List of members in a video room

We have introduced an additional event for RoomSession objects: memberList.updated. You will find this event handy if you're aiming to build a dynamically updated list of members in a room. You can use it like this:

roomSession.on('memberList.updated', (e) => {
  // e.members contains the full list of members currently in the room.
  updateMyListOfMembers(e.members)
})

In this way, you don't need to manually keep track of member.joined, member.updated, and member.left events to keep your UI updated.

@signalwire/js v3.7.0

11 Jan 15:51
90e87bf
Compare
Choose a tag to compare

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.

@signalwire/js v3.6.0

16 Dec 13:57
0a80571
Compare
Choose a tag to compare

This is a maintenance release that contains several minor fixes and improvements.

Notes

If you were relying on the DOM id of the internal video overlay element, please note that the id is now prefixed with the string sw-sdk- to avoid clashing with user-code ids. Since this is an undocumented internal detail, the vast majority of users will be unaffected. See #370.

Fixes

  • Hide the local video overlay element when the user's video is not in the layout 2b1e970
  • Add prefix to the DOM elements created by the SDK to make them unique. ba0647b
  • RoomSession: Improve TypeScript signature for member methods with optional properties dd41aba
  • Fix definition types f494e05
  • Fix logic to handle the redirectDestination case where the SDK should resend the invite to a specific node. 499f62a

@signalwire/realtime-api v3.0.0-beta.4

02 Nov 16:47
1ff6ee6
Compare
Choose a tag to compare

This is a minor maintenance release.

@signalwire/js v3.5.0

02 Nov 16:48
1ff6ee6
Compare
Choose a tag to compare

We are excited to announce the latest release of the JavaScript SDK. This is a small maintenance release.

Highlights

We have deprecated the methods RoomSession.hideVideoMuted and RoomSession.showVideoMuted. You should now prefer the use of RoomSession.setHideVideoMuted, which is consistent with our realtime-api package.

Before (now deprecated):

await roomSession.hideVideoMuted()
await roomSession.showVideoMuted()

From now on:

await roomSession.setHideVideoMuted(true)
await roomSession.setHideVideoMuted(false)

Improvements

  • If you are joining an audio-only room session, you do not need to specify a rootElement anymore
  • You will now get documentation in your IDE for all SDK methods and objects

Fixes

  • Fixed a possible race condition when applying the localVideo overlay
  • Fixed a possible race condition on RoomSession.join() method.
  • Fixed an issue with the connection not being able to be established when video/audio permissions were not granted.

@signalwire/realtime-api v3.0.0-beta.3

12 Oct 15:49
Compare
Choose a tag to compare

We are excited to announce the third beta release of the RealTime SDK. This is a small release that focuses on the Playback feature.

Highlights

You can use the Playback feature to play a video stream inside a room session. For example:

const url = 'rtmp://...'
const playback = await roomSession.play({ url, volume: 10 })

await playback.pause()
await playback.stop()

At the moment, the supported formats are:

  • RTMP (rtmp:// and rtmps://)
  • HLS (.m3u8, application/x-mpegurl)
  • MPEG-DASH (.mpd, application/dash+xml)

You can also subscribe to the following RoomSession events:

  • playback.started: a playback has started
  • playback.updated: a playback has been updated
  • playback.ended: a playback has ended

@signalwire/js v3.4.0

12 Oct 15:50
cf10b82
Compare
Choose a tag to compare

We are excited to announce the latest release of the JavaScript SDK. This is a small release that focuses on the Playback feature.

Highlights

You can use the Playback feature to play a video stream inside a room session. For example:

const url = 'rtmp://...'
const playback = await roomSession.play({ url, volume: 10 })

await playback.pause()
await playback.stop()

At the moment, the supported formats are:

  • RTMP (rtmp:// and rtmps://)
  • HLS (.m3u8, application/x-mpegurl)
  • MPEG-DASH (.mpd, application/dash+xml)

To use this feature, make sure to enable the room.playback permission when generating the Video Room Token. You will also receive the following RoomSession events:

  • playback.started: a playback has started
  • playback.updated: a playback has been updated
  • playback.ended: a playback has ended

@signalwire/realtime-api v3.0.0-beta.1

06 Oct 12:39
8445fc1
Compare
Choose a tag to compare

We are excited to announce the second beta release of our server-side realtime SDK!

New features

Get the full state of a room session

When you subscribe to a RoomSession to start receiving events, the subscribe method now asynchronously returns the full state of the session. This allows you, for example, to immediately know the current members in the room.

const client = ...  // get a client with createClient()

client.video.on('room.started', async (roomSession) => {
  // attach event listeners...
  // roomSession.on(...)

  // This gives you the full state of the room session!
  const roomSessionState = await roomSession.subscribe()

  console.log(
    'State:',
    roomSessionState.name,
    roomSessionState.id,
    roomSessionState.roomId,
    roomSessionState.members
  )
  roomSessionState.members.forEach((member: any) => {
    console.log('Room Member', member.id, member.name)
  })
}

Deprecations

setMicrophoneVolume and setSpeakerVolume have been deprecated

#302 2ac7f6d

To make our API more consistent, we have renamed the methods setMicrophoneVolume and setSpeakerVolume to, respectively, setInputVolume and setOutputVolume. Please update your code to use the new names, as the deprecated methods will be removed in a future version of the SDK.

Before (deprecated):

roomSession.setMicrophoneVolume({memberId: id, volume: -10});
roomSession.setSpeakerVolume({memberId: id, volume: -10});
member.setMicrophoneVolume({volume: -10});
member.setSpeakerVolume({volume: -10});

After:

roomSession.setInputVolume({memberId: id, volume: -10});
roomSession.setOutputVolume({memberId: id, volume: -10});
member.setInputVolume({volume: -10});
member.setOutputVolume({volume: -10});

Breaking changes

Timestamp properties now are Date objects

#305 cec54bd

To make our API easier to use, we have converted the timestamp properties within the SDK to Date object. This breaking change only affects you if you are using the Recording features.

Assume rec is a RoomSessionRecording object of which you use the fields startedAt and endedAt. It may look like this:

myFunction(rec.startedAt)
myFunction(rec.endedAt)

If you upgrade to this version of the SDK, make sure to convert them back to a number to make the rest of your code compatible:

myFunction(+rec.startedAt)
myFunction(+rec.endedAt)

Improvements

  • #296 685e0a2 We have improved the documentation of the SDK.

Fixes

  • #299 72eb91b We have fixed the signature of the setLayout method of a VideoRoomSession. You should now get proper type suggestions.

@signalwire/js v3.3.0

06 Oct 12:39
8445fc1
Compare
Choose a tag to compare

We are excited to announce the latest version of our JavaScript SDK! This release mainly focuses on a number of improvements on the side of API usability.

Highlights

A new way to join rooms

To simplify our API we have introduced a new way to join rooms. The most important entry point for the API is now the RoomSession object, which is flexible enough to support all the use cases that were covered by the old createRoomObject and joinRoom. Take a look down below to know how to update your code.

Deprecations

setMicrophoneVolume and setSpeakerVolume have been deprecated

#302 2ac7f6d

To make our API more consistent, we have renamed the methods setMicrophoneVolume and setSpeakerVolume to, respectively, setInputVolume and setOutputVolume. Please update your code to use the new names, as the deprecated methods will be removed in a future version of the SDK.

Before (deprecated):

roomSession.setMicrophoneVolume({memberId: id, volume: -10});
roomSession.setSpeakerVolume({memberId: id, volume: -10});
member.setMicrophoneVolume({volume: -10});
member.setSpeakerVolume({volume: -10});

After:

roomSession.setInputVolume({memberId: id, volume: -10});
roomSession.setOutputVolume({memberId: id, volume: -10});
member.setInputVolume({volume: -10});
member.setOutputVolume({volume: -10});

createRoomObject and joinRoom have been deprecated

#313 5c35910

The functions createRoomObject and joinRoom have been deprecated. Their functionality has been replaced by the new RoomSession class. Please update your code to use the RoomSession class, as the deprecated methods will be removed in a future version of the SDK.

Before (deprecated):

SignalWire.Video.createRoomObject({
  token: "...",
  rootElementId: "stream",
  video: true,
}).then(roomObject => {
  roomObject.on('room.started', (e) => { console.log(e) })
  roomObject.join()
}

// or:

SignalWire.Video.joinRoom({
  token: "...",
  rootElementId: "stream",
  video: true,
}).then(roomObject => {
  // here, handlers were attached *after* joining
  roomObject.on('room.started', (e) => { console.log(e) })
}

After:

const roomSession = new SignalWire.Video.RoomSession({
  token: "...",
  rootElement: document.getElementById("stream"),  // NOTE: you should now pass an HTMLElement
  video: true,
})

roomSession.on('room.started', (e) => { console.log(e) })

roomSession.join()

createScreenShareObject has been deprecated

#318 cc5fd62

We have deprecated the createScreenShareObject in favor of the new startScreenShare. The new method is fully compatible: you can update your code by replacing roomSession.createScreenShareObject() invocations with roomSession.startScreenShare().

Breaking changes

Timestamp properties now are Date objects

#305 cec54bd

To make our API easier to use, we have converted the timestamp properties within the SDK to Date object. This breaking change only affects you if you are using the Recording features.

Assume rec is a RoomSessionRecording object of which you use the fields startedAt and endedAt. It may look like this:

myFunction(rec.startedAt)
myFunction(rec.endedAt)

If you upgrade to this version of the SDK, make sure to convert them back to a number to make the rest of your code compatible:

myFunction(+rec.startedAt)
myFunction(+rec.endedAt)

Fixes

We have included some minor bug fixes.

@signalwire/realtime-api v3.0.0-beta.0

15 Sep 16:22
b010594
Compare
Choose a tag to compare

We are excited to announce the first beta release of our server-side realtime SDK!

Highlights

With @signalwire/realtime-api you can listen for and react to events from SignalWire's RealTime APIs within your own node.js server. Get notified when room sessions start or stop, when members join or leave, when any device gets updated, control the recordings, and much more.

Installation

Install from npm:

npm install @signalwire/realtime-api

Getting started

Import the SDK:

import { createClient } from '@signalwire/realtime-api'

Obtain a realtime-api client:

const client = await createClient({
  project: '<project-id>',
  token: '<project-token>'
})

Obtain a handle to a room session whenever it starts, then mute the video of any participant that joins:

client.video.on('room.started', async (roomSession) => {
    console.log("Room started")

    roomSession.on('member.joined', async (member) => {
        await member.videoMute()
    })

    await roomSession.subscribe()
})

Finally, connect the client to start receiving the events:

await client.connect()

Resources

Learn more on our developers website: