Skip to content

Commit f2011d8

Browse files
author
timmydoza
authored
Add adaptive simulcast (#639)
* Update SDK version and enable adaptive simulcast * Add changelog entry * Update changelog entry * Fix tests * Fix linting
1 parent 7c24cb9 commit f2011d8

File tree

5 files changed

+29
-51
lines changed

5 files changed

+29
-51
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.6.2 (February 4, 2022)
2+
3+
### Dependency Upgrades
4+
5+
- `twilio-video` has been upgraded from 2.18.2 to to 2.19.0. This new version introduces a new feature called Adaptive Simulcast. When this feature is enabled (by setting `preferredVideoCodecs: "auto"` in the [ConnectOptions](https://sdk.twilio.com/js/video/releases/2.19.0/docs/global.html#ConnectOptions)), the SDK will use VP8 simulcast, and will enable/disable simulcast layers dynamically, thus improving bandwidth and CPU usage for the publishing client. For more information, please see [this changelog entry](https://github.com/twilio/twilio-video.js/blob/master/CHANGELOG.md#2190-january-31-2022) for the [Twilio Video JS SDK](https://github.com/twilio/twilio-video.js).
6+
17
## 0.6.1 (December 17, 2021)
28

39
### Dependency Upgrades

package-lock.json

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "twilio-video-app-react",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"private": true,
55
"license": "Apache-2.0",
66
"dependencies": {
@@ -43,7 +43,7 @@
4343
"strip-color": "^0.1.0",
4444
"ts-node": "^9.1.1",
4545
"twilio": "^3.63.1",
46-
"twilio-video": "^2.18.2",
46+
"twilio-video": "^2.19.0",
4747
"typescript": "^3.8.3"
4848
},
4949
"devDependencies": {

src/utils/useConnectionOptions/useConnectionOptions.test.tsx

+2-26
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('the useConnectionOptions function', () => {
2626
dominantSpeaker: true,
2727
maxAudioBitrate: 0,
2828
networkQuality: { local: 1, remote: 1 },
29-
preferredVideoCodecs: [{ codec: 'VP8', simulcast: true }],
29+
preferredVideoCodecs: 'auto',
3030
};
3131

3232
mockUseAppState.mockImplementationOnce(() => ({ settings }));
@@ -56,34 +56,10 @@ describe('the useConnectionOptions function', () => {
5656
dominantSpeaker: true,
5757
maxAudioBitrate: 0,
5858
networkQuality: { local: 1, remote: 1 },
59-
preferredVideoCodecs: [{ codec: 'VP8', simulcast: true }],
59+
preferredVideoCodecs: 'auto',
6060
};
6161

6262
mockUseAppState.mockImplementationOnce(() => ({ settings }));
6363
expect(useConnectionOptions()).toEqual(result);
6464
});
65-
66-
it('should disable simulcast when the room type is peer to peer', () => {
67-
const settings: Settings = {
68-
trackSwitchOffMode: 'detected',
69-
dominantSpeakerPriority: 'high',
70-
bandwidthProfileMode: 'collaboration',
71-
maxAudioBitrate: '0',
72-
};
73-
74-
mockUseAppState.mockImplementationOnce(() => ({ settings, roomType: 'peer-to-peer' }));
75-
expect(useConnectionOptions()).toMatchObject({ preferredVideoCodecs: [{ codec: 'VP8', simulcast: false }] });
76-
});
77-
78-
it('should disable simulcast when the room type is "go"', () => {
79-
const settings: Settings = {
80-
trackSwitchOffMode: 'detected',
81-
dominantSpeakerPriority: 'high',
82-
bandwidthProfileMode: 'collaboration',
83-
maxAudioBitrate: '0',
84-
};
85-
86-
mockUseAppState.mockImplementationOnce(() => ({ settings, roomType: 'go' }));
87-
expect(useConnectionOptions()).toMatchObject({ preferredVideoCodecs: [{ codec: 'VP8', simulcast: false }] });
88-
});
8965
});

src/utils/useConnectionOptions/useConnectionOptions.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isMobile, removeUndefineds } from '..';
33
import { useAppState } from '../../state';
44

55
export default function useConnectionOptions() {
6-
const { roomType, settings } = useAppState();
6+
const { settings } = useAppState();
77

88
// See: https://sdk.twilio.com/js/video/releases/2.0.0/docs/global.html#ConnectOptions
99
// for available connection options.
@@ -27,11 +27,7 @@ export default function useConnectionOptions() {
2727
// Comment this line if you are playing music.
2828
maxAudioBitrate: Number(settings.maxAudioBitrate),
2929

30-
// VP8 simulcast enables the media server in a Small Group or Group Room
31-
// to adapt your encoded video quality for each RemoteParticipant based on
32-
// their individual bandwidth constraints. Simulcast should be disabled if
33-
// you are using Peer-to-Peer or 'Go' Rooms.
34-
preferredVideoCodecs: [{ codec: 'VP8', simulcast: roomType !== 'peer-to-peer' && roomType !== 'go' }],
30+
preferredVideoCodecs: 'auto',
3531

3632
//@ts-ignore - Internal use only. This property is not exposed in type definitions.
3733
environment: process.env.REACT_APP_TWILIO_ENVIRONMENT,

0 commit comments

Comments
 (0)