@whereby.com/media 1.23.3 → 1.25.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/index.cjs +28 -13
- package/dist/index.d.cts +18 -4
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.mjs +28 -13
- package/dist/legacy-esm.js +28 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2578,15 +2578,30 @@ const SCREEN_SHARE_SIMULCAST_SETTINGS = {
|
|
|
2578
2578
|
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2579
2579
|
],
|
|
2580
2580
|
};
|
|
2581
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS = {
|
|
2582
|
+
encodings: [
|
|
2583
|
+
{ scaleResolutionDownBy: 4, dtx: true, maxBitrate: 150000 },
|
|
2584
|
+
{ scaleResolutionDownBy: 2, dtx: true, maxBitrate: 500000 },
|
|
2585
|
+
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2586
|
+
],
|
|
2587
|
+
};
|
|
2588
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2589
|
+
encodings: [{ scalabilityMode: "L2T2_KEY", dtx: true, maxBitrate: 1500000 }],
|
|
2590
|
+
};
|
|
2581
2591
|
const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2582
2592
|
encodings: [{ dtx: true }],
|
|
2583
2593
|
};
|
|
2584
|
-
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2594
|
+
const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
|
|
2585
2595
|
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2586
2596
|
if (kind === "audio") {
|
|
2587
2597
|
return AUDIO_SETTINGS;
|
|
2588
2598
|
}
|
|
2589
2599
|
if (isScreenShare) {
|
|
2600
|
+
if (isSomeoneAlreadyPresenting) {
|
|
2601
|
+
if (vp9On)
|
|
2602
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
|
|
2603
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS;
|
|
2604
|
+
}
|
|
2590
2605
|
if (lowBandwidth && !vp9On)
|
|
2591
2606
|
return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
|
|
2592
2607
|
if (vp9On)
|
|
@@ -2676,10 +2691,11 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
2676
2691
|
}
|
|
2677
2692
|
function sortCodecs(codecs, features) {
|
|
2678
2693
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2694
|
+
codecs = sortCodecsByMimeType(codecs, features);
|
|
2679
2695
|
if (features.preferHardwareDecodingOn) {
|
|
2680
2696
|
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2681
2697
|
}
|
|
2682
|
-
return
|
|
2698
|
+
return codecs;
|
|
2683
2699
|
});
|
|
2684
2700
|
}
|
|
2685
2701
|
|
|
@@ -3866,7 +3882,7 @@ class P2pRtcManager {
|
|
|
3866
3882
|
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3867
3883
|
vp9On: p2pVp9On,
|
|
3868
3884
|
av1On: p2pAv1On,
|
|
3869
|
-
preferHardwareDecodingOn: preferP2pHardwareDecodingOn,
|
|
3885
|
+
preferHardwareDecodingOn: p2pVp9On || preferP2pHardwareDecodingOn,
|
|
3870
3886
|
});
|
|
3871
3887
|
}
|
|
3872
3888
|
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
@@ -5705,7 +5721,7 @@ class VegaRtcManager {
|
|
|
5705
5721
|
this._screenVideoProducerPromise = null;
|
|
5706
5722
|
return;
|
|
5707
5723
|
}
|
|
5708
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5724
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }), this._getIsSomeoneAlreadyPresenting())), { appData: {
|
|
5709
5725
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5710
5726
|
sourceClientId: this._selfId,
|
|
5711
5727
|
screenShare: true,
|
|
@@ -5845,6 +5861,9 @@ class VegaRtcManager {
|
|
|
5845
5861
|
producer.appData.localClosed = true;
|
|
5846
5862
|
producer.close();
|
|
5847
5863
|
}
|
|
5864
|
+
_getIsSomeoneAlreadyPresenting() {
|
|
5865
|
+
return !![...this._clientStates.values()].find((state) => state.hasAcceptedScreenStream && state.screenStream);
|
|
5866
|
+
}
|
|
5848
5867
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
5849
5868
|
return this._selfId === selfId && this._room.name === roomName && Boolean(isSfu);
|
|
5850
5869
|
}
|
|
@@ -5874,8 +5893,8 @@ class VegaRtcManager {
|
|
|
5874
5893
|
disconnect(clientIdOrStreamId, _activeBreakout, eventClaim) {
|
|
5875
5894
|
var _a;
|
|
5876
5895
|
logger$3.info("disconnect() [clientIdOrStreamId:%s, eventClaim:%s]", clientIdOrStreamId, eventClaim);
|
|
5877
|
-
|
|
5878
|
-
|
|
5896
|
+
const clientState = this._clientStates.get(clientIdOrStreamId);
|
|
5897
|
+
if (clientState) {
|
|
5879
5898
|
clientState.hasAcceptedWebcamStream = false;
|
|
5880
5899
|
clientState.hasAcceptedScreenStream = false;
|
|
5881
5900
|
this._syncIncomingStreamsWithPWA(clientIdOrStreamId);
|
|
@@ -6323,13 +6342,13 @@ class VegaRtcManager {
|
|
|
6323
6342
|
this._streamIdToVideoConsumerId.delete(stream.id);
|
|
6324
6343
|
this._streamIdToVideoResolution.delete(stream.id);
|
|
6325
6344
|
if (screenShare) {
|
|
6326
|
-
clientState.screenStream =
|
|
6345
|
+
clientState.screenStream = undefined;
|
|
6327
6346
|
clientState.hasEmittedScreenStream = false;
|
|
6328
|
-
clientState.screenShareStreamId =
|
|
6347
|
+
clientState.screenShareStreamId = undefined;
|
|
6329
6348
|
}
|
|
6330
6349
|
else {
|
|
6331
6350
|
clientState.hasEmittedWebcamStream = false;
|
|
6332
|
-
clientState.camStreamId =
|
|
6351
|
+
clientState.camStreamId = undefined;
|
|
6333
6352
|
}
|
|
6334
6353
|
}
|
|
6335
6354
|
}
|
|
@@ -6395,10 +6414,6 @@ class VegaRtcManager {
|
|
|
6395
6414
|
hasAcceptedScreenStream: false,
|
|
6396
6415
|
hasEmittedWebcamStream: false,
|
|
6397
6416
|
hasEmittedScreenStream: false,
|
|
6398
|
-
webcamStream: null,
|
|
6399
|
-
screenStream: null,
|
|
6400
|
-
screenShareStreamId: null,
|
|
6401
|
-
camStreamId: null,
|
|
6402
6417
|
};
|
|
6403
6418
|
this._clientStates.set(clientId, clientState);
|
|
6404
6419
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -601,7 +601,7 @@ declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
|
601
601
|
simulcastScreenshareOn?: boolean;
|
|
602
602
|
lowBandwidth?: boolean;
|
|
603
603
|
vp9On?: boolean;
|
|
604
|
-
}) => {
|
|
604
|
+
}, isSomeoneAlreadyPresenting?: boolean) => {
|
|
605
605
|
encodings: {}[];
|
|
606
606
|
};
|
|
607
607
|
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
@@ -1355,6 +1355,19 @@ declare function createVegaConnectionManager(config: {
|
|
|
1355
1355
|
networkIsPossiblyDown: () => void;
|
|
1356
1356
|
};
|
|
1357
1357
|
|
|
1358
|
+
type MediaSteamWhichMayHaveInboundId = MediaStream & {
|
|
1359
|
+
inboundId?: string;
|
|
1360
|
+
};
|
|
1361
|
+
type ClientState = {
|
|
1362
|
+
hasAcceptedWebcamStream: Boolean;
|
|
1363
|
+
hasAcceptedScreenStream: Boolean;
|
|
1364
|
+
hasEmittedWebcamStream: Boolean;
|
|
1365
|
+
hasEmittedScreenStream: Boolean;
|
|
1366
|
+
webcamStream?: MediaSteamWhichMayHaveInboundId;
|
|
1367
|
+
screenStream?: MediaSteamWhichMayHaveInboundId;
|
|
1368
|
+
screenShareStreamId?: string;
|
|
1369
|
+
camStreamId?: string;
|
|
1370
|
+
};
|
|
1358
1371
|
declare class VegaRtcManager implements RtcManager {
|
|
1359
1372
|
_selfId: any;
|
|
1360
1373
|
_room: any;
|
|
@@ -1371,7 +1384,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1371
1384
|
_routerRtpCapabilities: any;
|
|
1372
1385
|
_sendTransport: any;
|
|
1373
1386
|
_receiveTransport: any;
|
|
1374
|
-
_clientStates:
|
|
1387
|
+
_clientStates: Map<string, ClientState>;
|
|
1375
1388
|
_streamIdToVideoConsumerId: any;
|
|
1376
1389
|
_streamIdToVideoResolution: Map<string, {
|
|
1377
1390
|
width: number;
|
|
@@ -1463,6 +1476,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1463
1476
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1464
1477
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1465
1478
|
_stopProducer(producer: any): void;
|
|
1479
|
+
_getIsSomeoneAlreadyPresenting(): boolean;
|
|
1466
1480
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1467
1481
|
selfId: string;
|
|
1468
1482
|
roomName: string;
|
|
@@ -1534,13 +1548,13 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1534
1548
|
}): void;
|
|
1535
1549
|
_consumerClosedCleanup(consumer: any): void;
|
|
1536
1550
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1537
|
-
_getOrCreateClientState(clientId: string):
|
|
1551
|
+
_getOrCreateClientState(clientId: string): ClientState;
|
|
1538
1552
|
_emitToPWA(eventName: string, data?: any): void;
|
|
1539
1553
|
_emitToSignal(eventName: string, data?: any, callback?: any): void;
|
|
1540
1554
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
1541
1555
|
setMicAnalyserDebugger(analyserDebugger: any): void;
|
|
1542
1556
|
setMicAnalyserParams(params: any): void;
|
|
1543
|
-
hasClient(clientId: string):
|
|
1557
|
+
hasClient(clientId: string): boolean;
|
|
1544
1558
|
}
|
|
1545
1559
|
|
|
1546
1560
|
declare const EVENTS: Record<string, keyof RtcEvents>;
|
package/dist/index.d.mts
CHANGED
|
@@ -601,7 +601,7 @@ declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
|
601
601
|
simulcastScreenshareOn?: boolean;
|
|
602
602
|
lowBandwidth?: boolean;
|
|
603
603
|
vp9On?: boolean;
|
|
604
|
-
}) => {
|
|
604
|
+
}, isSomeoneAlreadyPresenting?: boolean) => {
|
|
605
605
|
encodings: {}[];
|
|
606
606
|
};
|
|
607
607
|
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
@@ -1355,6 +1355,19 @@ declare function createVegaConnectionManager(config: {
|
|
|
1355
1355
|
networkIsPossiblyDown: () => void;
|
|
1356
1356
|
};
|
|
1357
1357
|
|
|
1358
|
+
type MediaSteamWhichMayHaveInboundId = MediaStream & {
|
|
1359
|
+
inboundId?: string;
|
|
1360
|
+
};
|
|
1361
|
+
type ClientState = {
|
|
1362
|
+
hasAcceptedWebcamStream: Boolean;
|
|
1363
|
+
hasAcceptedScreenStream: Boolean;
|
|
1364
|
+
hasEmittedWebcamStream: Boolean;
|
|
1365
|
+
hasEmittedScreenStream: Boolean;
|
|
1366
|
+
webcamStream?: MediaSteamWhichMayHaveInboundId;
|
|
1367
|
+
screenStream?: MediaSteamWhichMayHaveInboundId;
|
|
1368
|
+
screenShareStreamId?: string;
|
|
1369
|
+
camStreamId?: string;
|
|
1370
|
+
};
|
|
1358
1371
|
declare class VegaRtcManager implements RtcManager {
|
|
1359
1372
|
_selfId: any;
|
|
1360
1373
|
_room: any;
|
|
@@ -1371,7 +1384,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1371
1384
|
_routerRtpCapabilities: any;
|
|
1372
1385
|
_sendTransport: any;
|
|
1373
1386
|
_receiveTransport: any;
|
|
1374
|
-
_clientStates:
|
|
1387
|
+
_clientStates: Map<string, ClientState>;
|
|
1375
1388
|
_streamIdToVideoConsumerId: any;
|
|
1376
1389
|
_streamIdToVideoResolution: Map<string, {
|
|
1377
1390
|
width: number;
|
|
@@ -1463,6 +1476,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1463
1476
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1464
1477
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1465
1478
|
_stopProducer(producer: any): void;
|
|
1479
|
+
_getIsSomeoneAlreadyPresenting(): boolean;
|
|
1466
1480
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1467
1481
|
selfId: string;
|
|
1468
1482
|
roomName: string;
|
|
@@ -1534,13 +1548,13 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1534
1548
|
}): void;
|
|
1535
1549
|
_consumerClosedCleanup(consumer: any): void;
|
|
1536
1550
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1537
|
-
_getOrCreateClientState(clientId: string):
|
|
1551
|
+
_getOrCreateClientState(clientId: string): ClientState;
|
|
1538
1552
|
_emitToPWA(eventName: string, data?: any): void;
|
|
1539
1553
|
_emitToSignal(eventName: string, data?: any, callback?: any): void;
|
|
1540
1554
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
1541
1555
|
setMicAnalyserDebugger(analyserDebugger: any): void;
|
|
1542
1556
|
setMicAnalyserParams(params: any): void;
|
|
1543
|
-
hasClient(clientId: string):
|
|
1557
|
+
hasClient(clientId: string): boolean;
|
|
1544
1558
|
}
|
|
1545
1559
|
|
|
1546
1560
|
declare const EVENTS: Record<string, keyof RtcEvents>;
|
package/dist/index.d.ts
CHANGED
|
@@ -601,7 +601,7 @@ declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
|
601
601
|
simulcastScreenshareOn?: boolean;
|
|
602
602
|
lowBandwidth?: boolean;
|
|
603
603
|
vp9On?: boolean;
|
|
604
|
-
}) => {
|
|
604
|
+
}, isSomeoneAlreadyPresenting?: boolean) => {
|
|
605
605
|
encodings: {}[];
|
|
606
606
|
};
|
|
607
607
|
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
@@ -1355,6 +1355,19 @@ declare function createVegaConnectionManager(config: {
|
|
|
1355
1355
|
networkIsPossiblyDown: () => void;
|
|
1356
1356
|
};
|
|
1357
1357
|
|
|
1358
|
+
type MediaSteamWhichMayHaveInboundId = MediaStream & {
|
|
1359
|
+
inboundId?: string;
|
|
1360
|
+
};
|
|
1361
|
+
type ClientState = {
|
|
1362
|
+
hasAcceptedWebcamStream: Boolean;
|
|
1363
|
+
hasAcceptedScreenStream: Boolean;
|
|
1364
|
+
hasEmittedWebcamStream: Boolean;
|
|
1365
|
+
hasEmittedScreenStream: Boolean;
|
|
1366
|
+
webcamStream?: MediaSteamWhichMayHaveInboundId;
|
|
1367
|
+
screenStream?: MediaSteamWhichMayHaveInboundId;
|
|
1368
|
+
screenShareStreamId?: string;
|
|
1369
|
+
camStreamId?: string;
|
|
1370
|
+
};
|
|
1358
1371
|
declare class VegaRtcManager implements RtcManager {
|
|
1359
1372
|
_selfId: any;
|
|
1360
1373
|
_room: any;
|
|
@@ -1371,7 +1384,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1371
1384
|
_routerRtpCapabilities: any;
|
|
1372
1385
|
_sendTransport: any;
|
|
1373
1386
|
_receiveTransport: any;
|
|
1374
|
-
_clientStates:
|
|
1387
|
+
_clientStates: Map<string, ClientState>;
|
|
1375
1388
|
_streamIdToVideoConsumerId: any;
|
|
1376
1389
|
_streamIdToVideoResolution: Map<string, {
|
|
1377
1390
|
width: number;
|
|
@@ -1463,6 +1476,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1463
1476
|
_replaceScreenAudioTrack(): Promise<void>;
|
|
1464
1477
|
_sendScreenAudio(track: MediaStreamTrack): Promise<void>;
|
|
1465
1478
|
_stopProducer(producer: any): void;
|
|
1479
|
+
_getIsSomeoneAlreadyPresenting(): boolean;
|
|
1466
1480
|
isInitializedWith({ selfId, roomName, isSfu }: {
|
|
1467
1481
|
selfId: string;
|
|
1468
1482
|
roomName: string;
|
|
@@ -1534,13 +1548,13 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
1534
1548
|
}): void;
|
|
1535
1549
|
_consumerClosedCleanup(consumer: any): void;
|
|
1536
1550
|
_syncIncomingStreamsWithPWA(clientId: string): void;
|
|
1537
|
-
_getOrCreateClientState(clientId: string):
|
|
1551
|
+
_getOrCreateClientState(clientId: string): ClientState;
|
|
1538
1552
|
_emitToPWA(eventName: string, data?: any): void;
|
|
1539
1553
|
_emitToSignal(eventName: string, data?: any, callback?: any): void;
|
|
1540
1554
|
shouldAcceptStreamsFromBothSides(): boolean;
|
|
1541
1555
|
setMicAnalyserDebugger(analyserDebugger: any): void;
|
|
1542
1556
|
setMicAnalyserParams(params: any): void;
|
|
1543
|
-
hasClient(clientId: string):
|
|
1557
|
+
hasClient(clientId: string): boolean;
|
|
1544
1558
|
}
|
|
1545
1559
|
|
|
1546
1560
|
declare const EVENTS: Record<string, keyof RtcEvents>;
|
package/dist/index.mjs
CHANGED
|
@@ -2553,15 +2553,30 @@ const SCREEN_SHARE_SIMULCAST_SETTINGS = {
|
|
|
2553
2553
|
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2554
2554
|
],
|
|
2555
2555
|
};
|
|
2556
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS = {
|
|
2557
|
+
encodings: [
|
|
2558
|
+
{ scaleResolutionDownBy: 4, dtx: true, maxBitrate: 150000 },
|
|
2559
|
+
{ scaleResolutionDownBy: 2, dtx: true, maxBitrate: 500000 },
|
|
2560
|
+
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2561
|
+
],
|
|
2562
|
+
};
|
|
2563
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2564
|
+
encodings: [{ scalabilityMode: "L2T2_KEY", dtx: true, maxBitrate: 1500000 }],
|
|
2565
|
+
};
|
|
2556
2566
|
const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2557
2567
|
encodings: [{ dtx: true }],
|
|
2558
2568
|
};
|
|
2559
|
-
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2569
|
+
const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
|
|
2560
2570
|
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2561
2571
|
if (kind === "audio") {
|
|
2562
2572
|
return AUDIO_SETTINGS;
|
|
2563
2573
|
}
|
|
2564
2574
|
if (isScreenShare) {
|
|
2575
|
+
if (isSomeoneAlreadyPresenting) {
|
|
2576
|
+
if (vp9On)
|
|
2577
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
|
|
2578
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS;
|
|
2579
|
+
}
|
|
2565
2580
|
if (lowBandwidth && !vp9On)
|
|
2566
2581
|
return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
|
|
2567
2582
|
if (vp9On)
|
|
@@ -2651,10 +2666,11 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
2651
2666
|
}
|
|
2652
2667
|
function sortCodecs(codecs, features) {
|
|
2653
2668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2669
|
+
codecs = sortCodecsByMimeType(codecs, features);
|
|
2654
2670
|
if (features.preferHardwareDecodingOn) {
|
|
2655
2671
|
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2656
2672
|
}
|
|
2657
|
-
return
|
|
2673
|
+
return codecs;
|
|
2658
2674
|
});
|
|
2659
2675
|
}
|
|
2660
2676
|
|
|
@@ -3841,7 +3857,7 @@ class P2pRtcManager {
|
|
|
3841
3857
|
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3842
3858
|
vp9On: p2pVp9On,
|
|
3843
3859
|
av1On: p2pAv1On,
|
|
3844
|
-
preferHardwareDecodingOn: preferP2pHardwareDecodingOn,
|
|
3860
|
+
preferHardwareDecodingOn: p2pVp9On || preferP2pHardwareDecodingOn,
|
|
3845
3861
|
});
|
|
3846
3862
|
}
|
|
3847
3863
|
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
@@ -5680,7 +5696,7 @@ class VegaRtcManager {
|
|
|
5680
5696
|
this._screenVideoProducerPromise = null;
|
|
5681
5697
|
return;
|
|
5682
5698
|
}
|
|
5683
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5699
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }), this._getIsSomeoneAlreadyPresenting())), { appData: {
|
|
5684
5700
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5685
5701
|
sourceClientId: this._selfId,
|
|
5686
5702
|
screenShare: true,
|
|
@@ -5820,6 +5836,9 @@ class VegaRtcManager {
|
|
|
5820
5836
|
producer.appData.localClosed = true;
|
|
5821
5837
|
producer.close();
|
|
5822
5838
|
}
|
|
5839
|
+
_getIsSomeoneAlreadyPresenting() {
|
|
5840
|
+
return !![...this._clientStates.values()].find((state) => state.hasAcceptedScreenStream && state.screenStream);
|
|
5841
|
+
}
|
|
5823
5842
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
5824
5843
|
return this._selfId === selfId && this._room.name === roomName && Boolean(isSfu);
|
|
5825
5844
|
}
|
|
@@ -5849,8 +5868,8 @@ class VegaRtcManager {
|
|
|
5849
5868
|
disconnect(clientIdOrStreamId, _activeBreakout, eventClaim) {
|
|
5850
5869
|
var _a;
|
|
5851
5870
|
logger$3.info("disconnect() [clientIdOrStreamId:%s, eventClaim:%s]", clientIdOrStreamId, eventClaim);
|
|
5852
|
-
|
|
5853
|
-
|
|
5871
|
+
const clientState = this._clientStates.get(clientIdOrStreamId);
|
|
5872
|
+
if (clientState) {
|
|
5854
5873
|
clientState.hasAcceptedWebcamStream = false;
|
|
5855
5874
|
clientState.hasAcceptedScreenStream = false;
|
|
5856
5875
|
this._syncIncomingStreamsWithPWA(clientIdOrStreamId);
|
|
@@ -6298,13 +6317,13 @@ class VegaRtcManager {
|
|
|
6298
6317
|
this._streamIdToVideoConsumerId.delete(stream.id);
|
|
6299
6318
|
this._streamIdToVideoResolution.delete(stream.id);
|
|
6300
6319
|
if (screenShare) {
|
|
6301
|
-
clientState.screenStream =
|
|
6320
|
+
clientState.screenStream = undefined;
|
|
6302
6321
|
clientState.hasEmittedScreenStream = false;
|
|
6303
|
-
clientState.screenShareStreamId =
|
|
6322
|
+
clientState.screenShareStreamId = undefined;
|
|
6304
6323
|
}
|
|
6305
6324
|
else {
|
|
6306
6325
|
clientState.hasEmittedWebcamStream = false;
|
|
6307
|
-
clientState.camStreamId =
|
|
6326
|
+
clientState.camStreamId = undefined;
|
|
6308
6327
|
}
|
|
6309
6328
|
}
|
|
6310
6329
|
}
|
|
@@ -6370,10 +6389,6 @@ class VegaRtcManager {
|
|
|
6370
6389
|
hasAcceptedScreenStream: false,
|
|
6371
6390
|
hasEmittedWebcamStream: false,
|
|
6372
6391
|
hasEmittedScreenStream: false,
|
|
6373
|
-
webcamStream: null,
|
|
6374
|
-
screenStream: null,
|
|
6375
|
-
screenShareStreamId: null,
|
|
6376
|
-
camStreamId: null,
|
|
6377
6392
|
};
|
|
6378
6393
|
this._clientStates.set(clientId, clientState);
|
|
6379
6394
|
}
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2553,15 +2553,30 @@ const SCREEN_SHARE_SIMULCAST_SETTINGS = {
|
|
|
2553
2553
|
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2554
2554
|
],
|
|
2555
2555
|
};
|
|
2556
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS = {
|
|
2557
|
+
encodings: [
|
|
2558
|
+
{ scaleResolutionDownBy: 4, dtx: true, maxBitrate: 150000 },
|
|
2559
|
+
{ scaleResolutionDownBy: 2, dtx: true, maxBitrate: 500000 },
|
|
2560
|
+
{ scaleResolutionDownBy: 1, dtx: true, maxBitrate: 1500000 },
|
|
2561
|
+
],
|
|
2562
|
+
};
|
|
2563
|
+
const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2564
|
+
encodings: [{ scalabilityMode: "L2T2_KEY", dtx: true, maxBitrate: 1500000 }],
|
|
2565
|
+
};
|
|
2556
2566
|
const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
2557
2567
|
encodings: [{ dtx: true }],
|
|
2558
2568
|
};
|
|
2559
|
-
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2569
|
+
const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
|
|
2560
2570
|
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2561
2571
|
if (kind === "audio") {
|
|
2562
2572
|
return AUDIO_SETTINGS;
|
|
2563
2573
|
}
|
|
2564
2574
|
if (isScreenShare) {
|
|
2575
|
+
if (isSomeoneAlreadyPresenting) {
|
|
2576
|
+
if (vp9On)
|
|
2577
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
|
|
2578
|
+
return ADDITIONAL_SCREEN_SHARE_SETTINGS;
|
|
2579
|
+
}
|
|
2565
2580
|
if (lowBandwidth && !vp9On)
|
|
2566
2581
|
return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
|
|
2567
2582
|
if (vp9On)
|
|
@@ -2651,10 +2666,11 @@ function sortCodecsByPowerEfficiency(codecs) {
|
|
|
2651
2666
|
}
|
|
2652
2667
|
function sortCodecs(codecs, features) {
|
|
2653
2668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2669
|
+
codecs = sortCodecsByMimeType(codecs, features);
|
|
2654
2670
|
if (features.preferHardwareDecodingOn) {
|
|
2655
2671
|
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2656
2672
|
}
|
|
2657
|
-
return
|
|
2673
|
+
return codecs;
|
|
2658
2674
|
});
|
|
2659
2675
|
}
|
|
2660
2676
|
|
|
@@ -3841,7 +3857,7 @@ class P2pRtcManager {
|
|
|
3841
3857
|
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3842
3858
|
vp9On: p2pVp9On,
|
|
3843
3859
|
av1On: p2pAv1On,
|
|
3844
|
-
preferHardwareDecodingOn: preferP2pHardwareDecodingOn,
|
|
3860
|
+
preferHardwareDecodingOn: p2pVp9On || preferP2pHardwareDecodingOn,
|
|
3845
3861
|
});
|
|
3846
3862
|
}
|
|
3847
3863
|
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
@@ -5680,7 +5696,7 @@ class VegaRtcManager {
|
|
|
5680
5696
|
this._screenVideoProducerPromise = null;
|
|
5681
5697
|
return;
|
|
5682
5698
|
}
|
|
5683
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5699
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", true, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }), this._getIsSomeoneAlreadyPresenting())), { appData: {
|
|
5684
5700
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5685
5701
|
sourceClientId: this._selfId,
|
|
5686
5702
|
screenShare: true,
|
|
@@ -5820,6 +5836,9 @@ class VegaRtcManager {
|
|
|
5820
5836
|
producer.appData.localClosed = true;
|
|
5821
5837
|
producer.close();
|
|
5822
5838
|
}
|
|
5839
|
+
_getIsSomeoneAlreadyPresenting() {
|
|
5840
|
+
return !![...this._clientStates.values()].find((state) => state.hasAcceptedScreenStream && state.screenStream);
|
|
5841
|
+
}
|
|
5823
5842
|
isInitializedWith({ selfId, roomName, isSfu }) {
|
|
5824
5843
|
return this._selfId === selfId && this._room.name === roomName && Boolean(isSfu);
|
|
5825
5844
|
}
|
|
@@ -5849,8 +5868,8 @@ class VegaRtcManager {
|
|
|
5849
5868
|
disconnect(clientIdOrStreamId, _activeBreakout, eventClaim) {
|
|
5850
5869
|
var _a;
|
|
5851
5870
|
logger$3.info("disconnect() [clientIdOrStreamId:%s, eventClaim:%s]", clientIdOrStreamId, eventClaim);
|
|
5852
|
-
|
|
5853
|
-
|
|
5871
|
+
const clientState = this._clientStates.get(clientIdOrStreamId);
|
|
5872
|
+
if (clientState) {
|
|
5854
5873
|
clientState.hasAcceptedWebcamStream = false;
|
|
5855
5874
|
clientState.hasAcceptedScreenStream = false;
|
|
5856
5875
|
this._syncIncomingStreamsWithPWA(clientIdOrStreamId);
|
|
@@ -6298,13 +6317,13 @@ class VegaRtcManager {
|
|
|
6298
6317
|
this._streamIdToVideoConsumerId.delete(stream.id);
|
|
6299
6318
|
this._streamIdToVideoResolution.delete(stream.id);
|
|
6300
6319
|
if (screenShare) {
|
|
6301
|
-
clientState.screenStream =
|
|
6320
|
+
clientState.screenStream = undefined;
|
|
6302
6321
|
clientState.hasEmittedScreenStream = false;
|
|
6303
|
-
clientState.screenShareStreamId =
|
|
6322
|
+
clientState.screenShareStreamId = undefined;
|
|
6304
6323
|
}
|
|
6305
6324
|
else {
|
|
6306
6325
|
clientState.hasEmittedWebcamStream = false;
|
|
6307
|
-
clientState.camStreamId =
|
|
6326
|
+
clientState.camStreamId = undefined;
|
|
6308
6327
|
}
|
|
6309
6328
|
}
|
|
6310
6329
|
}
|
|
@@ -6370,10 +6389,6 @@ class VegaRtcManager {
|
|
|
6370
6389
|
hasAcceptedScreenStream: false,
|
|
6371
6390
|
hasEmittedWebcamStream: false,
|
|
6372
6391
|
hasEmittedScreenStream: false,
|
|
6373
|
-
webcamStream: null,
|
|
6374
|
-
screenStream: null,
|
|
6375
|
-
screenShareStreamId: null,
|
|
6376
|
-
camStreamId: null,
|
|
6377
6392
|
};
|
|
6378
6393
|
this._clientStates.set(clientId, clientState);
|
|
6379
6394
|
}
|