Skip to content

Commit 73f3df8

Browse files
Merge pull request #1888 from twilio/prep-2.24.2
Prep for 2.24.2
2 parents c8d6c20 + 9534a4e commit 73f3df8

File tree

7 files changed

+61
-53
lines changed

7 files changed

+61
-53
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ The Twilio Programmable Video SDKs use [Semantic Versioning](http://www.semver.o
22

33
**Version 1.x reached End of Life on September 8th, 2021.** See the changelog entry [here](https://www.twilio.com/changelog/end-of-life-complete-for-unsupported-versions-of-the-programmable-video-sdk). Support for the 1.x version ended on December 4th, 2020.
44

5+
2.24.2 (September 29, 2022)
6+
===========================
7+
8+
Bug Fixes
9+
---------
10+
11+
- Fixed a bug where sometimes, a `MediaClientRemoteDescFailedError` was raised when a Chrome Participant who had enabled
12+
Adaptive Simulcast (`ConnectOptions.preferredVideoCodecs = 'auto'`) tried to publish a camera Track after publishing a
13+
`<canvas>` Track. (VIDEO-11516)
14+
- Fixed an issue where the Krisp Noise Cancellation fails to load in an application where the content security policy
15+
directives `default-src self unsafe-eval` are used. (VIDEO-11537)
16+
517
2.24.1 (September 6, 2022)
618
==========================
719

@@ -73,6 +85,10 @@ function updateNoiseCancellation(enable: boolean) {
7385
}
7486

7587
```
88+
89+
**NOTE:** If your application is using the `default-src self` content security policy directive, then you should add
90+
another directive `unsafe-eval`, which is required for the Krisp Audio Plugin to load successfully.
91+
7692
2.22.2 (July 25, 2022)
7793
======================
7894

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Releases of twilio-video.js are hosted on a CDN, and you can include these
7474
directly in your web app using a &lt;script&gt; tag.
7575

7676
```html
77-
<script src="//sdk.twilio.com/js/video/releases/2.24.1/twilio-video.min.js"></script>
77+
<script src="//sdk.twilio.com/js/video/releases/2.24.2/twilio-video.min.js"></script>
7878

7979
```
8080

@@ -154,6 +154,14 @@ you should also include the following `script-src` directive:
154154
script-src https://sdk.twilio.com
155155
```
156156

157+
If you are enabling [Krisp Noise Cancellation](https://www.twilio.com/docs/video/noise-cancellation) for
158+
your local audio, and you are using the following `default-src self` directive, you should also add the
159+
`unsafe-eval` directive:
160+
161+
```
162+
default-src self unsafe-eval
163+
```
164+
157165
Keep in mind, you may need to merge these policy directives with your own if
158166
you're using other services.
159167

lib/noisecancellationadapter.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/* eslint-disable no-console */
21
'use strict';
2+
33
import { AudioProcessor } from '../tsdef/AudioProcessor';
44
import { NoiseCancellationOptions } from '../tsdef/types';
5-
const Log = require('./util/log');
65

7-
const dynamicImport = require('./vendor/dynamicimport');
6+
const dynamicImport = require('./util/dynamicimport');
7+
const Log = require('./util/log');
88

99
const PLUGIN_CONFIG = {
1010
krisp: {
@@ -16,6 +16,7 @@ const PLUGIN_CONFIG = {
1616
pluginFile: 'rnnoise_sdk.mjs'
1717
}
1818
};
19+
1920
// AudioProcessor assumes following interface from the Plugin
2021
interface NoiseCancellationPlugin {
2122
init(options: { rootDir: string }): Promise<void>;

lib/signaling/v2/peerconnection.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,16 @@ class PeerConnectionV2 extends StateMachine {
471471
if (track.kind !== 'video' || track.readyState === 'ended') {
472472
return false;
473473
}
474-
475-
const browser = util.guessBrowser();
476-
474+
// NOTE(mmalavalli): There is no guarantee that CanvasCaptureMediaStreamTracks will always have "width" and "height"
475+
// in their settings. So, we don't update the encodings if they are not present.
476+
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1367082
477+
const { height, width } = track.getSettings();
478+
if (typeof height !== 'number' || typeof width !== 'number') {
479+
return false;
480+
}
477481
// Note(mpatwardhan): always configure encodings for safari.
478482
// for chrome only when adaptive simulcast enabled.
483+
const browser = util.guessBrowser();
479484
if (browser === 'safari' || (browser === 'chrome' && this._isAdaptiveSimulcastEnabled)) {
480485
this._updateEncodings(track, encodings, trackReplaced);
481486
return true;

lib/util/dynamicimport.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
module.exports = (function(scope) {
4+
const { location, URL } = scope;
5+
if ([location, URL].some(api => !api)) {
6+
return function dynamicImportNotSupported(module) {
7+
return Promise.reject(new Error(`Failed to import: ${module}: dynamicImport is not supported`));
8+
};
9+
}
10+
scope.__twilioVideoImportedModules = {
11+
// Imported module map.
12+
};
13+
return function dynamicImport(module) {
14+
if (module in scope.__twilioVideoImportedModules) {
15+
return Promise.resolve(scope.__twilioVideoImportedModules[module]);
16+
}
17+
// NOTE(mmalavalli): Calling import() directly can cause build issues in TypeScript and Webpack
18+
// (and probably other frameworks). So, we create a Function that calls import() in its body.
19+
// eslint-disable-next-line no-new-func
20+
return new Function('scope', `return import('${new URL(module, location)}').then(m => scope.__twilioVideoImportedModules['${module}'] = m);`)(scope);
21+
};
22+
}(globalThis));

lib/vendor/dynamicimport.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/unit/spec/signaling/v2/peerconnection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ describe('PeerConnectionV2', () => {
569569
break;
570570
}
571571

572-
const tracks = [{ id: 1 }];
572+
const tracks = [{ id: 1, getSettings: () => ({ height: 0, width: 0 }) }];
573573
trackSender = makeMediaTrackSender(tracks[0]);
574574
test.pcv2.addMediaTrackSender(trackSender);
575575

@@ -655,7 +655,7 @@ describe('PeerConnectionV2', () => {
655655

656656
beforeEach(() => {
657657
test = makeTest({ offers: 1 });
658-
const tracks = [{ id: 1 }];
658+
const tracks = [{ id: 1, getSettings: () => ({ height: 0, width: 0 }) }];
659659
trackSender = makeMediaTrackSender(tracks[0]);
660660
test.pcv2.addMediaTrackSender(trackSender);
661661

0 commit comments

Comments
 (0)