2.14.0
2.14.0 (May 11, 2021)
New Features
This release contains a significant update to the Bandwidth Profile API. It allows for more efficient use of bandwidth and CPU in multi-party applications. In addition it provides developers with more dynamic control over which video tracks are delivered to the client and the preferred video resolution of the tracks. These capabilities are provided via the Client Track Switch Off Control and Content Preferences settings.
Existing Bandwidth Profile settings will continue to function as before, however we recommend developers update their Bandwidth Profile settings to make use of these new capabilities at their earliest convenience.
Client Track Switch Off Control
- This feature allows subscribers to control whether the media for a RemoteVideoTrack is received or not. Client Track Switch Off Control has two modes of operation:
- auto (default): The SDK determines whether tracks should be switched off based on document visibility, track attachments, and / or the visibility of video elements.
- manual: The application requests that individual tracks be switched off or on using the
RemoteVideoTrack.switchOff()
/switchOn()
methods.
- Note: If your application previously set the
maxTracks
property to limit the number of tracks visible, you should migrate to usingclientTrackSwitchOffControl
to take advantage of this feature.
Video Content Preferences
- This feature allows subscribers to specify preferences about the media that they receive on a RemoteVideoTrack. Video content preferences has two modes of operation:
- auto (default): The SDK specifies content preferences based on video element size. A RemoteVideoTrack attached to a video element with larger dimensions will get a higher quality video compared to a RemoteVideoTrack attached to a video element with smaller dimensions.
- manual: The application specifies the content preferences for individual tracks using
RemoteVideoTrack.setContentPreferences()
.
- Note: If your application previously set the
renderDimensions
property, you should migrate to usingcontentPreferencesMode
to take advantage of this feature.
Both of these features are available in Group Rooms and are enabled by default if your application specifies Bandwidth Profile Options during connect.
const { connect } = require('twilio-video');
const room = await connect(token, {
name: 'my-new-room',
bandwidthProfile: {
video: {
/* Defaults to "auto" for both features. Be sure to remove "renderDimensions" and "maxTracks". */
}
}
});
Migrating to Attach APIs
The automatic behaviors rely on applications using the attach and detach methods of RemoteVideoTrack
. If your application currently uses the underlying MediaStreamTrack
to associate Tracks to video elements, you will need to update your application to use the attach/detach methods or use the manual APIs.
Manual Controls
const room = await connect(token, {
bandwidthProfile: {
video: {
contentPreferencesMode: 'manual',
clientTrackSwitchOffControl: 'manual'
}
}
});
When manual controls are used you can operate directly on RemoteVideoTrack
to specify preferences. For example, applications can:
- Force disabling a track.
remoteTrack.switchOff();
- Enable and request QVGA video.
# Only needed if switchOff() was called first.
remoteTrack.switchOn();
remoteTrack.setContentPreferences({
renderDimensions: { width: 320, height: 240 }
});
- Request HD (720p) video.
remoteTrack.setContentPreferences({
renderDimensions: { width: 1280, height: 720 }
});
-
clientTrackSwitchOffControl
Optional property (defaults to"auto"
). When omitted or set to "auto" switches off aRemoteVideoTrack
when no video element is attached to the track, when all attached video elements of the track are not visible, or when the Document is not visible. -
contentPreferencesMode
Optional property (defaults to"auto"
). When omitted or set to"auto"
allows the SDK to select video bitrate based on dimension information of the video elements attached to eachRemoteVideoTrack
. -
renderDimensions
is deprecated and will raise a warning when set. Setting bothrenderDimensions
andcontentPreferencesMode
is not allowed and will raise an exception. -
maxTracks
is deprecated and will raise a warning when set. Setting bothmaxTracks
andclientTrackSwitchOffControl
is not allowed and will raise an exception.
Bug Fixes
- Fixed a bug where loading
twilio-video.js
resulted in page errors on Firefox Galaxy S9 simulation mode. (VIDEO-4654) - Fixed LocalDataTrackOptions TypeScript Definition to match documentation and extend properties from LocalTrackOptions. (VIDEO-5116)