@webex/web-client-media-engine 3.12.1 → 3.14.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/dist/cjs/index.js +207 -63
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +208 -64
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -2
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1163,10 +1163,9 @@ function AddEvents(Base) {
|
|
|
1163
1163
|
};
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
|
-
var _a$
|
|
1166
|
+
var _a$2$1;
|
|
1167
1167
|
var StreamEventNames;
|
|
1168
1168
|
(function (StreamEventNames) {
|
|
1169
|
-
StreamEventNames["MuteStateChange"] = "mute-state-change";
|
|
1170
1169
|
StreamEventNames["Ended"] = "stream-ended";
|
|
1171
1170
|
})(StreamEventNames || (StreamEventNames = {}));
|
|
1172
1171
|
/**
|
|
@@ -1181,25 +1180,10 @@ class _Stream {
|
|
|
1181
1180
|
constructor(stream) {
|
|
1182
1181
|
// TODO: these should be protected, but we need the helper type in ts-events
|
|
1183
1182
|
// to hide the 'emit' method from TypedEvent.
|
|
1184
|
-
this[_a$
|
|
1185
|
-
this[_b$1] = new TypedEvent$1();
|
|
1183
|
+
this[_a$2$1] = new TypedEvent$1();
|
|
1186
1184
|
this.outputStream = stream;
|
|
1187
|
-
this.handleTrackMuted = this.handleTrackMuted.bind(this);
|
|
1188
|
-
this.handleTrackUnmuted = this.handleTrackUnmuted.bind(this);
|
|
1189
1185
|
this.handleTrackEnded = this.handleTrackEnded.bind(this);
|
|
1190
|
-
this.
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Handler which is called when a track's mute event fires.
|
|
1194
|
-
*/
|
|
1195
|
-
handleTrackMuted() {
|
|
1196
|
-
this[StreamEventNames.MuteStateChange].emit(true);
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* Handler which is called when a track's unmute event fires.
|
|
1200
|
-
*/
|
|
1201
|
-
handleTrackUnmuted() {
|
|
1202
|
-
this[StreamEventNames.MuteStateChange].emit(false);
|
|
1186
|
+
this.addTrackHandlersForStreamEvents(this.outputTrack);
|
|
1203
1187
|
}
|
|
1204
1188
|
/**
|
|
1205
1189
|
* Handler which is called when a track's ended event fires.
|
|
@@ -1207,15 +1191,25 @@ class _Stream {
|
|
|
1207
1191
|
handleTrackEnded() {
|
|
1208
1192
|
this[StreamEventNames.Ended].emit();
|
|
1209
1193
|
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Helper function to add event handlers to a MediaStreamTrack. Unlike the virtual
|
|
1196
|
+
* {@link addTrackHandlers} function, which can be overridden, this function is internal to this
|
|
1197
|
+
* class and will only add the event handlers relevant to this class. It prevents, for example,
|
|
1198
|
+
* accidentally adding the same event handlers multiple times, which could happen if the virtual
|
|
1199
|
+
* `addTrackHandlers` method was called from a subclass's constructor.
|
|
1200
|
+
*
|
|
1201
|
+
* @param track - The MediaStreamTrack.
|
|
1202
|
+
*/
|
|
1203
|
+
addTrackHandlersForStreamEvents(track) {
|
|
1204
|
+
track.addEventListener('ended', this.handleTrackEnded);
|
|
1205
|
+
}
|
|
1210
1206
|
/**
|
|
1211
1207
|
* Add event handlers to a MediaStreamTrack.
|
|
1212
1208
|
*
|
|
1213
1209
|
* @param track - The MediaStreamTrack.
|
|
1214
1210
|
*/
|
|
1215
1211
|
addTrackHandlers(track) {
|
|
1216
|
-
|
|
1217
|
-
track.addEventListener('unmute', this.handleTrackUnmuted);
|
|
1218
|
-
track.addEventListener('ended', this.handleTrackEnded);
|
|
1212
|
+
this.addTrackHandlersForStreamEvents(track);
|
|
1219
1213
|
}
|
|
1220
1214
|
/**
|
|
1221
1215
|
* Remove event handlers from a MediaStreamTrack.
|
|
@@ -1223,8 +1217,6 @@ class _Stream {
|
|
|
1223
1217
|
* @param track - The MediaStreamTrack.
|
|
1224
1218
|
*/
|
|
1225
1219
|
removeTrackHandlers(track) {
|
|
1226
|
-
track.removeEventListener('mute', this.handleTrackMuted);
|
|
1227
|
-
track.removeEventListener('unmute', this.handleTrackUnmuted);
|
|
1228
1220
|
track.removeEventListener('ended', this.handleTrackEnded);
|
|
1229
1221
|
}
|
|
1230
1222
|
/**
|
|
@@ -1244,12 +1236,14 @@ class _Stream {
|
|
|
1244
1236
|
return this.outputStream.getTracks()[0];
|
|
1245
1237
|
}
|
|
1246
1238
|
}
|
|
1247
|
-
_a$
|
|
1239
|
+
_a$2$1 = StreamEventNames.Ended;
|
|
1248
1240
|
const Stream = AddEvents(_Stream);
|
|
1249
1241
|
|
|
1250
|
-
var _a$
|
|
1242
|
+
var _a$1$1, _b, _c, _d, _e;
|
|
1251
1243
|
var LocalStreamEventNames;
|
|
1252
1244
|
(function (LocalStreamEventNames) {
|
|
1245
|
+
LocalStreamEventNames["UserMuteStateChange"] = "user-mute-state-change";
|
|
1246
|
+
LocalStreamEventNames["SystemMuteStateChange"] = "system-mute-state-change";
|
|
1253
1247
|
LocalStreamEventNames["ConstraintsChange"] = "constraints-change";
|
|
1254
1248
|
LocalStreamEventNames["OutputTrackChange"] = "output-track-change";
|
|
1255
1249
|
LocalStreamEventNames["EffectAdded"] = "effect-added";
|
|
@@ -1265,12 +1259,54 @@ class _LocalStream extends Stream {
|
|
|
1265
1259
|
*/
|
|
1266
1260
|
constructor(stream) {
|
|
1267
1261
|
super(stream);
|
|
1268
|
-
this[_a$
|
|
1262
|
+
this[_a$1$1] = new TypedEvent$1();
|
|
1269
1263
|
this[_b] = new TypedEvent$1();
|
|
1270
1264
|
this[_c] = new TypedEvent$1();
|
|
1265
|
+
this[_d] = new TypedEvent$1();
|
|
1266
|
+
this[_e] = new TypedEvent$1();
|
|
1271
1267
|
this.effects = [];
|
|
1272
1268
|
this.loadingEffects = new Map();
|
|
1273
1269
|
this.inputStream = stream;
|
|
1270
|
+
this.handleTrackMutedBySystem = this.handleTrackMutedBySystem.bind(this);
|
|
1271
|
+
this.handleTrackUnmutedBySystem = this.handleTrackUnmutedBySystem.bind(this);
|
|
1272
|
+
this.addTrackHandlersForLocalStreamEvents(this.inputTrack);
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Handler which is called when a track's mute event fires.
|
|
1276
|
+
*/
|
|
1277
|
+
handleTrackMutedBySystem() {
|
|
1278
|
+
this[LocalStreamEventNames.SystemMuteStateChange].emit(true);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Handler which is called when a track's unmute event fires.
|
|
1282
|
+
*/
|
|
1283
|
+
handleTrackUnmutedBySystem() {
|
|
1284
|
+
this[LocalStreamEventNames.SystemMuteStateChange].emit(false);
|
|
1285
|
+
}
|
|
1286
|
+
/**
|
|
1287
|
+
* Helper function to add event handlers to a MediaStreamTrack. See
|
|
1288
|
+
* {@link Stream.addTrackHandlersForStreamEvents} for why this is useful.
|
|
1289
|
+
*
|
|
1290
|
+
* @param track - The MediaStreamTrack.
|
|
1291
|
+
*/
|
|
1292
|
+
addTrackHandlersForLocalStreamEvents(track) {
|
|
1293
|
+
track.addEventListener('mute', this.handleTrackMutedBySystem);
|
|
1294
|
+
track.addEventListener('unmute', this.handleTrackUnmutedBySystem);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* @inheritdoc
|
|
1298
|
+
*/
|
|
1299
|
+
addTrackHandlers(track) {
|
|
1300
|
+
super.addTrackHandlers(track);
|
|
1301
|
+
this.addTrackHandlersForLocalStreamEvents(track);
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* @inheritdoc
|
|
1305
|
+
*/
|
|
1306
|
+
removeTrackHandlers(track) {
|
|
1307
|
+
super.removeTrackHandlers(track);
|
|
1308
|
+
track.removeEventListener('mute', this.handleTrackMutedBySystem);
|
|
1309
|
+
track.removeEventListener('unmute', this.handleTrackUnmutedBySystem);
|
|
1274
1310
|
}
|
|
1275
1311
|
/**
|
|
1276
1312
|
* Get the track within the MediaStream with which this LocalStream was created.
|
|
@@ -1282,42 +1318,45 @@ class _LocalStream extends Stream {
|
|
|
1282
1318
|
return this.inputStream.getTracks()[0];
|
|
1283
1319
|
}
|
|
1284
1320
|
/**
|
|
1285
|
-
*
|
|
1321
|
+
* Check whether or not this stream is muted. This considers both whether the stream has been
|
|
1322
|
+
* muted by the user (see {@link userMuted}) and whether the stream has been muted by the system
|
|
1323
|
+
* (see {@link systemMuted}).
|
|
1324
|
+
*
|
|
1325
|
+
* @returns True if the stream is muted, false otherwise.
|
|
1286
1326
|
*/
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
super.handleTrackMuted();
|
|
1290
|
-
}
|
|
1327
|
+
get muted() {
|
|
1328
|
+
return this.userMuted || this.systemMuted;
|
|
1291
1329
|
}
|
|
1292
1330
|
/**
|
|
1293
|
-
*
|
|
1331
|
+
* Check whether or not this stream has been muted by the user. This is equivalent to checking the
|
|
1332
|
+
* MediaStreamTrack "enabled" state.
|
|
1333
|
+
*
|
|
1334
|
+
* @returns True if the stream has been muted by the user, false otherwise.
|
|
1294
1335
|
*/
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
super.handleTrackUnmuted();
|
|
1298
|
-
}
|
|
1336
|
+
get userMuted() {
|
|
1337
|
+
return !this.inputTrack.enabled;
|
|
1299
1338
|
}
|
|
1300
1339
|
/**
|
|
1301
|
-
*
|
|
1340
|
+
* Check whether or not this stream has been muted by the user. This is equivalent to checking the
|
|
1341
|
+
* MediaStreamTrack "muted" state.
|
|
1342
|
+
*
|
|
1343
|
+
* @returns True if the stream has been muted by the system, false otherwise.
|
|
1302
1344
|
*/
|
|
1303
|
-
get
|
|
1304
|
-
|
|
1305
|
-
// which the browser may mute the track, which will affect the "muted" state but not the
|
|
1306
|
-
// "enabled" state, e.g. minimizing a shared window or unplugging a shared screen.
|
|
1307
|
-
return !this.inputTrack.enabled || this.inputTrack.muted;
|
|
1345
|
+
get systemMuted() {
|
|
1346
|
+
return this.inputTrack.muted;
|
|
1308
1347
|
}
|
|
1309
1348
|
/**
|
|
1310
|
-
* Set the mute state of this stream.
|
|
1349
|
+
* Set the user mute state of this stream.
|
|
1350
|
+
*
|
|
1351
|
+
* Note: This sets the user-toggled mute state, equivalent to changing the "enabled" state of the
|
|
1352
|
+
* track. It is separate from the system-toggled mute state.
|
|
1311
1353
|
*
|
|
1312
1354
|
* @param isMuted - True to mute, false to unmute.
|
|
1313
1355
|
*/
|
|
1314
|
-
|
|
1356
|
+
setUserMuted(isMuted) {
|
|
1315
1357
|
if (this.inputTrack.enabled === isMuted) {
|
|
1316
1358
|
this.inputTrack.enabled = !isMuted;
|
|
1317
|
-
|
|
1318
|
-
if (!this.inputTrack.muted) {
|
|
1319
|
-
this[StreamEventNames.MuteStateChange].emit(isMuted);
|
|
1320
|
-
}
|
|
1359
|
+
this[LocalStreamEventNames.UserMuteStateChange].emit(isMuted);
|
|
1321
1360
|
}
|
|
1322
1361
|
}
|
|
1323
1362
|
/**
|
|
@@ -1407,13 +1446,13 @@ class _LocalStream extends Stream {
|
|
|
1407
1446
|
* @param track - The new output track of the effect.
|
|
1408
1447
|
*/
|
|
1409
1448
|
const handleEffectTrackUpdated = (track) => {
|
|
1410
|
-
var
|
|
1449
|
+
var _f;
|
|
1411
1450
|
const effectIndex = this.effects.findIndex((e) => e.id === effect.id);
|
|
1412
1451
|
if (effectIndex === this.effects.length - 1) {
|
|
1413
1452
|
this.changeOutputTrack(track);
|
|
1414
1453
|
}
|
|
1415
1454
|
else if (effectIndex >= 0) {
|
|
1416
|
-
(
|
|
1455
|
+
(_f = this.effects[effectIndex + 1]) === null || _f === void 0 ? void 0 : _f.replaceInputTrack(track);
|
|
1417
1456
|
}
|
|
1418
1457
|
else {
|
|
1419
1458
|
logger$3.error(`Effect with ID ${effect.id} not found in effects list.`);
|
|
@@ -1531,7 +1570,7 @@ class _LocalStream extends Stream {
|
|
|
1531
1570
|
});
|
|
1532
1571
|
}
|
|
1533
1572
|
}
|
|
1534
|
-
_a$
|
|
1573
|
+
_a$1$1 = LocalStreamEventNames.UserMuteStateChange, _b = LocalStreamEventNames.SystemMuteStateChange, _c = LocalStreamEventNames.ConstraintsChange, _d = LocalStreamEventNames.OutputTrackChange, _e = LocalStreamEventNames.EffectAdded;
|
|
1535
1574
|
const LocalStream = AddEvents(_LocalStream);
|
|
1536
1575
|
|
|
1537
1576
|
/**
|
|
@@ -1633,15 +1672,77 @@ class LocalMicrophoneStream extends LocalAudioStream {
|
|
|
1633
1672
|
class LocalSystemAudioStream extends LocalAudioStream {
|
|
1634
1673
|
}
|
|
1635
1674
|
|
|
1675
|
+
var _a$6;
|
|
1676
|
+
var RemoteMediaState;
|
|
1677
|
+
(function (RemoteMediaState) {
|
|
1678
|
+
RemoteMediaState["Started"] = "started";
|
|
1679
|
+
RemoteMediaState["Stopped"] = "stopped";
|
|
1680
|
+
})(RemoteMediaState || (RemoteMediaState = {}));
|
|
1681
|
+
var RemoteStreamEventNames;
|
|
1682
|
+
(function (RemoteStreamEventNames) {
|
|
1683
|
+
RemoteStreamEventNames["MediaStateChange"] = "media-state-change";
|
|
1684
|
+
})(RemoteStreamEventNames || (RemoteStreamEventNames = {}));
|
|
1636
1685
|
/**
|
|
1637
1686
|
* A stream originating from a remote peer.
|
|
1638
1687
|
*/
|
|
1639
|
-
class
|
|
1688
|
+
class _RemoteStream extends Stream {
|
|
1689
|
+
/**
|
|
1690
|
+
* Create a RemoteStream from the given values.
|
|
1691
|
+
*
|
|
1692
|
+
* @param stream - The initial output MediaStream for this Stream.
|
|
1693
|
+
*/
|
|
1694
|
+
constructor(stream) {
|
|
1695
|
+
super(stream);
|
|
1696
|
+
this[_a$6] = new TypedEvent$1();
|
|
1697
|
+
this.handleMediaStarted = this.handleMediaStarted.bind(this);
|
|
1698
|
+
this.handleMediaStopped = this.handleMediaStopped.bind(this);
|
|
1699
|
+
this.outputTrack.addEventListener('mute', this.handleMediaStopped);
|
|
1700
|
+
this.outputTrack.addEventListener('unmute', this.handleMediaStarted);
|
|
1701
|
+
}
|
|
1640
1702
|
/**
|
|
1641
1703
|
* @inheritdoc
|
|
1642
1704
|
*/
|
|
1643
|
-
|
|
1644
|
-
|
|
1705
|
+
handleMediaStarted() {
|
|
1706
|
+
this[RemoteStreamEventNames.MediaStateChange].emit(RemoteMediaState.Started);
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* @inheritdoc
|
|
1710
|
+
*/
|
|
1711
|
+
handleMediaStopped() {
|
|
1712
|
+
this[RemoteStreamEventNames.MediaStateChange].emit(RemoteMediaState.Stopped);
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Helper function to add event handlers to a MediaStreamTrack. See
|
|
1716
|
+
* {@link Stream.addTrackHandlersForStreamEvents} for why this is useful.
|
|
1717
|
+
*
|
|
1718
|
+
* @param track - The MediaStreamTrack.
|
|
1719
|
+
*/
|
|
1720
|
+
addTrackHandlersForRemoteStreamEvents(track) {
|
|
1721
|
+
track.addEventListener('mute', this.handleMediaStopped);
|
|
1722
|
+
track.addEventListener('unmute', this.handleMediaStarted);
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* @inheritdoc
|
|
1726
|
+
*/
|
|
1727
|
+
addTrackHandlers(track) {
|
|
1728
|
+
super.addTrackHandlers(track);
|
|
1729
|
+
this.addTrackHandlersForRemoteStreamEvents(track);
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* @inheritdoc
|
|
1733
|
+
*/
|
|
1734
|
+
removeTrackHandlers(track) {
|
|
1735
|
+
super.removeTrackHandlers(track);
|
|
1736
|
+
track.removeEventListener('mute', this.handleMediaStopped);
|
|
1737
|
+
track.removeEventListener('unmute', this.handleMediaStarted);
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Get whether the media on this stream has started or stopped.
|
|
1741
|
+
*
|
|
1742
|
+
* @returns The state of the media.
|
|
1743
|
+
*/
|
|
1744
|
+
get mediaState() {
|
|
1745
|
+
return this.outputTrack.muted ? RemoteMediaState.Stopped : RemoteMediaState.Started;
|
|
1645
1746
|
}
|
|
1646
1747
|
/**
|
|
1647
1748
|
* @inheritdoc
|
|
@@ -1660,6 +1761,14 @@ class RemoteStream extends Stream {
|
|
|
1660
1761
|
this.outputStream.removeTrack(oldTrack);
|
|
1661
1762
|
this.outputStream.addTrack(newTrack);
|
|
1662
1763
|
this.addTrackHandlers(newTrack);
|
|
1764
|
+
if (oldTrack.muted !== newTrack.muted) {
|
|
1765
|
+
if (newTrack.muted) {
|
|
1766
|
+
this.handleMediaStopped();
|
|
1767
|
+
}
|
|
1768
|
+
else {
|
|
1769
|
+
this.handleMediaStarted();
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1663
1772
|
// TODO: Chrome/React may not automatically refresh the media element with the new track when
|
|
1664
1773
|
// the output track has changed, so we may need to emit an event here if this is the case.
|
|
1665
1774
|
// this[StreamEventNames.OutputTrackChange].emit(newTrack);
|
|
@@ -1672,7 +1781,9 @@ class RemoteStream extends Stream {
|
|
|
1672
1781
|
// calling stop() will not automatically emit Ended, so we emit it here
|
|
1673
1782
|
this[StreamEventNames.Ended].emit();
|
|
1674
1783
|
}
|
|
1675
|
-
}
|
|
1784
|
+
}
|
|
1785
|
+
_a$6 = RemoteStreamEventNames.MediaStateChange;
|
|
1786
|
+
const RemoteStream = AddEvents(_RemoteStream);
|
|
1676
1787
|
|
|
1677
1788
|
var commonjsGlobal$3 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1678
1789
|
|
|
@@ -10276,15 +10387,15 @@ class ReceiveSlot extends EventEmitter$2 {
|
|
|
10276
10387
|
constructor(idGetter, track) {
|
|
10277
10388
|
super();
|
|
10278
10389
|
this._idGetter = idGetter;
|
|
10279
|
-
this.
|
|
10390
|
+
this.handleStreamMediaStateChange = this.handleStreamMediaStateChange.bind(this);
|
|
10280
10391
|
this.handleStreamEnded = this.handleStreamEnded.bind(this);
|
|
10281
10392
|
this._stream = new RemoteStream(new MediaStream([track]));
|
|
10282
10393
|
this._sourceState = 'no source';
|
|
10283
|
-
this._stream.on(
|
|
10394
|
+
this._stream.on(RemoteStreamEventNames.MediaStateChange, this.handleStreamMediaStateChange);
|
|
10284
10395
|
this._stream.on(StreamEventNames.Ended, this.handleStreamEnded);
|
|
10285
10396
|
}
|
|
10286
|
-
|
|
10287
|
-
if (
|
|
10397
|
+
handleStreamMediaStateChange(state) {
|
|
10398
|
+
if (state === RemoteMediaState.Stopped) {
|
|
10288
10399
|
this.emit(ReceiveSlotEvents.MediaStopped);
|
|
10289
10400
|
}
|
|
10290
10401
|
else {
|
|
@@ -10305,7 +10416,7 @@ class ReceiveSlot extends EventEmitter$2 {
|
|
|
10305
10416
|
}
|
|
10306
10417
|
}
|
|
10307
10418
|
close() {
|
|
10308
|
-
this._stream.off(
|
|
10419
|
+
this._stream.off(RemoteStreamEventNames.MediaStateChange, this.handleStreamMediaStateChange);
|
|
10309
10420
|
this._stream.off(StreamEventNames.Ended, this.handleStreamEnded);
|
|
10310
10421
|
}
|
|
10311
10422
|
get id() {
|
|
@@ -14153,14 +14264,16 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14153
14264
|
const oldStream = this.publishedStream;
|
|
14154
14265
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.OutputTrackChange, this.handleTrackChange);
|
|
14155
14266
|
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
|
|
14156
|
-
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(
|
|
14267
|
+
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
|
|
14268
|
+
oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
|
|
14157
14269
|
if (this.requested) {
|
|
14158
14270
|
yield this.replaceSenderSource(newStream);
|
|
14159
14271
|
}
|
|
14160
14272
|
this.publishedStream = newStream;
|
|
14161
14273
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.OutputTrackChange, this.handleTrackChange);
|
|
14162
14274
|
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.ConstraintsChange, this.handleStreamConstraintsChange);
|
|
14163
|
-
newStream === null || newStream === void 0 ? void 0 : newStream.on(
|
|
14275
|
+
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.UserMuteStateChange, this.handleStreamMuteStateChange);
|
|
14276
|
+
newStream === null || newStream === void 0 ? void 0 : newStream.on(LocalStreamEventNames.SystemMuteStateChange, this.handleStreamMuteStateChange);
|
|
14164
14277
|
if ((!oldStream && newStream && !newStream.muted) ||
|
|
14165
14278
|
(oldStream && !newStream && !oldStream.muted)) {
|
|
14166
14279
|
this.streamPublishStateChange.emit();
|
|
@@ -14224,6 +14337,22 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14224
14337
|
}));
|
|
14225
14338
|
});
|
|
14226
14339
|
}
|
|
14340
|
+
getRequestedBitrate(ssrc) {
|
|
14341
|
+
const index = this.senderIds.findIndex((streamId) => streamId.ssrc === ssrc);
|
|
14342
|
+
if (this.requestedIdEncodingParamsMap.has(index)) {
|
|
14343
|
+
const encodingParams = this.requestedIdEncodingParamsMap.get(index);
|
|
14344
|
+
return encodingParams === null || encodingParams === void 0 ? void 0 : encodingParams.maxPayloadBitsPerSecond;
|
|
14345
|
+
}
|
|
14346
|
+
return undefined;
|
|
14347
|
+
}
|
|
14348
|
+
getRequestedFrameSize(ssrc) {
|
|
14349
|
+
const index = this.senderIds.findIndex((streamId) => streamId.ssrc === ssrc);
|
|
14350
|
+
if (this.requestedIdEncodingParamsMap.has(index)) {
|
|
14351
|
+
const encodingParams = this.requestedIdEncodingParamsMap.get(index);
|
|
14352
|
+
return encodingParams === null || encodingParams === void 0 ? void 0 : encodingParams.maxFs;
|
|
14353
|
+
}
|
|
14354
|
+
return undefined;
|
|
14355
|
+
}
|
|
14227
14356
|
isSimulcastEnabled() {
|
|
14228
14357
|
const params = this.sender.getParameters();
|
|
14229
14358
|
return params.encodings.length > 1;
|
|
@@ -15059,6 +15188,17 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
15059
15188
|
}
|
|
15060
15189
|
});
|
|
15061
15190
|
jmpSession.sendRequests(streamRequests.map((sr) => sr._toJmpStreamRequest()));
|
|
15191
|
+
streamRequests.forEach((sr) => {
|
|
15192
|
+
var _a;
|
|
15193
|
+
const isAffectedInStreamRequest = (t) => sr.receiveSlots.some((rs) => rs.id && compareStreamIds(rs.id, t.receiverId));
|
|
15194
|
+
const affectedTransceivers = (_a = this.recvTransceivers
|
|
15195
|
+
.get(mediaType)) === null || _a === void 0 ? void 0 : _a.filter(isAffectedInStreamRequest);
|
|
15196
|
+
affectedTransceivers === null || affectedTransceivers === void 0 ? void 0 : affectedTransceivers.forEach((t) => {
|
|
15197
|
+
var _a, _b;
|
|
15198
|
+
t.requestedBitrate = sr.maxPayloadBitsPerSecond;
|
|
15199
|
+
t.requestedFrameSize = (_b = (_a = sr.codecInfos[0]) === null || _a === void 0 ? void 0 : _a.h264) === null || _b === void 0 ? void 0 : _b.maxFs;
|
|
15200
|
+
});
|
|
15201
|
+
});
|
|
15062
15202
|
};
|
|
15063
15203
|
if (((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.readyState) === 'open') {
|
|
15064
15204
|
task();
|
|
@@ -15131,6 +15271,8 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
15131
15271
|
statsToModify.mid = transceiver.mid;
|
|
15132
15272
|
statsToModify.csi = transceiver.csi;
|
|
15133
15273
|
statsToModify.calliopeMediaType = mediaType;
|
|
15274
|
+
statsToModify.requestedBitrate = transceiver.getRequestedBitrate(senderStats.ssrc);
|
|
15275
|
+
statsToModify.requestedFrameSize = transceiver.getRequestedFrameSize(senderStats.ssrc);
|
|
15134
15276
|
const trackSettings = (_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings();
|
|
15135
15277
|
if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
|
|
15136
15278
|
statsToModify.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
|
|
@@ -15153,6 +15295,8 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
15153
15295
|
statsToModify.mid = (_a = transceiver.receiveSlot.id) === null || _a === void 0 ? void 0 : _a.mid;
|
|
15154
15296
|
statsToModify.csi = transceiver.receiveSlot.currentRxCsi;
|
|
15155
15297
|
statsToModify.calliopeMediaType = mediaType;
|
|
15298
|
+
statsToModify.requestedBitrate = transceiver.requestedBitrate;
|
|
15299
|
+
statsToModify.requestedFrameSize = transceiver.requestedFrameSize;
|
|
15156
15300
|
Object.assign(statsToModify, transceiver.receiverId);
|
|
15157
15301
|
stats.set(receiverStats.id, statsToModify);
|
|
15158
15302
|
}
|
|
@@ -15203,5 +15347,5 @@ class StreamRequest {
|
|
|
15203
15347
|
|
|
15204
15348
|
const { DeviceKind } = media;
|
|
15205
15349
|
|
|
15206
|
-
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, DeviceKind, H264Codec, Logger$1 as JMPLogger, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Logger, MediaCodecMimeType, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteStream, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, Logger$2 as WebRtcCoreLogger, WebrtcCoreError, WebrtcCoreErrorType, compareReceiveSlotIds, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, createMicrophoneStream, getAudioInputDevices, getAudioOutputDevices, getDevices, getLogLevel, getMediaContent, getMediaFamily, getMediaType, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, logErrorAndThrow, setLogHandler, setLogLevel, setOnDeviceChangeHandler };
|
|
15350
|
+
export { ActiveSpeakerInfo, CodecInfo$1 as CodecInfo, ConnectionState, DeviceKind, H264Codec, Logger$1 as JMPLogger, LocalCameraStream, LocalDisplayStream, LocalMicrophoneStream, LocalStream, LocalStreamEventNames, LocalSystemAudioStream, Logger, MediaCodecMimeType, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamConnection, MultistreamConnectionEventNames, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteMediaState, RemoteStream, RemoteStreamEventNames, SendSlot, StreamEventNames, StreamRequest, WcmeError, WcmeErrorType, Logger$2 as WebRtcCoreLogger, WebrtcCoreError, WebrtcCoreErrorType, compareReceiveSlotIds, createCameraStream, createDisplayStream, createDisplayStreamWithAudio, createMicrophoneStream, getAudioInputDevices, getAudioOutputDevices, getDevices, getLogLevel, getMediaContent, getMediaFamily, getMediaType, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, logErrorAndThrow, setLogHandler, setLogLevel, setOnDeviceChangeHandler };
|
|
15207
15351
|
//# sourceMappingURL=index.js.map
|