twilio-video 2.23.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/dist/twilio-video.js +107 -41
- package/dist/twilio-video.min.js +20 -20
- package/es5/media/track/localaudiotrack.js +3 -0
- package/es5/media/track/localaudiotrack.js.map +1 -1
- package/es5/media/track/noisecancellationimpl.js +55 -25
- package/es5/media/track/noisecancellationimpl.js.map +1 -1
- package/es5/noisecancellationadapter.js +47 -14
- package/es5/noisecancellationadapter.js.map +1 -1
- package/karma/makeconf.js +2 -2
- package/lib/media/track/localaudiotrack.js +3 -0
- package/lib/media/track/noisecancellationimpl.ts +58 -25
- package/lib/noisecancellationadapter.ts +54 -13
- package/package.json +1 -1
- package/assets/noisecancellation/rnnoise/rnnoise-processor.wasm +0 -0
- package/assets/noisecancellation/rnnoise/rnnoise_processor.js +0 -103
- package/assets/noisecancellation/rnnoise/rnnoise_sdk.mjs +0 -150
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@ The Twilio Programmable Video SDKs use [Semantic Versioning](http://www.semver.o
|
|
|
2
2
|
|
|
3
3
|
**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.
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
2.24.0 (August 22, 2022)
|
|
7
|
+
========================
|
|
8
|
+
|
|
9
|
+
New Features
|
|
10
|
+
------------
|
|
11
|
+
|
|
12
|
+
- The support for twilio approved 3rd party noise cancellation solutions is now **generally available**.
|
|
13
|
+
|
|
14
|
+
Bug Fixes
|
|
15
|
+
---------
|
|
16
|
+
|
|
17
|
+
- Fixed an issue where input media track was not stopped, after `localAudioTrack.stop()` when using noiseCancellation (VIDEO-11047)
|
|
18
|
+
- Added versioning support for noise cancellation plugin. This SDK will require noise cancellation plugin to be version 1.0.0 or greater. (VIDEO-11087)
|
|
19
|
+
|
|
5
20
|
2.23.0 (July 28, 2022)
|
|
6
21
|
======================
|
|
7
22
|
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Releases of twilio-video.js are hosted on a CDN, and you can include these
|
|
|
74
74
|
directly in your web app using a <script> tag.
|
|
75
75
|
|
|
76
76
|
```html
|
|
77
|
-
<script src="//sdk.twilio.com/js/video/releases/2.
|
|
77
|
+
<script src="//sdk.twilio.com/js/video/releases/2.24.0/twilio-video.min.js"></script>
|
|
78
78
|
|
|
79
79
|
```
|
|
80
80
|
|
package/dist/twilio-video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! twilio-video.js 2.
|
|
1
|
+
/*! twilio-video.js 2.24.0
|
|
2
2
|
|
|
3
3
|
The following license applies to all parts of this software except as
|
|
4
4
|
documented below.
|
|
@@ -3127,6 +3127,9 @@ var LocalAudioTrack = /** @class */ (function (_super) {
|
|
|
3127
3127
|
* @fires LocalAudioTrack#stopped
|
|
3128
3128
|
*/
|
|
3129
3129
|
LocalAudioTrack.prototype.stop = function () {
|
|
3130
|
+
if (this.noiseCancellation) {
|
|
3131
|
+
this.noiseCancellation.stop();
|
|
3132
|
+
}
|
|
3130
3133
|
return _super.prototype.stop.apply(this, arguments);
|
|
3131
3134
|
};
|
|
3132
3135
|
return LocalAudioTrack;
|
|
@@ -4711,37 +4714,58 @@ exports.applyNoiseCancellation = exports.NoiseCancellationImpl = void 0;
|
|
|
4711
4714
|
var noisecancellationadapter_1 = require("../../noisecancellationadapter");
|
|
4712
4715
|
var Log = require('../../util/log');
|
|
4713
4716
|
/**
|
|
4714
|
-
* {@link NoiseCancellation} interface provides methods to control noise cancellation at runtime.
|
|
4715
|
-
*
|
|
4716
|
-
*
|
|
4717
|
+
* {@link NoiseCancellation} interface provides methods to control noise cancellation at runtime. This interface is exposed
|
|
4718
|
+
* on {@link LocalAudioTrack} property `noiseCancellation`. It is available only when {@link NoiseCancellationOptions} are
|
|
4719
|
+
* specified when creating a {@link LocalAudioTrack}, and the plugin is successfully loaded.
|
|
4717
4720
|
* @alias NoiseCancellation
|
|
4718
4721
|
* @interface
|
|
4719
4722
|
*
|
|
4720
4723
|
* @example
|
|
4721
4724
|
* const { connect, createLocalAudioTrack } = require('twilio-video');
|
|
4722
4725
|
*
|
|
4723
|
-
* //
|
|
4724
|
-
*
|
|
4725
|
-
* const localAudioTrack = await Video.createLocalAudioTrack({
|
|
4726
|
+
* // Create a LocalAudioTrack with Krisp noise cancellation enabled.
|
|
4727
|
+
* const localAudioTrack = await createLocalAudioTrack({
|
|
4726
4728
|
* noiseCancellationOptions: {
|
|
4727
|
-
*
|
|
4728
|
-
*
|
|
4729
|
+
* sdkAssetsPath: 'path/to/hosted/twilio/krisp/audio/plugin/1.0.0/dist',
|
|
4730
|
+
* vendor: 'krisp'
|
|
4729
4731
|
* }
|
|
4730
4732
|
* });
|
|
4731
4733
|
*
|
|
4732
|
-
*
|
|
4733
|
-
*
|
|
4734
|
-
*
|
|
4735
|
-
* //
|
|
4736
|
-
*
|
|
4734
|
+
* if (!localAudioTrack.noiseCancellation) {
|
|
4735
|
+
* // If the Krisp audio plugin fails to load, then a warning message will be logged
|
|
4736
|
+
* // in the browser console, and the "noiseCancellation" property will be set to null.
|
|
4737
|
+
* // You can still use the LocalAudioTrack to join a Room. However, it will use the
|
|
4738
|
+
* // browser's noise suppression instead of the Krisp noise cancellation. Make sure
|
|
4739
|
+
* // the "sdkAssetsPath" provided in "noiseCancellationOptions" points to the correct
|
|
4740
|
+
* // hosted path of the plugin assets.
|
|
4741
|
+
* } else {
|
|
4742
|
+
* // Join a Room with the LocalAudioTrack.
|
|
4743
|
+
* const room = await connect('token', {
|
|
4744
|
+
* name: 'my-cool-room',
|
|
4745
|
+
* tracks: [localAudioTrack]
|
|
4746
|
+
* });
|
|
4737
4747
|
*
|
|
4738
|
-
*
|
|
4739
|
-
*
|
|
4740
|
-
*
|
|
4741
|
-
*
|
|
4748
|
+
* if (!localAudioTrack.noiseCancellation.isEnabled) {
|
|
4749
|
+
* // Krisp noise cancellation is permanently disabled in Peer-to-Peer and Go Rooms.
|
|
4750
|
+
* }
|
|
4751
|
+
* }
|
|
4742
4752
|
*
|
|
4753
|
+
* //
|
|
4754
|
+
* // Enable/disable noise cancellation.
|
|
4755
|
+
* // @param {boolean} enable - whether noise cancellation should be enabled
|
|
4756
|
+
* //
|
|
4757
|
+
* function setNoiseCancellation(enable) {
|
|
4758
|
+
* const { noiseCancellation } = localAudioTrack;
|
|
4743
4759
|
* if (noiseCancellation) {
|
|
4744
|
-
*
|
|
4760
|
+
* if (enable) {
|
|
4761
|
+
* // If enabled, then the LocalAudioTrack will use the Krisp noise
|
|
4762
|
+
* // cancellation instead of the browser's noise suppression.
|
|
4763
|
+
* noiseCancellation.enable();
|
|
4764
|
+
* } else {
|
|
4765
|
+
* // If disabled, then the LocalAudioTrack will use the browser's
|
|
4766
|
+
* // noise suppression instead of the Krisp noise cancellation.
|
|
4767
|
+
* noiseCancellation.disable();
|
|
4768
|
+
* }
|
|
4745
4769
|
* }
|
|
4746
4770
|
* }
|
|
4747
4771
|
*/
|
|
@@ -4753,7 +4777,7 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4753
4777
|
}
|
|
4754
4778
|
Object.defineProperty(NoiseCancellationImpl.prototype, "vendor", {
|
|
4755
4779
|
/**
|
|
4756
|
-
*
|
|
4780
|
+
* Name of the noise cancellation vendor.
|
|
4757
4781
|
* @type {NoiseCancellationVendor}
|
|
4758
4782
|
*/
|
|
4759
4783
|
get: function () {
|
|
@@ -4764,7 +4788,7 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4764
4788
|
});
|
|
4765
4789
|
Object.defineProperty(NoiseCancellationImpl.prototype, "sourceTrack", {
|
|
4766
4790
|
/**
|
|
4767
|
-
*
|
|
4791
|
+
* The underlying MediaStreamTrack of the {@link LocalAudioTrack}.
|
|
4768
4792
|
* @type {MediaStreamTrack}
|
|
4769
4793
|
*/
|
|
4770
4794
|
get: function () {
|
|
@@ -4775,7 +4799,7 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4775
4799
|
});
|
|
4776
4800
|
Object.defineProperty(NoiseCancellationImpl.prototype, "isEnabled", {
|
|
4777
4801
|
/**
|
|
4778
|
-
*
|
|
4802
|
+
* Whether noise cancellation is enabled.
|
|
4779
4803
|
* @type {boolean}
|
|
4780
4804
|
*/
|
|
4781
4805
|
get: function () {
|
|
@@ -4785,8 +4809,10 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4785
4809
|
configurable: true
|
|
4786
4810
|
});
|
|
4787
4811
|
/**
|
|
4788
|
-
*
|
|
4789
|
-
* @returns {Promise<void>}
|
|
4812
|
+
* Enable noise cancellation.
|
|
4813
|
+
* @returns {Promise<void>} Promise that resolves when the operation is complete
|
|
4814
|
+
* @throws {Error} Throws an error if noise cancellation is disabled permanently
|
|
4815
|
+
* for the {@link LocalAudioTrack}
|
|
4790
4816
|
*/
|
|
4791
4817
|
NoiseCancellationImpl.prototype.enable = function () {
|
|
4792
4818
|
if (this._disabledPermanent) {
|
|
@@ -4796,8 +4822,8 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4796
4822
|
return Promise.resolve();
|
|
4797
4823
|
};
|
|
4798
4824
|
/**
|
|
4799
|
-
*
|
|
4800
|
-
* @returns {Promise<void>}
|
|
4825
|
+
* Disable noise cancellation.
|
|
4826
|
+
* @returns {Promise<void>} Promise that resolves when the operation is complete
|
|
4801
4827
|
*/
|
|
4802
4828
|
NoiseCancellationImpl.prototype.disable = function () {
|
|
4803
4829
|
this._processor.disable();
|
|
@@ -4839,6 +4865,13 @@ var NoiseCancellationImpl = /** @class */ (function () {
|
|
|
4839
4865
|
this._disabledPermanent = true;
|
|
4840
4866
|
return this.disable();
|
|
4841
4867
|
};
|
|
4868
|
+
/**
|
|
4869
|
+
* @private
|
|
4870
|
+
*/
|
|
4871
|
+
NoiseCancellationImpl.prototype.stop = function () {
|
|
4872
|
+
this._processor.disconnect();
|
|
4873
|
+
this._sourceTrack.stop();
|
|
4874
|
+
};
|
|
4842
4875
|
return NoiseCancellationImpl;
|
|
4843
4876
|
}());
|
|
4844
4877
|
exports.NoiseCancellationImpl = NoiseCancellationImpl;
|
|
@@ -7433,29 +7466,57 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7433
7466
|
exports.createNoiseCancellationAudioProcessor = void 0;
|
|
7434
7467
|
var Log = require('./util/log');
|
|
7435
7468
|
var dynamicImport = require('./dynamicImport');
|
|
7436
|
-
var
|
|
7437
|
-
|
|
7469
|
+
var PLUGIN_CONFIG = {
|
|
7470
|
+
krisp: {
|
|
7471
|
+
supportedVersion: '1.0.0',
|
|
7472
|
+
pluginFile: 'krispsdk.mjs'
|
|
7473
|
+
},
|
|
7474
|
+
rnnoise: {
|
|
7475
|
+
supportedVersion: '0.6.0',
|
|
7476
|
+
pluginFile: 'rnnoise_sdk.mjs'
|
|
7477
|
+
}
|
|
7478
|
+
};
|
|
7479
|
+
var ensureVersionSupported = function (_a) {
|
|
7480
|
+
var supportedVersion = _a.supportedVersion, plugin = _a.plugin, log = _a.log;
|
|
7481
|
+
if (!plugin.getVersion || !plugin.isSupported) {
|
|
7482
|
+
throw new Error('Plugin does not export getVersion/isSupported api. Are you using old version of the plugin ?');
|
|
7483
|
+
}
|
|
7484
|
+
var pluginVersion = plugin.getVersion();
|
|
7485
|
+
log.debug("Plugin Version = " + pluginVersion);
|
|
7486
|
+
var supportedVersions = supportedVersion.split('.').map(function (version) { return Number(version); });
|
|
7487
|
+
var pluginVersions = pluginVersion.split('.').map(function (version) { return Number(version); });
|
|
7488
|
+
if (supportedVersions.length !== 3 || pluginVersions.length !== 3) {
|
|
7489
|
+
throw new Error("Unsupported Plugin version format: " + supportedVersion + ", " + pluginVersion);
|
|
7490
|
+
}
|
|
7491
|
+
if (supportedVersions[0] !== pluginVersions[0]) {
|
|
7492
|
+
throw new Error("Major version mismatch: [Plugin version " + pluginVersion + "], [Supported Version " + supportedVersion + "]");
|
|
7493
|
+
}
|
|
7494
|
+
if (pluginVersions[1] < supportedVersions[1]) {
|
|
7495
|
+
throw new Error("Minor version mismatch: [Plugin version " + pluginVersion + "] < [Supported Version " + supportedVersion + "]");
|
|
7496
|
+
}
|
|
7497
|
+
var tempContext = new AudioContext();
|
|
7498
|
+
var isSupported = plugin.isSupported(tempContext);
|
|
7499
|
+
tempContext.close();
|
|
7500
|
+
if (!isSupported) {
|
|
7501
|
+
throw new Error('Noise Cancellation plugin is not supported on your browser');
|
|
7502
|
+
}
|
|
7503
|
+
};
|
|
7438
7504
|
var audioProcessors = new Map();
|
|
7439
7505
|
function createNoiseCancellationAudioProcessor(noiseCancellationOptions, log) {
|
|
7440
7506
|
return __awaiter(this, void 0, void 0, function () {
|
|
7441
|
-
var audioProcessor,
|
|
7507
|
+
var audioProcessor, pluginConfig, supportedVersion, pluginFile, rootDir, sdkFilePath, dynamicModule, plugin_1, er_1;
|
|
7442
7508
|
return __generator(this, function (_a) {
|
|
7443
7509
|
switch (_a.label) {
|
|
7444
7510
|
case 0:
|
|
7445
7511
|
audioProcessor = audioProcessors.get(noiseCancellationOptions.vendor);
|
|
7446
7512
|
if (!!audioProcessor) return [3 /*break*/, 6];
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
case 'krisp':
|
|
7451
|
-
sdkFilePath = rootDir + "/" + KRISP_PLUGIN_FILE;
|
|
7452
|
-
break;
|
|
7453
|
-
case 'rnnoise':
|
|
7454
|
-
sdkFilePath = rootDir + "/" + RNNOISE_PLUGIN_FILE;
|
|
7455
|
-
break;
|
|
7456
|
-
default:
|
|
7457
|
-
throw new Error("Unsupported NoiseCancellationOptions.vendor: " + noiseCancellationOptions.vendor);
|
|
7513
|
+
pluginConfig = PLUGIN_CONFIG[noiseCancellationOptions.vendor];
|
|
7514
|
+
if (!pluginConfig) {
|
|
7515
|
+
throw new Error("Unsupported NoiseCancellationOptions.vendor: " + noiseCancellationOptions.vendor);
|
|
7458
7516
|
}
|
|
7517
|
+
supportedVersion = pluginConfig.supportedVersion, pluginFile = pluginConfig.pluginFile;
|
|
7518
|
+
rootDir = noiseCancellationOptions.sdkAssetsPath;
|
|
7519
|
+
sdkFilePath = rootDir + "/" + pluginFile;
|
|
7459
7520
|
_a.label = 1;
|
|
7460
7521
|
case 1:
|
|
7461
7522
|
_a.trys.push([1, 5, , 6]);
|
|
@@ -7465,6 +7526,11 @@ function createNoiseCancellationAudioProcessor(noiseCancellationOptions, log) {
|
|
|
7465
7526
|
dynamicModule = _a.sent();
|
|
7466
7527
|
log.debug('Loaded noise cancellation sdk:', dynamicModule);
|
|
7467
7528
|
plugin_1 = dynamicModule.default;
|
|
7529
|
+
ensureVersionSupported({
|
|
7530
|
+
supportedVersion: supportedVersion,
|
|
7531
|
+
plugin: plugin_1,
|
|
7532
|
+
log: log
|
|
7533
|
+
});
|
|
7468
7534
|
if (!!plugin_1.isInitialized()) return [3 /*break*/, 4];
|
|
7469
7535
|
log.debug('initializing noise cancellation sdk: ', rootDir);
|
|
7470
7536
|
return [4 /*yield*/, plugin_1.init({ rootDir: rootDir })];
|
|
@@ -29461,7 +29527,7 @@ module.exports={
|
|
|
29461
29527
|
"name": "twilio-video",
|
|
29462
29528
|
"title": "Twilio Video",
|
|
29463
29529
|
"description": "Twilio Video JavaScript Library",
|
|
29464
|
-
"version": "2.
|
|
29530
|
+
"version": "2.24.0",
|
|
29465
29531
|
"homepage": "https://twilio.com",
|
|
29466
29532
|
"author": "Mark Andrus Roberts <mroberts@twilio.com>",
|
|
29467
29533
|
"contributors": [
|