Releases: signalwire/signalwire-js
@signalwire/js v3.22.0
Version 3.22 of the JavaScript SDK features another improvement for Video Room Sessions.
Improvements
- New events keep track of the connected devices' status.
e8141c0e
We have added updated
and disconnected
events for microphone, camera, and speaker devices. When listening for microphone update events with
const roomSession = new Video.RoomSession({
host: YOUR_HOST,
token: YOUR_TOKEN,
...
})
roomSession.on('microphone.updated', (payload) => {
console.debug('>> microphone.updated', payload)
});
roomSession.on('microphone.disconnected', (payload) => {
console.debug('>> microphone.disconnected', payload)
});
you will receive the following event payload if a microphone is updated:
{
previous: {
label: 'microphone array',
deviceId: '35e85417-09cf-4b07-8f21-d3c16809e5a8'
},
current: {
label: 'headset',
deviceId: '4a829c9f-812c-49d7-b272-e3077213c55e'
},
}
If the microphone is then disconnected, you will receive the following event:
{
label: 'headset',
deviceId: '4a829c9f-812c-49d7-b272-e3077213c55e'
}
@signalwire/realtime-api v3.9.1
@signalwire/js v3.21.0
Today's JavaScript SDK release includes an improvement for Video and a small fix.
Improvements
- The new method
setLocalStream
has been added to the VideoRoomSession
object to update the local media stream.aaa07479
const canvas = document.createElement("canvas");
// Interact with the canvas
const stream = canvas.captureStream(25); // 25 FPS
await roomSession.setLocalStream(stream);
See the technical reference for additional examples.
Fixes
- Improved reconnection logic under bad network conditions.
f3711f17
@signalwire/realtime-api v3.9.0
Version 3.9 of the RELAY Realtime SDK includes a couple of improvements for Voice calls.
Highlights
Enhanced Speech Recognition
Enhanced speech recognition is now available for speech collection. Prompt
and Collect
methods use a speech configuration object to specify how to collect speech. The new optional key model
enables enhanced speech recognition at an added cost with any of three possible values: enhanced
, enhanced.phone_call
, or enhanced.video
. phone_call
optimizes speech recognition for phone calls at an 8khz sample rate. video
optimizes speech recognition for video calls at a 16khz sample rate. The value enhanced
will automatically detect whether to optimize with the phone call or video setting. 4e8e5b0d
const collect = await call.collect({
speech: {
endSilenceTimeout: 1,
speechTimeout: 60,
model: "enhanced",
hints: ["one", "two", "three", "four", "five"]
},
});
const result = await collect.ended();
See our Voice pricing page for pricing information on advanced features.
Set a Maximum Price per Minute
The parameter maxPricePerMinute
has been added to call.dial
and call.connect
methods to allow users to set a maximum price limit for a call to be created. If the rate for the call is greater than this value, the call will not be created. aa31e1a0
try {
const call = await client.dialPhone({
from: "+YYYYYYYYYY",
to: "+XXXXXXXXXX",
timeout: 30,
maxPricePerMinute: 0.0075,
});
} catch (e) {
console.log("Call not completed.");
}
The cost of a call can vary by rate center and call features. In the example above, if the call charge is greater than $0.0075, the call is not created, and a 30010 error will be returned with the message, "MaxPricePerMinute was exceeded. This call's cost is XX."
@signalwire/js v3.20.0
Version 3.20 of the JavaScript SDK includes a small new feature for Video: local video stream mirroring.
Mirroring the Local Video Stream
We have exposed the property localOverlay
on a Video RoomSession
object. The method setMirrored
on this new property allows a user to mirror their local video overlay. 2e58a76b
await roomSession.localOverlay.setMirrored(true);
The mirrored local stream is sent to the SignalWire Multipoint Control Unit (MCU), muxed into a single unified stream, and visible to all participants.
You can also unset mirroring with
await roomSession.localOverlay.setMirrored(false);
@signalwire/realtime-api v3.8.0
Version 3.8 of the RELAY Realtime SDK is out now and 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 a user 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 a member
or audience
To join a Video Room with member
abilities to send and receive audio an video or audience
permissions to only receive audio and video, you must generate a Room Token with the appropriate parameters.
From a Node server
try {
let token = await axios.post(
apiurl + "/room_tokens",
{
user_name: user_name,
room_name: room_name,
join_as: "audience",
},
{ auth }
);
console.log(token.data.token);
return res.json({ token: token.data.token });
} catch (e) {
console.log(e);
return res.sendStatus(500);
}
With cURL
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"
}'
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 full 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",
});
Audience Count Event
The room.audience_count
event is available on the RoomSession
object to track the audience count. It is triggered periodically as audience participants join and leave the room session. fb83b89
@signalwire/js v3.19.0
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
@signalwire/realtime-api v3.7.0
Today we are releasing version 3.7 of the RELAY Realtime SDK. There are a couple of improvements and several fixes.
Improvements
- We have added the method
.collect()
to the Voice call object. This is similar to the input collection methodprompt
, but there is no prompt element. The collecting session can run silently until your configuration conditions are met. a937768
For example when collecting speech input:
const collect = await call.collect({
speech: {
endSilenceTimeout: 2,
speechTimeout: 10,
language: "en-US",
hints: ["sales", "support", "representative"],
},
});
const { type, speech } = await collect.ended();
-
The
playback.failed
event will now be emitted on playback failure. 9ad158b -
For SIP calls, we have added a
sessionTimeout
parameter on the methodsconnectSip
anddialSip
to include a session time limit in the SIPSession-Expires
header. The default is 600 seconds. e2c475a
Fixes
- Fixed a bug between
getRoomSessions
and nested objects in the Video client that was causing an error onrecording.stop
. fe3b0e2 - Fixed a bug to now resolve
ended()
promises in case of failure inplayback
,prompt
,recording
,detect
,collect
, ortap
methods. 9ad158b - Fixed logic in
call.received
handlers to better track state in voice calls. 45536d5
@signalwire/js v3.18.0
Version 3.18 of the JS SDK is a minor maintenance release with one improvement laying the groundwork for future features.
Improvements
- We now allow a WebRTC connection to reconnect after a network change so that, for example, a video call can continue uninterrupted despite a network blip or page refresh. 4148281
- To support this improvement, we exposed new events on
RoomSession
to detect the media state:media.connected
,media.disconnected
andmedia.reconnecting
. 4148281
@signalwire/realtime-api v3.6.0
Version 3.6.0 of the Realtime SDK is a small release and includes some improvements and a fix.
Improvements
- We have added an
inputSensitivity
type for Call recording methods to improve the recording experience with background noise. 583ef73 - We have added the
ended()
method in Voice to replace bothwaitForEnded
andwaitForResult
. 3e7ce64 - The new alias
detectAnsweringMachine(params)
has been added to theamd(params)
method onVoice.Call
for better clarity. a32413d
Fixes
- Fixed
disconnected
method on Voice Call to better handle listening for ended calls. 45248ff
Deprecations
- We are deprecating the methods
waitForEnded
andwaitForResult
in the Voice namespace. Please useended()
instead.