@webex/internal-media-core 1.32.0 → 1.32.1
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/dist/cjs/index.js +300 -313
- package/dist/esm/index.js +195 -219
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2405,6 +2405,198 @@ var off = (eventName, listener) => {
|
|
|
2405
2405
|
eventEmitter.off(eventName, listener);
|
|
2406
2406
|
};
|
|
2407
2407
|
|
|
2408
|
+
var bnrProcessor = {
|
|
2409
|
+
isModuleAdded: false,
|
|
2410
|
+
workletProcessorUrl: 'https://models.intelligence.webex.com/bnr/1.1.0/noise-reduction-effect.worklet.js'
|
|
2411
|
+
};
|
|
2412
|
+
function isValidTrack(track) {
|
|
2413
|
+
var supportedConstraints = navigator.mediaDevices.getSupportedConstraints();
|
|
2414
|
+
var supportedSampleRates = [16000, 32000, 48000];
|
|
2415
|
+
if (supportedConstraints.sampleRate) {
|
|
2416
|
+
var settings = getTrackSettings(track);
|
|
2417
|
+
var {
|
|
2418
|
+
sampleRate
|
|
2419
|
+
} = settings;
|
|
2420
|
+
if (sampleRate && !supportedSampleRates.includes(sampleRate)) {
|
|
2421
|
+
var error = new Error("Sample rate of ".concat(sampleRate, " is not supported."));
|
|
2422
|
+
logger$5.error({
|
|
2423
|
+
ID: track.id,
|
|
2424
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2425
|
+
action: 'isValidTrack()',
|
|
2426
|
+
description: error.message,
|
|
2427
|
+
error
|
|
2428
|
+
});
|
|
2429
|
+
throw error;
|
|
2430
|
+
} else {
|
|
2431
|
+
return true;
|
|
2432
|
+
}
|
|
2433
|
+
} else {
|
|
2434
|
+
var _error = new Error('Not supported');
|
|
2435
|
+
logger$5.info({
|
|
2436
|
+
ID: track.id,
|
|
2437
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2438
|
+
action: 'isValidTrack()',
|
|
2439
|
+
description: _error.message,
|
|
2440
|
+
error: _error
|
|
2441
|
+
});
|
|
2442
|
+
return true;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
function loadProcessor() {
|
|
2446
|
+
return _loadProcessor.apply(this, arguments);
|
|
2447
|
+
}
|
|
2448
|
+
function _loadProcessor() {
|
|
2449
|
+
_loadProcessor = _asyncToGenerator__default["default"](function* () {
|
|
2450
|
+
logger$5.info({
|
|
2451
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2452
|
+
action: 'loadProcessor()',
|
|
2453
|
+
description: 'Creating and loading BNR module'
|
|
2454
|
+
});
|
|
2455
|
+
var audioContext = new AudioContext();
|
|
2456
|
+
bnrProcessor.isModuleAdded = true;
|
|
2457
|
+
bnrProcessor.audioContext = audioContext;
|
|
2458
|
+
yield audioContext.audioWorklet.addModule(bnrProcessor.workletProcessorUrl);
|
|
2459
|
+
bnrProcessor.workletNode = new AudioWorkletNode(audioContext, 'noise-reduction-worklet-processor');
|
|
2460
|
+
return audioContext;
|
|
2461
|
+
});
|
|
2462
|
+
return _loadProcessor.apply(this, arguments);
|
|
2463
|
+
}
|
|
2464
|
+
function enableBNR(_x) {
|
|
2465
|
+
return _enableBNR.apply(this, arguments);
|
|
2466
|
+
}
|
|
2467
|
+
function _enableBNR() {
|
|
2468
|
+
_enableBNR = _asyncToGenerator__default["default"](function* (track) {
|
|
2469
|
+
logger$5.debug({
|
|
2470
|
+
ID: track.id,
|
|
2471
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2472
|
+
action: 'enableBNR()',
|
|
2473
|
+
description: 'Called'
|
|
2474
|
+
});
|
|
2475
|
+
try {
|
|
2476
|
+
isValidTrack(track);
|
|
2477
|
+
var streamFromTrack = new MediaStream();
|
|
2478
|
+
streamFromTrack.addTrack(track);
|
|
2479
|
+
var workletNode;
|
|
2480
|
+
logger$5.info({
|
|
2481
|
+
ID: track.id,
|
|
2482
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2483
|
+
action: 'enableBNR()',
|
|
2484
|
+
description: 'Checking if BNR module is present already'
|
|
2485
|
+
});
|
|
2486
|
+
var oldDestinationTrack = bnrProcessor.destinationTrack;
|
|
2487
|
+
if (oldDestinationTrack && track.id === oldDestinationTrack.id) {
|
|
2488
|
+
var oldTrackErrorMsg = 'BNR is enabled on the track already';
|
|
2489
|
+
var oldTrackError = new Error(oldTrackErrorMsg);
|
|
2490
|
+
logger$5.error({
|
|
2491
|
+
ID: track.id,
|
|
2492
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2493
|
+
action: 'enableBNR()',
|
|
2494
|
+
description: oldTrackErrorMsg,
|
|
2495
|
+
error: oldTrackError
|
|
2496
|
+
});
|
|
2497
|
+
throw oldTrackError;
|
|
2498
|
+
}
|
|
2499
|
+
if (bnrProcessor.isModuleAdded) {
|
|
2500
|
+
logger$5.debug({
|
|
2501
|
+
ID: track.id,
|
|
2502
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2503
|
+
action: 'enableBNR()',
|
|
2504
|
+
description: 'Disposing existing BNR module'
|
|
2505
|
+
});
|
|
2506
|
+
workletNode = bnrProcessor.workletNode;
|
|
2507
|
+
workletNode.port.postMessage('DISPOSE');
|
|
2508
|
+
}
|
|
2509
|
+
logger$5.info({
|
|
2510
|
+
ID: track.id,
|
|
2511
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2512
|
+
action: 'enableBNR()',
|
|
2513
|
+
description: 'Creating worklet node, connecting source and destination streams'
|
|
2514
|
+
});
|
|
2515
|
+
var audioContext = yield loadProcessor();
|
|
2516
|
+
workletNode = bnrProcessor.workletNode;
|
|
2517
|
+
workletNode.port.postMessage('ENABLE');
|
|
2518
|
+
bnrProcessor.sourceNode = audioContext.createMediaStreamSource(streamFromTrack);
|
|
2519
|
+
bnrProcessor.sourceNode.connect(workletNode);
|
|
2520
|
+
bnrProcessor.destinationStream = audioContext.createMediaStreamDestination();
|
|
2521
|
+
workletNode.connect(bnrProcessor.destinationStream);
|
|
2522
|
+
logger$5.info({
|
|
2523
|
+
ID: track.id,
|
|
2524
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2525
|
+
action: 'enableBNR()',
|
|
2526
|
+
description: 'Obtaining noise reduced track and returning'
|
|
2527
|
+
});
|
|
2528
|
+
var destinationStream = bnrProcessor.destinationStream.stream;
|
|
2529
|
+
var [destinationTrack] = destinationStream.getAudioTracks();
|
|
2530
|
+
bnrProcessor.destinationTrack = destinationTrack;
|
|
2531
|
+
return destinationTrack;
|
|
2532
|
+
} catch (error) {
|
|
2533
|
+
logger$5.error({
|
|
2534
|
+
ID: track.id,
|
|
2535
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2536
|
+
action: 'enableBNR()',
|
|
2537
|
+
description: 'Error in enableBNR',
|
|
2538
|
+
error: error
|
|
2539
|
+
});
|
|
2540
|
+
throw error;
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2543
|
+
return _enableBNR.apply(this, arguments);
|
|
2544
|
+
}
|
|
2545
|
+
function disableBNR() {
|
|
2546
|
+
logger$5.debug({
|
|
2547
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2548
|
+
action: 'disableBNR()',
|
|
2549
|
+
description: 'Called'
|
|
2550
|
+
});
|
|
2551
|
+
try {
|
|
2552
|
+
var workletNode;
|
|
2553
|
+
logger$5.info({
|
|
2554
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2555
|
+
action: 'disableBNR()',
|
|
2556
|
+
description: 'Checking if BNR is enabled before disabling'
|
|
2557
|
+
});
|
|
2558
|
+
if (!bnrProcessor.isModuleAdded) {
|
|
2559
|
+
var error = new Error('Can not disable as BNR is not enabled');
|
|
2560
|
+
logger$5.error({
|
|
2561
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2562
|
+
action: 'disableBNR()',
|
|
2563
|
+
description: 'Can not disable as BNR is not enabled'
|
|
2564
|
+
});
|
|
2565
|
+
throw error;
|
|
2566
|
+
} else {
|
|
2567
|
+
logger$5.info({
|
|
2568
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2569
|
+
action: 'disableBNR()',
|
|
2570
|
+
description: 'Using existing AudioWorkletNode for disabling BNR'
|
|
2571
|
+
});
|
|
2572
|
+
workletNode = bnrProcessor.workletNode;
|
|
2573
|
+
}
|
|
2574
|
+
workletNode.port.postMessage('DISPOSE');
|
|
2575
|
+
logger$5.info({
|
|
2576
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2577
|
+
action: 'disableBNR()',
|
|
2578
|
+
description: 'Obtaining raw media stream track and removing bnr context'
|
|
2579
|
+
});
|
|
2580
|
+
var bnrDisabledStream = bnrProcessor.sourceNode.mediaStream;
|
|
2581
|
+
var [track] = bnrDisabledStream === null || bnrDisabledStream === void 0 ? void 0 : bnrDisabledStream.getAudioTracks();
|
|
2582
|
+
bnrProcessor.isModuleAdded = false;
|
|
2583
|
+
delete bnrProcessor.workletNode;
|
|
2584
|
+
delete bnrProcessor.audioContext;
|
|
2585
|
+
delete bnrProcessor.sourceNode;
|
|
2586
|
+
delete bnrProcessor.destinationStream;
|
|
2587
|
+
delete bnrProcessor.destinationTrack;
|
|
2588
|
+
return track;
|
|
2589
|
+
} catch (error) {
|
|
2590
|
+
logger$5.error({
|
|
2591
|
+
mediaType: MEDIA_STREAM_TRACK,
|
|
2592
|
+
action: 'disableBNR()',
|
|
2593
|
+
description: 'Error in disableBNR',
|
|
2594
|
+
error: error
|
|
2595
|
+
});
|
|
2596
|
+
throw error;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2408
2600
|
var ErrorCode;
|
|
2409
2601
|
(function (ErrorCode) {
|
|
2410
2602
|
ErrorCode[ErrorCode["MediaConnectionError"] = 30001] = "MediaConnectionError";
|
|
@@ -4957,7 +5149,7 @@ var ErrorTypes;
|
|
|
4957
5149
|
})(ErrorTypes || (ErrorTypes = {}));
|
|
4958
5150
|
|
|
4959
5151
|
// Overall connection state (based on the ICE and DTLS connection states)
|
|
4960
|
-
|
|
5152
|
+
exports.ConnectionState = void 0;
|
|
4961
5153
|
(function (ConnectionState) {
|
|
4962
5154
|
ConnectionState["New"] = "New";
|
|
4963
5155
|
ConnectionState["Closed"] = "Closed";
|
|
@@ -4965,7 +5157,7 @@ var ConnectionState;
|
|
|
4965
5157
|
ConnectionState["Connecting"] = "Connecting";
|
|
4966
5158
|
ConnectionState["Disconnected"] = "Disconnected";
|
|
4967
5159
|
ConnectionState["Failed"] = "Failed";
|
|
4968
|
-
})(ConnectionState || (ConnectionState = {}));
|
|
5160
|
+
})(exports.ConnectionState || (exports.ConnectionState = {}));
|
|
4969
5161
|
var ConnectionStateEvents;
|
|
4970
5162
|
(function (ConnectionStateEvents) {
|
|
4971
5163
|
ConnectionStateEvents["ConnectionStateChanged"] = "ConnectionStateChanged";
|
|
@@ -5022,17 +5214,17 @@ class ConnectionStateHandler extends EventEmitter$2 {
|
|
|
5022
5214
|
var connectionStates = [connectionState, iceState];
|
|
5023
5215
|
var mediaConnectionState;
|
|
5024
5216
|
if (connectionStates.every(value => value === 'new')) {
|
|
5025
|
-
mediaConnectionState = ConnectionState.New;
|
|
5217
|
+
mediaConnectionState = exports.ConnectionState.New;
|
|
5026
5218
|
} else if (connectionStates.some(value => value === 'closed')) {
|
|
5027
|
-
mediaConnectionState = ConnectionState.Closed;
|
|
5219
|
+
mediaConnectionState = exports.ConnectionState.Closed;
|
|
5028
5220
|
} else if (connectionStates.some(value => value === 'failed')) {
|
|
5029
|
-
mediaConnectionState = ConnectionState.Failed;
|
|
5221
|
+
mediaConnectionState = exports.ConnectionState.Failed;
|
|
5030
5222
|
} else if (connectionStates.some(value => value === 'disconnected')) {
|
|
5031
|
-
mediaConnectionState = ConnectionState.Disconnected;
|
|
5223
|
+
mediaConnectionState = exports.ConnectionState.Disconnected;
|
|
5032
5224
|
} else if (connectionStates.every(value => value === 'connected' || value === 'completed')) {
|
|
5033
|
-
mediaConnectionState = ConnectionState.Connected;
|
|
5225
|
+
mediaConnectionState = exports.ConnectionState.Connected;
|
|
5034
5226
|
} else {
|
|
5035
|
-
mediaConnectionState = ConnectionState.Connecting;
|
|
5227
|
+
mediaConnectionState = exports.ConnectionState.Connecting;
|
|
5036
5228
|
}
|
|
5037
5229
|
logger$3.log("iceConnectionState=".concat(iceState, " connectionState=").concat(connectionState, " => ").concat(this.mediaConnectionState));
|
|
5038
5230
|
return mediaConnectionState;
|
|
@@ -8782,18 +8974,18 @@ var MediaContent$1;
|
|
|
8782
8974
|
MediaContent["Main"] = "MAIN";
|
|
8783
8975
|
MediaContent["Slides"] = "SLIDES";
|
|
8784
8976
|
})(MediaContent$1 || (MediaContent$1 = {}));
|
|
8785
|
-
var Policy
|
|
8977
|
+
var Policy;
|
|
8786
8978
|
(function (Policy) {
|
|
8787
8979
|
Policy["ActiveSpeaker"] = "active-speaker";
|
|
8788
8980
|
Policy["ReceiverSelected"] = "receiver-selected";
|
|
8789
|
-
})(Policy
|
|
8790
|
-
var MediaType
|
|
8981
|
+
})(Policy || (Policy = {}));
|
|
8982
|
+
var MediaType;
|
|
8791
8983
|
(function (MediaType) {
|
|
8792
8984
|
MediaType["VideoMain"] = "VIDEO-MAIN";
|
|
8793
8985
|
MediaType["VideoSlides"] = "VIDEO-SLIDES";
|
|
8794
8986
|
MediaType["AudioMain"] = "AUDIO-MAIN";
|
|
8795
8987
|
MediaType["AudioSlides"] = "AUDIO-SLIDES";
|
|
8796
|
-
})(MediaType
|
|
8988
|
+
})(MediaType || (MediaType = {}));
|
|
8797
8989
|
function randomInteger(min, max) {
|
|
8798
8990
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
8799
8991
|
}
|
|
@@ -8811,21 +9003,21 @@ function generateCsi(mediaFamily, sceneId) {
|
|
|
8811
9003
|
}
|
|
8812
9004
|
function getMediaType(mediaFamily, mediaContent) {
|
|
8813
9005
|
if (mediaFamily === MediaFamily$1.Video && mediaContent === MediaContent$1.Main) {
|
|
8814
|
-
return MediaType
|
|
9006
|
+
return MediaType.VideoMain;
|
|
8815
9007
|
}
|
|
8816
9008
|
if (mediaFamily === MediaFamily$1.Video && mediaContent === MediaContent$1.Slides) {
|
|
8817
|
-
return MediaType
|
|
9009
|
+
return MediaType.VideoSlides;
|
|
8818
9010
|
}
|
|
8819
9011
|
if (mediaFamily === MediaFamily$1.Audio && mediaContent === MediaContent$1.Main) {
|
|
8820
|
-
return MediaType
|
|
9012
|
+
return MediaType.AudioMain;
|
|
8821
9013
|
}
|
|
8822
|
-
return MediaType
|
|
9014
|
+
return MediaType.AudioSlides;
|
|
8823
9015
|
}
|
|
8824
9016
|
function getMediaFamily(mediaType) {
|
|
8825
|
-
return [MediaType
|
|
9017
|
+
return [MediaType.VideoMain, MediaType.VideoSlides].includes(mediaType) ? MediaFamily$1.Video : MediaFamily$1.Audio;
|
|
8826
9018
|
}
|
|
8827
9019
|
function getMediaContent(mediaType) {
|
|
8828
|
-
return [MediaType
|
|
9020
|
+
return [MediaType.VideoMain, MediaType.AudioMain].includes(mediaType) ? MediaContent$1.Main : MediaContent$1.Slides;
|
|
8829
9021
|
}
|
|
8830
9022
|
var truthyOrZero = value => value === 0 || value;
|
|
8831
9023
|
function isValidStreamId(obj) {
|
|
@@ -11661,12 +11853,12 @@ class OveruseStateManager {
|
|
|
11661
11853
|
}
|
|
11662
11854
|
}
|
|
11663
11855
|
}
|
|
11664
|
-
|
|
11856
|
+
exports.ReceiveSlotEvents = void 0;
|
|
11665
11857
|
(function (ReceiveSlotEvents) {
|
|
11666
11858
|
ReceiveSlotEvents["MediaStarted"] = "media-started";
|
|
11667
11859
|
ReceiveSlotEvents["MediaStopped"] = "media-stopped";
|
|
11668
11860
|
ReceiveSlotEvents["SourceUpdate"] = "source-update";
|
|
11669
|
-
})(ReceiveSlotEvents || (ReceiveSlotEvents = {}));
|
|
11861
|
+
})(exports.ReceiveSlotEvents || (exports.ReceiveSlotEvents = {}));
|
|
11670
11862
|
class ReceiveSlot extends EventEmitter {
|
|
11671
11863
|
constructor(idGetter, track) {
|
|
11672
11864
|
super();
|
|
@@ -11681,10 +11873,10 @@ class ReceiveSlot extends EventEmitter {
|
|
|
11681
11873
|
track.addEventListener('unmute', this.handleTrackUnmuted);
|
|
11682
11874
|
}
|
|
11683
11875
|
handleTrackMuted() {
|
|
11684
|
-
this.emit(ReceiveSlotEvents.MediaStopped);
|
|
11876
|
+
this.emit(exports.ReceiveSlotEvents.MediaStopped);
|
|
11685
11877
|
}
|
|
11686
11878
|
handleTrackUnmuted() {
|
|
11687
|
-
this.emit(ReceiveSlotEvents.MediaStarted);
|
|
11879
|
+
this.emit(exports.ReceiveSlotEvents.MediaStarted);
|
|
11688
11880
|
}
|
|
11689
11881
|
removeTrackHandlers(track) {
|
|
11690
11882
|
track.removeEventListener('mute', this.handleTrackMuted);
|
|
@@ -11702,7 +11894,7 @@ class ReceiveSlot extends EventEmitter {
|
|
|
11702
11894
|
}
|
|
11703
11895
|
_updateSource(state, csi) {
|
|
11704
11896
|
this.currentRxCsi = csi;
|
|
11705
|
-
this.emit(ReceiveSlotEvents.SourceUpdate, state, csi);
|
|
11897
|
+
this.emit(exports.ReceiveSlotEvents.SourceUpdate, state, csi);
|
|
11706
11898
|
}
|
|
11707
11899
|
close() {
|
|
11708
11900
|
this._stream.getTracks().forEach(t => {
|
|
@@ -11716,7 +11908,7 @@ class ReceiveSlot extends EventEmitter {
|
|
|
11716
11908
|
return this._stream;
|
|
11717
11909
|
}
|
|
11718
11910
|
}
|
|
11719
|
-
ReceiveSlot.Events = ReceiveSlotEvents;
|
|
11911
|
+
ReceiveSlot.Events = exports.ReceiveSlotEvents;
|
|
11720
11912
|
class Transceiver {
|
|
11721
11913
|
constructor(rtcRtpTransceiver) {
|
|
11722
11914
|
this._rtcRtpTransceiver = rtcRtpTransceiver;
|
|
@@ -13838,7 +14030,7 @@ var DEFAULT_LOGGER_NAME = 'web-client-media-engine';
|
|
|
13838
14030
|
var logger$4 = Logger$3.get(DEFAULT_LOGGER_NAME);
|
|
13839
14031
|
logger$4.setLevel(Logger$3.DEBUG);
|
|
13840
14032
|
function toMediaStreamTrackKind(mediaType) {
|
|
13841
|
-
return [MediaType
|
|
14033
|
+
return [MediaType.VideoMain, MediaType.VideoSlides].includes(mediaType) ? MediaStreamTrackKind.Video : MediaStreamTrackKind.Audio;
|
|
13842
14034
|
}
|
|
13843
14035
|
function toMediaFamily(kind) {
|
|
13844
14036
|
if (kind === MediaStreamTrackKind.Video) {
|
|
@@ -13879,13 +14071,13 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13879
14071
|
this.statsManager = new StatsManager(() => this.pc.getStats(), stats => this.preProcessStats(stats));
|
|
13880
14072
|
var mainSceneId = generateSceneId();
|
|
13881
14073
|
var videoMainEncodingOptions = this.getVideoEncodingOptions();
|
|
13882
|
-
this.createSendTransceiver(MediaType
|
|
13883
|
-
this.createSendTransceiver(MediaType
|
|
14074
|
+
this.createSendTransceiver(MediaType.VideoMain, mainSceneId, videoMainEncodingOptions);
|
|
14075
|
+
this.createSendTransceiver(MediaType.AudioMain, mainSceneId);
|
|
13884
14076
|
if (this.options.floorControlledPresentation) {
|
|
13885
14077
|
var videoPresentationEncodingOptions = this.getVideoEncodingOptions();
|
|
13886
14078
|
var contentSceneId = generateSceneId();
|
|
13887
|
-
this.createSendTransceiver(MediaType
|
|
13888
|
-
this.createSendTransceiver(MediaType
|
|
14079
|
+
this.createSendTransceiver(MediaType.VideoSlides, contentSceneId, videoPresentationEncodingOptions);
|
|
14080
|
+
this.createSendTransceiver(MediaType.AudioSlides, contentSceneId);
|
|
13889
14081
|
}
|
|
13890
14082
|
}
|
|
13891
14083
|
initializePeerConnection() {
|
|
@@ -14272,7 +14464,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
14272
14464
|
});
|
|
14273
14465
|
}
|
|
14274
14466
|
enableMultistreamAudio(enabled) {
|
|
14275
|
-
var sendTransceiver = this.sendTransceivers.get(MediaType
|
|
14467
|
+
var sendTransceiver = this.sendTransceivers.get(MediaType.AudioMain);
|
|
14276
14468
|
if (sendTransceiver) {
|
|
14277
14469
|
return sendTransceiver.setActive(enabled);
|
|
14278
14470
|
}
|
|
@@ -14458,15 +14650,15 @@ class MultistreamConnection extends EventEmitter {
|
|
|
14458
14650
|
}
|
|
14459
14651
|
getAllCsis() {
|
|
14460
14652
|
return {
|
|
14461
|
-
audioMain: this.getCsiByMediaType(MediaType
|
|
14462
|
-
audioSlides: this.getCsiByMediaType(MediaType
|
|
14463
|
-
videoMain: this.getCsiByMediaType(MediaType
|
|
14464
|
-
videoSlides: this.getCsiByMediaType(MediaType
|
|
14653
|
+
audioMain: this.getCsiByMediaType(MediaType.AudioMain),
|
|
14654
|
+
audioSlides: this.getCsiByMediaType(MediaType.AudioSlides),
|
|
14655
|
+
videoMain: this.getCsiByMediaType(MediaType.VideoMain),
|
|
14656
|
+
videoSlides: this.getCsiByMediaType(MediaType.VideoSlides)
|
|
14465
14657
|
};
|
|
14466
14658
|
}
|
|
14467
14659
|
}
|
|
14468
14660
|
|
|
14469
|
-
|
|
14661
|
+
exports.Event = void 0;
|
|
14470
14662
|
(function (Event) {
|
|
14471
14663
|
Event["CONNECTION_STATE_CHANGED"] = "connectionState:changed";
|
|
14472
14664
|
Event["REMOTE_TRACK_ADDED"] = "remoteTrack:added";
|
|
@@ -14478,14 +14670,14 @@ var Event$1;
|
|
|
14478
14670
|
Event["ACTIVE_SPEAKERS_CHANGED"] = "activeSpeakers:changed";
|
|
14479
14671
|
Event["VIDEO_SOURCES_COUNT_CHANGED"] = "videoSourcesCount:changed";
|
|
14480
14672
|
Event["AUDIO_SOURCES_COUNT_CHANGED"] = "videoSourcesCount:changed";
|
|
14481
|
-
})(Event
|
|
14482
|
-
|
|
14673
|
+
})(exports.Event || (exports.Event = {}));
|
|
14674
|
+
exports.RemoteTrackType = void 0;
|
|
14483
14675
|
(function (RemoteTrackType) {
|
|
14484
14676
|
RemoteTrackType["AUDIO"] = "audio";
|
|
14485
14677
|
RemoteTrackType["VIDEO"] = "video";
|
|
14486
14678
|
RemoteTrackType["SCREENSHARE_VIDEO"] = "screenShareVideo";
|
|
14487
|
-
})(RemoteTrackType || (RemoteTrackType = {}));
|
|
14488
|
-
|
|
14679
|
+
})(exports.RemoteTrackType || (exports.RemoteTrackType = {}));
|
|
14680
|
+
exports.ErrorType = void 0;
|
|
14489
14681
|
(function (ErrorType) {
|
|
14490
14682
|
ErrorType["DOUBLECONFLICT"] = "DOUBLECONFLICT";
|
|
14491
14683
|
ErrorType["CONFLICT"] = "CONFLICT";
|
|
@@ -14496,7 +14688,7 @@ var ErrorType;
|
|
|
14496
14688
|
ErrorType["REFUSED"] = "REFUSED";
|
|
14497
14689
|
ErrorType["RETRY"] = "RETRY";
|
|
14498
14690
|
ErrorType["TIMEOUT"] = "TIMEOUT";
|
|
14499
|
-
})(ErrorType || (ErrorType = {}));
|
|
14691
|
+
})(exports.ErrorType || (exports.ErrorType = {}));
|
|
14500
14692
|
|
|
14501
14693
|
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14502
14694
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -14510,7 +14702,7 @@ var localTrackTypes = [{
|
|
|
14510
14702
|
type: 'screenShareVideo',
|
|
14511
14703
|
kind: 'video'
|
|
14512
14704
|
}];
|
|
14513
|
-
class MediaConnection
|
|
14705
|
+
class MediaConnection extends EventEmitter$3 {
|
|
14514
14706
|
constructor(mediaConnectionConfig, options, debugId) {
|
|
14515
14707
|
super();
|
|
14516
14708
|
_defineProperty__default["default"](this, "id", void 0);
|
|
@@ -14526,7 +14718,7 @@ class MediaConnection$1 extends EventEmitter$3 {
|
|
|
14526
14718
|
this.localTracks = _objectSpread$1({}, options.send);
|
|
14527
14719
|
this.id = debugId || 'MediaConnection';
|
|
14528
14720
|
this.transceivers = {};
|
|
14529
|
-
this.mediaConnectionState = ConnectionState.New;
|
|
14721
|
+
this.mediaConnectionState = exports.ConnectionState.New;
|
|
14530
14722
|
this.pc = new window.RTCPeerConnection({
|
|
14531
14723
|
iceServers: this.config.iceServers,
|
|
14532
14724
|
bundlePolicy: 'max-compat'
|
|
@@ -14725,7 +14917,7 @@ class MediaConnection$1 extends EventEmitter$3 {
|
|
|
14725
14917
|
}
|
|
14726
14918
|
onToneChange(event) {
|
|
14727
14919
|
this.log('onToneChange()', "emitting Event.DTMF_TONE_CHANGED with tone=\"".concat(event.tone, "\""));
|
|
14728
|
-
this.emit(Event
|
|
14920
|
+
this.emit(exports.Event.DTMF_TONE_CHANGED, {
|
|
14729
14921
|
tone: event.tone
|
|
14730
14922
|
});
|
|
14731
14923
|
}
|
|
@@ -14769,22 +14961,22 @@ class MediaConnection$1 extends EventEmitter$3 {
|
|
|
14769
14961
|
switch (trackMediaID) {
|
|
14770
14962
|
case MEDIA_ID.AUDIO_TRACK:
|
|
14771
14963
|
this.log('onTrack()', 'emitting Event.REMOTE_TRACK_ADDED with type=AUDIO');
|
|
14772
|
-
this.emit(Event
|
|
14773
|
-
type: RemoteTrackType.AUDIO,
|
|
14964
|
+
this.emit(exports.Event.REMOTE_TRACK_ADDED, {
|
|
14965
|
+
type: exports.RemoteTrackType.AUDIO,
|
|
14774
14966
|
track
|
|
14775
14967
|
});
|
|
14776
14968
|
break;
|
|
14777
14969
|
case MEDIA_ID.VIDEO_TRACK:
|
|
14778
14970
|
this.log('onTrack()', 'emitting Event.REMOTE_TRACK_ADDED with type=VIDEO');
|
|
14779
|
-
this.emit(Event
|
|
14780
|
-
type: RemoteTrackType.VIDEO,
|
|
14971
|
+
this.emit(exports.Event.REMOTE_TRACK_ADDED, {
|
|
14972
|
+
type: exports.RemoteTrackType.VIDEO,
|
|
14781
14973
|
track
|
|
14782
14974
|
});
|
|
14783
14975
|
break;
|
|
14784
14976
|
case MEDIA_ID.SHARE_TRACK:
|
|
14785
14977
|
this.log('onTrack()', 'emitting Event.REMOTE_TRACK_ADDED with type=SCREENSHARE_VIDEO');
|
|
14786
|
-
this.emit(Event
|
|
14787
|
-
type: RemoteTrackType.SCREENSHARE_VIDEO,
|
|
14978
|
+
this.emit(exports.Event.REMOTE_TRACK_ADDED, {
|
|
14979
|
+
type: exports.RemoteTrackType.SCREENSHARE_VIDEO,
|
|
14788
14980
|
track
|
|
14789
14981
|
});
|
|
14790
14982
|
break;
|
|
@@ -14819,19 +15011,19 @@ class MediaConnection$1 extends EventEmitter$3 {
|
|
|
14819
15011
|
var iceState = this.pc.iceConnectionState;
|
|
14820
15012
|
var connectionStates = [rtcPcConnectionState, iceState];
|
|
14821
15013
|
if (connectionStates.some(value => value === 'closed')) {
|
|
14822
|
-
this.mediaConnectionState = ConnectionState.Closed;
|
|
15014
|
+
this.mediaConnectionState = exports.ConnectionState.Closed;
|
|
14823
15015
|
} else if (connectionStates.some(value => value === 'failed')) {
|
|
14824
|
-
this.mediaConnectionState = ConnectionState.Failed;
|
|
15016
|
+
this.mediaConnectionState = exports.ConnectionState.Failed;
|
|
14825
15017
|
} else if (connectionStates.some(value => value === 'disconnected')) {
|
|
14826
|
-
this.mediaConnectionState = ConnectionState.Disconnected;
|
|
15018
|
+
this.mediaConnectionState = exports.ConnectionState.Disconnected;
|
|
14827
15019
|
} else if (connectionStates.every(value => value === 'connected' || value === 'completed')) {
|
|
14828
|
-
this.mediaConnectionState = ConnectionState.Connected;
|
|
15020
|
+
this.mediaConnectionState = exports.ConnectionState.Connected;
|
|
14829
15021
|
} else {
|
|
14830
|
-
this.mediaConnectionState = ConnectionState.Connecting;
|
|
15022
|
+
this.mediaConnectionState = exports.ConnectionState.Connecting;
|
|
14831
15023
|
}
|
|
14832
15024
|
this.log('evaluateConnectionState', "iceConnectionState=".concat(iceState, " rtcPcConnectionState=").concat(rtcPcConnectionState, " => mediaConnectionState=").concat(this.mediaConnectionState));
|
|
14833
15025
|
if (this.lastEmittedMediaConnectionState !== this.mediaConnectionState) {
|
|
14834
|
-
this.emit(Event
|
|
15026
|
+
this.emit(exports.Event.CONNECTION_STATE_CHANGED, {
|
|
14835
15027
|
state: this.mediaConnectionState
|
|
14836
15028
|
});
|
|
14837
15029
|
this.lastEmittedMediaConnectionState = this.mediaConnectionState;
|
|
@@ -22413,13 +22605,13 @@ class Roap extends EventEmitter$3 {
|
|
|
22413
22605
|
browserError: {
|
|
22414
22606
|
onEntry: (context, event) => {
|
|
22415
22607
|
this.error('FSM', "browserError state onEntry: context=".concat(JSON.stringify(context), ":"), event.data);
|
|
22416
|
-
this.emit(Event
|
|
22608
|
+
this.emit(exports.Event.ROAP_FAILURE, event.data);
|
|
22417
22609
|
}
|
|
22418
22610
|
},
|
|
22419
22611
|
remoteError: {
|
|
22420
22612
|
onEntry: (_, event) => {
|
|
22421
22613
|
this.log('FSM', 'remoteError state onEntry called, emitting Event.ROAP_FAILURE');
|
|
22422
|
-
this.emit(Event
|
|
22614
|
+
this.emit(exports.Event.ROAP_FAILURE, event.data);
|
|
22423
22615
|
}
|
|
22424
22616
|
},
|
|
22425
22617
|
idle: {
|
|
@@ -22657,9 +22849,9 @@ class Roap extends EventEmitter$3 {
|
|
|
22657
22849
|
})),
|
|
22658
22850
|
handleGlare: (_context, event) => {
|
|
22659
22851
|
if (event.tieBreaker === WEB_TIEBREAKER_VALUE) {
|
|
22660
|
-
this.sendErrorMessage(event.seq, ErrorType.DOUBLECONFLICT);
|
|
22852
|
+
this.sendErrorMessage(event.seq, exports.ErrorType.DOUBLECONFLICT);
|
|
22661
22853
|
} else {
|
|
22662
|
-
this.sendErrorMessage(event.seq, ErrorType.CONFLICT);
|
|
22854
|
+
this.sendErrorMessage(event.seq, exports.ErrorType.CONFLICT);
|
|
22663
22855
|
}
|
|
22664
22856
|
},
|
|
22665
22857
|
sendRoapOfferMessage: (context, event) => this.sendRoapOfferMessage(context.seq, event.data.sdp),
|
|
@@ -22668,10 +22860,10 @@ class Roap extends EventEmitter$3 {
|
|
|
22668
22860
|
sendRoapAnswerMessage: (context, event) => this.sendRoapAnswerMessage(context.seq, event.data.sdp),
|
|
22669
22861
|
sendStartedEvent: () => this.sendStartedEvent(),
|
|
22670
22862
|
sendDoneEvent: () => this.sendDoneEvent(),
|
|
22671
|
-
sendGenericError: context => this.sendErrorMessage(context.seq, ErrorType.FAILED),
|
|
22672
|
-
sendInvalidStateError: (_context, event) => this.sendErrorMessage(event.seq, ErrorType.INVALID_STATE),
|
|
22673
|
-
sendOutOfOrderError: (_context, event) => this.sendErrorMessage(event.seq, ErrorType.OUT_OF_ORDER),
|
|
22674
|
-
sendRetryAfterError: (_context, event) => this.sendErrorMessage(event.seq, ErrorType.FAILED, {
|
|
22863
|
+
sendGenericError: context => this.sendErrorMessage(context.seq, exports.ErrorType.FAILED),
|
|
22864
|
+
sendInvalidStateError: (_context, event) => this.sendErrorMessage(event.seq, exports.ErrorType.INVALID_STATE),
|
|
22865
|
+
sendOutOfOrderError: (_context, event) => this.sendErrorMessage(event.seq, exports.ErrorType.OUT_OF_ORDER),
|
|
22866
|
+
sendRetryAfterError: (_context, event) => this.sendErrorMessage(event.seq, exports.ErrorType.FAILED, {
|
|
22675
22867
|
retryAfter: Math.floor(Math.random() * 11)
|
|
22676
22868
|
}),
|
|
22677
22869
|
ignoreDuplicate: (_context, event) => this.log('FSM', "ignoring duplicate roap message ".concat(event.type, " with seq=").concat(event.seq)),
|
|
@@ -22689,7 +22881,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22689
22881
|
return false;
|
|
22690
22882
|
},
|
|
22691
22883
|
shouldErrorTriggerOfferRetry: (context, event) => {
|
|
22692
|
-
var retryableErrorTypes = [ErrorType.DOUBLECONFLICT, ErrorType.INVALID_STATE, ErrorType.OUT_OF_ORDER, ErrorType.RETRY];
|
|
22884
|
+
var retryableErrorTypes = [exports.ErrorType.DOUBLECONFLICT, exports.ErrorType.INVALID_STATE, exports.ErrorType.OUT_OF_ORDER, exports.ErrorType.RETRY];
|
|
22693
22885
|
if (retryableErrorTypes.includes(event.errorType)) {
|
|
22694
22886
|
if (event.seq === context.seq && context.retryCounter < MAX_RETRIES) {
|
|
22695
22887
|
this.log('FSM', "retryable error message received with matching seq and retryCounter ".concat(context.retryCounter, " < ").concat(MAX_RETRIES));
|
|
@@ -22715,7 +22907,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22715
22907
|
}
|
|
22716
22908
|
sendRoapOfferMessage(seq, sdp) {
|
|
22717
22909
|
this.log('sendRoapOfferMessage', 'emitting ROAP OFFER');
|
|
22718
|
-
this.emit(Event
|
|
22910
|
+
this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, {
|
|
22719
22911
|
roapMessage: {
|
|
22720
22912
|
seq,
|
|
22721
22913
|
messageType: 'OFFER',
|
|
@@ -22726,7 +22918,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22726
22918
|
}
|
|
22727
22919
|
sendRoapOfferResponseMessage(seq, sdp) {
|
|
22728
22920
|
this.log('sendRoapOfferResponseMessage', 'emitting ROAP OFFER RESPONSE');
|
|
22729
|
-
this.emit(Event
|
|
22921
|
+
this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, {
|
|
22730
22922
|
roapMessage: {
|
|
22731
22923
|
seq,
|
|
22732
22924
|
messageType: 'OFFER_RESPONSE',
|
|
@@ -22736,7 +22928,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22736
22928
|
}
|
|
22737
22929
|
sendRoapOkMessage(seq) {
|
|
22738
22930
|
this.log('sendRoapOkMessage', 'emitting ROAP OK');
|
|
22739
|
-
this.emit(Event
|
|
22931
|
+
this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, {
|
|
22740
22932
|
roapMessage: {
|
|
22741
22933
|
seq,
|
|
22742
22934
|
messageType: 'OK'
|
|
@@ -22745,7 +22937,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22745
22937
|
}
|
|
22746
22938
|
sendRoapAnswerMessage(seq, sdp) {
|
|
22747
22939
|
this.log('sendRoapAnswerMessage', 'emitting ROAP ANSWER');
|
|
22748
|
-
this.emit(Event
|
|
22940
|
+
this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, {
|
|
22749
22941
|
roapMessage: {
|
|
22750
22942
|
seq,
|
|
22751
22943
|
messageType: 'ANSWER',
|
|
@@ -22755,11 +22947,11 @@ class Roap extends EventEmitter$3 {
|
|
|
22755
22947
|
}
|
|
22756
22948
|
sendDoneEvent() {
|
|
22757
22949
|
this.log('sendDoneEvent', 'emitting ROAP DONE');
|
|
22758
|
-
this.emit(Event
|
|
22950
|
+
this.emit(exports.Event.ROAP_DONE);
|
|
22759
22951
|
}
|
|
22760
22952
|
sendStartedEvent() {
|
|
22761
22953
|
this.log('sendStartedEvent', 'emitting ROAP STARTED');
|
|
22762
|
-
this.emit(Event
|
|
22954
|
+
this.emit(exports.Event.ROAP_STARTED);
|
|
22763
22955
|
}
|
|
22764
22956
|
sendErrorMessage(seq, errorType) {
|
|
22765
22957
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -22767,7 +22959,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22767
22959
|
retryAfter
|
|
22768
22960
|
} = options;
|
|
22769
22961
|
this.log('sendErrorMessage', "emitting ROAP ERROR (".concat(errorType, ")"));
|
|
22770
|
-
this.emit(Event
|
|
22962
|
+
this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, {
|
|
22771
22963
|
roapMessage: {
|
|
22772
22964
|
seq,
|
|
22773
22965
|
messageType: 'ERROR',
|
|
@@ -22811,7 +23003,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22811
23003
|
if (seq < this.stateMachine.state.context.seq) {
|
|
22812
23004
|
isValid = false;
|
|
22813
23005
|
if (messageType !== 'ERROR') {
|
|
22814
|
-
errorToSend = ErrorType.OUT_OF_ORDER;
|
|
23006
|
+
errorToSend = exports.ErrorType.OUT_OF_ORDER;
|
|
22815
23007
|
this.error('validateIncomingRoapMessage', "received roap message ".concat(messageType, " with seq too low: ").concat(seq, " < ").concat(this.stateMachine.state.context.seq));
|
|
22816
23008
|
} else {
|
|
22817
23009
|
this.error('validateIncomingRoapMessage', "received ERROR message ".concat(errorType, " with seq too low: ").concat(seq, " < ").concat(this.stateMachine.state.context.seq, ", ignoring it"));
|
|
@@ -22869,7 +23061,7 @@ class Roap extends EventEmitter$3 {
|
|
|
22869
23061
|
break;
|
|
22870
23062
|
case 'ERROR':
|
|
22871
23063
|
this.error('roapMessageReceived', "Error received: seq=".concat(seq, " type=").concat(errorType, " cause=").concat(errorCause));
|
|
22872
|
-
if (errorType === ErrorType.CONFLICT) {
|
|
23064
|
+
if (errorType === exports.ErrorType.CONFLICT) {
|
|
22873
23065
|
this.error('roapMessageReceived', "CONFLICT error type received - this should never happen, because we use the tieBreaker value ".concat(WEB_TIEBREAKER_VALUE));
|
|
22874
23066
|
}
|
|
22875
23067
|
this.stateMachine.send('ERROR_ARRIVED', {
|
|
@@ -22915,18 +23107,18 @@ class RoapMediaConnection extends EventEmitter$3 {
|
|
|
22915
23107
|
getLogger().error("".concat(this.id, ":").concat(action, " ").concat(description, " ").concat(getErrorDescription(error)));
|
|
22916
23108
|
}
|
|
22917
23109
|
createMediaConnection(mediaConnectionConfig, options, debugId) {
|
|
22918
|
-
var mediaConnection = new MediaConnection
|
|
22919
|
-
mediaConnection.on(Event
|
|
22920
|
-
mediaConnection.on(Event
|
|
22921
|
-
mediaConnection.on(Event
|
|
23110
|
+
var mediaConnection = new MediaConnection(mediaConnectionConfig, options, debugId);
|
|
23111
|
+
mediaConnection.on(exports.Event.REMOTE_TRACK_ADDED, this.onRemoteTrack.bind(this));
|
|
23112
|
+
mediaConnection.on(exports.Event.CONNECTION_STATE_CHANGED, this.onConnectionStateChanged.bind(this));
|
|
23113
|
+
mediaConnection.on(exports.Event.DTMF_TONE_CHANGED, this.onDtmfToneChanged.bind(this));
|
|
22922
23114
|
return mediaConnection;
|
|
22923
23115
|
}
|
|
22924
23116
|
createRoap(debugId, seq) {
|
|
22925
23117
|
var roap = new Roap(this.createLocalOffer.bind(this), this.handleRemoteOffer.bind(this), this.handleRemoteAnswer.bind(this), debugId, seq);
|
|
22926
|
-
roap.on(Event
|
|
22927
|
-
roap.on(Event
|
|
22928
|
-
roap.on(Event
|
|
22929
|
-
roap.on(Event
|
|
23118
|
+
roap.on(exports.Event.ROAP_MESSAGE_TO_SEND, event => this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, event));
|
|
23119
|
+
roap.on(exports.Event.ROAP_STARTED, () => this.emit(exports.Event.ROAP_STARTED));
|
|
23120
|
+
roap.on(exports.Event.ROAP_DONE, () => this.emit(exports.Event.ROAP_DONE));
|
|
23121
|
+
roap.on(exports.Event.ROAP_FAILURE, error => this.emit(exports.Event.ROAP_FAILURE, error));
|
|
22930
23122
|
return roap;
|
|
22931
23123
|
}
|
|
22932
23124
|
initiateOffer() {
|
|
@@ -23023,13 +23215,13 @@ class RoapMediaConnection extends EventEmitter$3 {
|
|
|
23023
23215
|
this.roap.roapMessageReceived(roapMessage);
|
|
23024
23216
|
}
|
|
23025
23217
|
onRemoteTrack(event) {
|
|
23026
|
-
this.emit(Event
|
|
23218
|
+
this.emit(exports.Event.REMOTE_TRACK_ADDED, event);
|
|
23027
23219
|
}
|
|
23028
23220
|
onConnectionStateChanged(event) {
|
|
23029
|
-
this.emit(Event
|
|
23221
|
+
this.emit(exports.Event.CONNECTION_STATE_CHANGED, event);
|
|
23030
23222
|
}
|
|
23031
23223
|
onDtmfToneChanged(event) {
|
|
23032
|
-
this.emit(Event
|
|
23224
|
+
this.emit(exports.Event.DTMF_TONE_CHANGED, event);
|
|
23033
23225
|
}
|
|
23034
23226
|
createLocalOffer() {
|
|
23035
23227
|
return this.mediaConnection.createLocalOffer();
|
|
@@ -23374,18 +23566,18 @@ var MediaContent;
|
|
|
23374
23566
|
MediaContent["Main"] = "MAIN";
|
|
23375
23567
|
MediaContent["Slides"] = "SLIDES";
|
|
23376
23568
|
})(MediaContent || (MediaContent = {}));
|
|
23377
|
-
|
|
23569
|
+
exports.Policy = void 0;
|
|
23378
23570
|
(function (Policy) {
|
|
23379
23571
|
Policy["ActiveSpeaker"] = "active-speaker";
|
|
23380
23572
|
Policy["ReceiverSelected"] = "receiver-selected";
|
|
23381
|
-
})(Policy || (Policy = {}));
|
|
23382
|
-
|
|
23573
|
+
})(exports.Policy || (exports.Policy = {}));
|
|
23574
|
+
exports.MediaType = void 0;
|
|
23383
23575
|
(function (MediaType) {
|
|
23384
23576
|
MediaType["VideoMain"] = "VIDEO-MAIN";
|
|
23385
23577
|
MediaType["VideoSlides"] = "VIDEO-SLIDES";
|
|
23386
23578
|
MediaType["AudioMain"] = "AUDIO-MAIN";
|
|
23387
23579
|
MediaType["AudioSlides"] = "AUDIO-SLIDES";
|
|
23388
|
-
})(MediaType || (MediaType = {}));
|
|
23580
|
+
})(exports.MediaType || (exports.MediaType = {}));
|
|
23389
23581
|
var JmpSessionEvents;
|
|
23390
23582
|
(function (JmpSessionEvents) {
|
|
23391
23583
|
JmpSessionEvents["SourceIndication"] = "source-indication";
|
|
@@ -23423,18 +23615,18 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
|
|
|
23423
23615
|
floorControlledPresentation: false
|
|
23424
23616
|
});
|
|
23425
23617
|
multistreamConnection.on(MultistreamConnectionEventNames.ActiveSpeakerNotification, data => {
|
|
23426
|
-
this.emit(Event
|
|
23618
|
+
this.emit(exports.Event.ACTIVE_SPEAKERS_CHANGED, {
|
|
23427
23619
|
csis: data.csis
|
|
23428
23620
|
});
|
|
23429
23621
|
});
|
|
23430
23622
|
multistreamConnection.on(MultistreamConnectionEventNames.AudioSourceCountUpdate, (numTotalSources, numLiveSources) => {
|
|
23431
|
-
this.emit(Event
|
|
23623
|
+
this.emit(exports.Event.AUDIO_SOURCES_COUNT_CHANGED, numTotalSources, numLiveSources);
|
|
23432
23624
|
});
|
|
23433
23625
|
multistreamConnection.on(MultistreamConnectionEventNames.VideoSourceCountUpdate, (numTotalSources, numLiveSources) => {
|
|
23434
|
-
this.emit(Event
|
|
23626
|
+
this.emit(exports.Event.VIDEO_SOURCES_COUNT_CHANGED, numTotalSources, numLiveSources);
|
|
23435
23627
|
});
|
|
23436
23628
|
multistreamConnection.on(MultistreamConnectionEventNames.ConnectionStateUpdate, state => {
|
|
23437
|
-
this.emit(Event
|
|
23629
|
+
this.emit(exports.Event.CONNECTION_STATE_CHANGED, {
|
|
23438
23630
|
state
|
|
23439
23631
|
});
|
|
23440
23632
|
});
|
|
@@ -23442,10 +23634,10 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
|
|
|
23442
23634
|
}
|
|
23443
23635
|
createRoap(debugId, seq) {
|
|
23444
23636
|
var roap = new Roap(this.createLocalOffer.bind(this), this.handleRemoteOffer.bind(this), this.handleRemoteAnswer.bind(this), debugId, seq);
|
|
23445
|
-
roap.on(Event
|
|
23446
|
-
roap.on(Event
|
|
23447
|
-
roap.on(Event
|
|
23448
|
-
roap.on(Event
|
|
23637
|
+
roap.on(exports.Event.ROAP_MESSAGE_TO_SEND, event => this.emit(exports.Event.ROAP_MESSAGE_TO_SEND, event));
|
|
23638
|
+
roap.on(exports.Event.ROAP_STARTED, () => this.emit(exports.Event.ROAP_STARTED));
|
|
23639
|
+
roap.on(exports.Event.ROAP_DONE, () => this.emit(exports.Event.ROAP_DONE));
|
|
23640
|
+
roap.on(exports.Event.ROAP_FAILURE, error => this.emit(exports.Event.ROAP_FAILURE, error));
|
|
23449
23641
|
return roap;
|
|
23450
23642
|
}
|
|
23451
23643
|
initiateOffer() {
|
|
@@ -23574,221 +23766,6 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
|
|
|
23574
23766
|
|
|
23575
23767
|
var Errors = Error$1;
|
|
23576
23768
|
|
|
23577
|
-
var MediaConnections = /*#__PURE__*/Object.freeze({
|
|
23578
|
-
__proto__: null,
|
|
23579
|
-
Errors: Errors,
|
|
23580
|
-
get Event () { return Event$1; },
|
|
23581
|
-
get ConnectionState () { return ConnectionState; },
|
|
23582
|
-
get ErrorType () { return ErrorType; },
|
|
23583
|
-
get RemoteTrackType () { return RemoteTrackType; },
|
|
23584
|
-
RoapMediaConnection: RoapMediaConnection,
|
|
23585
|
-
MediaRequest: MediaRequest,
|
|
23586
|
-
ReceiveSlot: ReceiveSlot,
|
|
23587
|
-
get ReceiveSlotEvents () { return ReceiveSlotEvents; },
|
|
23588
|
-
ActiveSpeakerInfo: ActiveSpeakerInfo,
|
|
23589
|
-
CodecInfo: CodecInfo,
|
|
23590
|
-
H264Codec: H264Codec,
|
|
23591
|
-
get MediaType () { return MediaType; },
|
|
23592
|
-
get Policy () { return Policy; },
|
|
23593
|
-
ReceiverSelectedInfo: ReceiverSelectedInfo,
|
|
23594
|
-
MultistreamRoapMediaConnection: MultistreamRoapMediaConnection,
|
|
23595
|
-
setLogger: setLogger,
|
|
23596
|
-
getLogger: getLogger,
|
|
23597
|
-
getErrorDescription: getErrorDescription
|
|
23598
|
-
});
|
|
23599
|
-
|
|
23600
|
-
var bnrProcessor = {
|
|
23601
|
-
isModuleAdded: false,
|
|
23602
|
-
workletProcessorUrl: 'https://models.intelligence.webex.com/bnr/1.1.0/noise-reduction-effect.worklet.js'
|
|
23603
|
-
};
|
|
23604
|
-
function isValidTrack(track) {
|
|
23605
|
-
var supportedConstraints = navigator.mediaDevices.getSupportedConstraints();
|
|
23606
|
-
var supportedSampleRates = [16000, 32000, 48000];
|
|
23607
|
-
if (supportedConstraints.sampleRate) {
|
|
23608
|
-
var settings = getTrackSettings(track);
|
|
23609
|
-
var {
|
|
23610
|
-
sampleRate
|
|
23611
|
-
} = settings;
|
|
23612
|
-
if (sampleRate && !supportedSampleRates.includes(sampleRate)) {
|
|
23613
|
-
var error = new Error("Sample rate of ".concat(sampleRate, " is not supported."));
|
|
23614
|
-
logger$5.error({
|
|
23615
|
-
ID: track.id,
|
|
23616
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23617
|
-
action: 'isValidTrack()',
|
|
23618
|
-
description: error.message,
|
|
23619
|
-
error
|
|
23620
|
-
});
|
|
23621
|
-
throw error;
|
|
23622
|
-
} else {
|
|
23623
|
-
return true;
|
|
23624
|
-
}
|
|
23625
|
-
} else {
|
|
23626
|
-
var _error = new Error('Not supported');
|
|
23627
|
-
logger$5.info({
|
|
23628
|
-
ID: track.id,
|
|
23629
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23630
|
-
action: 'isValidTrack()',
|
|
23631
|
-
description: _error.message,
|
|
23632
|
-
error: _error
|
|
23633
|
-
});
|
|
23634
|
-
return true;
|
|
23635
|
-
}
|
|
23636
|
-
}
|
|
23637
|
-
function loadProcessor() {
|
|
23638
|
-
return _loadProcessor.apply(this, arguments);
|
|
23639
|
-
}
|
|
23640
|
-
function _loadProcessor() {
|
|
23641
|
-
_loadProcessor = _asyncToGenerator__default["default"](function* () {
|
|
23642
|
-
logger$5.info({
|
|
23643
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23644
|
-
action: 'loadProcessor()',
|
|
23645
|
-
description: 'Creating and loading BNR module'
|
|
23646
|
-
});
|
|
23647
|
-
var audioContext = new AudioContext();
|
|
23648
|
-
bnrProcessor.isModuleAdded = true;
|
|
23649
|
-
bnrProcessor.audioContext = audioContext;
|
|
23650
|
-
yield audioContext.audioWorklet.addModule(bnrProcessor.workletProcessorUrl);
|
|
23651
|
-
bnrProcessor.workletNode = new AudioWorkletNode(audioContext, 'noise-reduction-worklet-processor');
|
|
23652
|
-
return audioContext;
|
|
23653
|
-
});
|
|
23654
|
-
return _loadProcessor.apply(this, arguments);
|
|
23655
|
-
}
|
|
23656
|
-
function enableBNR(_x) {
|
|
23657
|
-
return _enableBNR.apply(this, arguments);
|
|
23658
|
-
}
|
|
23659
|
-
function _enableBNR() {
|
|
23660
|
-
_enableBNR = _asyncToGenerator__default["default"](function* (track) {
|
|
23661
|
-
logger$5.debug({
|
|
23662
|
-
ID: track.id,
|
|
23663
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23664
|
-
action: 'enableBNR()',
|
|
23665
|
-
description: 'Called'
|
|
23666
|
-
});
|
|
23667
|
-
try {
|
|
23668
|
-
isValidTrack(track);
|
|
23669
|
-
var streamFromTrack = new MediaStream();
|
|
23670
|
-
streamFromTrack.addTrack(track);
|
|
23671
|
-
var workletNode;
|
|
23672
|
-
logger$5.info({
|
|
23673
|
-
ID: track.id,
|
|
23674
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23675
|
-
action: 'enableBNR()',
|
|
23676
|
-
description: 'Checking if BNR module is present already'
|
|
23677
|
-
});
|
|
23678
|
-
var oldDestinationTrack = bnrProcessor.destinationTrack;
|
|
23679
|
-
if (oldDestinationTrack && track.id === oldDestinationTrack.id) {
|
|
23680
|
-
var oldTrackErrorMsg = 'BNR is enabled on the track already';
|
|
23681
|
-
var oldTrackError = new Error(oldTrackErrorMsg);
|
|
23682
|
-
logger$5.error({
|
|
23683
|
-
ID: track.id,
|
|
23684
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23685
|
-
action: 'enableBNR()',
|
|
23686
|
-
description: oldTrackErrorMsg,
|
|
23687
|
-
error: oldTrackError
|
|
23688
|
-
});
|
|
23689
|
-
throw oldTrackError;
|
|
23690
|
-
}
|
|
23691
|
-
if (bnrProcessor.isModuleAdded) {
|
|
23692
|
-
logger$5.debug({
|
|
23693
|
-
ID: track.id,
|
|
23694
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23695
|
-
action: 'enableBNR()',
|
|
23696
|
-
description: 'Disposing existing BNR module'
|
|
23697
|
-
});
|
|
23698
|
-
workletNode = bnrProcessor.workletNode;
|
|
23699
|
-
workletNode.port.postMessage('DISPOSE');
|
|
23700
|
-
}
|
|
23701
|
-
logger$5.info({
|
|
23702
|
-
ID: track.id,
|
|
23703
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23704
|
-
action: 'enableBNR()',
|
|
23705
|
-
description: 'Creating worklet node, connecting source and destination streams'
|
|
23706
|
-
});
|
|
23707
|
-
var audioContext = yield loadProcessor();
|
|
23708
|
-
workletNode = bnrProcessor.workletNode;
|
|
23709
|
-
workletNode.port.postMessage('ENABLE');
|
|
23710
|
-
bnrProcessor.sourceNode = audioContext.createMediaStreamSource(streamFromTrack);
|
|
23711
|
-
bnrProcessor.sourceNode.connect(workletNode);
|
|
23712
|
-
bnrProcessor.destinationStream = audioContext.createMediaStreamDestination();
|
|
23713
|
-
workletNode.connect(bnrProcessor.destinationStream);
|
|
23714
|
-
logger$5.info({
|
|
23715
|
-
ID: track.id,
|
|
23716
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23717
|
-
action: 'enableBNR()',
|
|
23718
|
-
description: 'Obtaining noise reduced track and returning'
|
|
23719
|
-
});
|
|
23720
|
-
var destinationStream = bnrProcessor.destinationStream.stream;
|
|
23721
|
-
var [destinationTrack] = destinationStream.getAudioTracks();
|
|
23722
|
-
bnrProcessor.destinationTrack = destinationTrack;
|
|
23723
|
-
return destinationTrack;
|
|
23724
|
-
} catch (error) {
|
|
23725
|
-
logger$5.error({
|
|
23726
|
-
ID: track.id,
|
|
23727
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23728
|
-
action: 'enableBNR()',
|
|
23729
|
-
description: 'Error in enableBNR',
|
|
23730
|
-
error: error
|
|
23731
|
-
});
|
|
23732
|
-
throw error;
|
|
23733
|
-
}
|
|
23734
|
-
});
|
|
23735
|
-
return _enableBNR.apply(this, arguments);
|
|
23736
|
-
}
|
|
23737
|
-
function disableBNR() {
|
|
23738
|
-
logger$5.debug({
|
|
23739
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23740
|
-
action: 'disableBNR()',
|
|
23741
|
-
description: 'Called'
|
|
23742
|
-
});
|
|
23743
|
-
try {
|
|
23744
|
-
var workletNode;
|
|
23745
|
-
logger$5.info({
|
|
23746
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23747
|
-
action: 'disableBNR()',
|
|
23748
|
-
description: 'Checking if BNR is enabled before disabling'
|
|
23749
|
-
});
|
|
23750
|
-
if (!bnrProcessor.isModuleAdded) {
|
|
23751
|
-
var error = new Error('Can not disable as BNR is not enabled');
|
|
23752
|
-
logger$5.error({
|
|
23753
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23754
|
-
action: 'disableBNR()',
|
|
23755
|
-
description: 'Can not disable as BNR is not enabled'
|
|
23756
|
-
});
|
|
23757
|
-
throw error;
|
|
23758
|
-
} else {
|
|
23759
|
-
logger$5.info({
|
|
23760
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23761
|
-
action: 'disableBNR()',
|
|
23762
|
-
description: 'Using existing AudioWorkletNode for disabling BNR'
|
|
23763
|
-
});
|
|
23764
|
-
workletNode = bnrProcessor.workletNode;
|
|
23765
|
-
}
|
|
23766
|
-
workletNode.port.postMessage('DISPOSE');
|
|
23767
|
-
logger$5.info({
|
|
23768
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23769
|
-
action: 'disableBNR()',
|
|
23770
|
-
description: 'Obtaining raw media stream track and removing bnr context'
|
|
23771
|
-
});
|
|
23772
|
-
var bnrDisabledStream = bnrProcessor.sourceNode.mediaStream;
|
|
23773
|
-
var [track] = bnrDisabledStream === null || bnrDisabledStream === void 0 ? void 0 : bnrDisabledStream.getAudioTracks();
|
|
23774
|
-
bnrProcessor.isModuleAdded = false;
|
|
23775
|
-
delete bnrProcessor.workletNode;
|
|
23776
|
-
delete bnrProcessor.audioContext;
|
|
23777
|
-
delete bnrProcessor.sourceNode;
|
|
23778
|
-
delete bnrProcessor.destinationStream;
|
|
23779
|
-
delete bnrProcessor.destinationTrack;
|
|
23780
|
-
return track;
|
|
23781
|
-
} catch (error) {
|
|
23782
|
-
logger$5.error({
|
|
23783
|
-
mediaType: MEDIA_STREAM_TRACK,
|
|
23784
|
-
action: 'disableBNR()',
|
|
23785
|
-
description: 'Error in disableBNR',
|
|
23786
|
-
error: error
|
|
23787
|
-
});
|
|
23788
|
-
throw error;
|
|
23789
|
-
}
|
|
23790
|
-
}
|
|
23791
|
-
|
|
23792
23769
|
function isBrowserSupported() {
|
|
23793
23770
|
var isSupported = false;
|
|
23794
23771
|
logger$5.info({
|
|
@@ -23818,8 +23795,18 @@ var Media = {
|
|
|
23818
23795
|
},
|
|
23819
23796
|
isBrowserSupported
|
|
23820
23797
|
};
|
|
23821
|
-
var MediaConnection = MediaConnections;
|
|
23822
23798
|
|
|
23799
|
+
exports.ActiveSpeakerInfo = ActiveSpeakerInfo;
|
|
23800
|
+
exports.CodecInfo = CodecInfo;
|
|
23801
|
+
exports.Errors = Errors;
|
|
23802
|
+
exports.H264Codec = H264Codec;
|
|
23823
23803
|
exports.Media = Media;
|
|
23824
|
-
exports.
|
|
23804
|
+
exports.MediaRequest = MediaRequest;
|
|
23805
|
+
exports.MultistreamRoapMediaConnection = MultistreamRoapMediaConnection;
|
|
23806
|
+
exports.ReceiveSlot = ReceiveSlot;
|
|
23807
|
+
exports.ReceiverSelectedInfo = ReceiverSelectedInfo;
|
|
23808
|
+
exports.RoapMediaConnection = RoapMediaConnection;
|
|
23809
|
+
exports.getErrorDescription = getErrorDescription;
|
|
23810
|
+
exports.getLogger = getLogger;
|
|
23825
23811
|
exports.isBrowserSupported = isBrowserSupported;
|
|
23812
|
+
exports.setLogger = setLogger;
|