@whereby.com/media 1.21.0 → 1.22.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 +96 -51
- package/dist/index.d.cts +16 -11
- package/dist/index.d.mts +16 -11
- package/dist/index.d.ts +16 -11
- package/dist/index.mjs +96 -51
- package/dist/legacy-esm.js +96 -51
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2582,7 +2582,7 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
|
2582
2582
|
encodings: [{ dtx: true }],
|
|
2583
2583
|
};
|
|
2584
2584
|
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2585
|
-
const { lowDataModeEnabled, simulcastScreenshareOn,
|
|
2585
|
+
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2586
2586
|
if (kind === "audio") {
|
|
2587
2587
|
return AUDIO_SETTINGS;
|
|
2588
2588
|
}
|
|
@@ -2635,7 +2635,9 @@ function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
|
|
|
2635
2635
|
return availableCodecs;
|
|
2636
2636
|
}
|
|
2637
2637
|
function sortCodecsByMimeType(codecs, features) {
|
|
2638
|
-
const availableCodecs = codecs
|
|
2638
|
+
const availableCodecs = codecs
|
|
2639
|
+
.map(({ mimeType }) => mimeType)
|
|
2640
|
+
.filter((value, index, array) => array.indexOf(value) === index);
|
|
2639
2641
|
const preferredOrder = getPreferredOrder(availableCodecs, features);
|
|
2640
2642
|
return codecs.sort((a, b) => {
|
|
2641
2643
|
const indexA = preferredOrder.indexOf(a.mimeType.toLowerCase());
|
|
@@ -2645,6 +2647,41 @@ function sortCodecsByMimeType(codecs, features) {
|
|
|
2645
2647
|
return orderA - orderB;
|
|
2646
2648
|
});
|
|
2647
2649
|
}
|
|
2650
|
+
function getIsCodecDecodingPowerEfficient(codec) {
|
|
2651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2652
|
+
const { powerEfficient } = yield navigator.mediaCapabilities.decodingInfo({
|
|
2653
|
+
type: "webrtc",
|
|
2654
|
+
video: {
|
|
2655
|
+
width: 1280,
|
|
2656
|
+
height: 720,
|
|
2657
|
+
bitrate: 2580,
|
|
2658
|
+
framerate: 24,
|
|
2659
|
+
contentType: codec,
|
|
2660
|
+
},
|
|
2661
|
+
});
|
|
2662
|
+
return powerEfficient;
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
function sortCodecsByPowerEfficiency(codecs) {
|
|
2666
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2667
|
+
const codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
2668
|
+
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
2669
|
+
const sorted = codecs.sort((a, b) => {
|
|
2670
|
+
const aPowerEfficient = codecPowerEfficiencies[a.mimeType];
|
|
2671
|
+
const bPowerEfficient = codecPowerEfficiencies[b.mimeType];
|
|
2672
|
+
return aPowerEfficient === bPowerEfficient ? 0 : aPowerEfficient ? -1 : 1;
|
|
2673
|
+
});
|
|
2674
|
+
return sorted;
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
function sortCodecs(codecs, features) {
|
|
2678
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2679
|
+
if (features.preferHardwareDecodingOn) {
|
|
2680
|
+
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2681
|
+
}
|
|
2682
|
+
return sortCodecsByMimeType(codecs, features);
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2648
2685
|
|
|
2649
2686
|
const logger$8 = new Logger();
|
|
2650
2687
|
class ReconnectManager extends EventEmitter {
|
|
@@ -3787,43 +3824,53 @@ class P2pRtcManager {
|
|
|
3787
3824
|
this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
|
|
3788
3825
|
}
|
|
3789
3826
|
}
|
|
3790
|
-
_setCodecPreferences(pc
|
|
3791
|
-
|
|
3792
|
-
const
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3827
|
+
_setCodecPreferences(pc) {
|
|
3828
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3829
|
+
const { p2pVp9On, p2pAv1On, redOn, preferHardwareDecodingOn } = this._features;
|
|
3830
|
+
if (!(p2pVp9On || p2pAv1On || redOn || preferHardwareDecodingOn)) {
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3833
|
+
try {
|
|
3834
|
+
const audioTransceivers = pc
|
|
3835
|
+
.getTransceivers()
|
|
3836
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "audio"; });
|
|
3837
|
+
audioTransceivers.forEach((audioTransceiver) => {
|
|
3838
|
+
if (typeof RTCRtpSender.getCapabilities === "undefined")
|
|
3839
|
+
return;
|
|
3840
|
+
const capabilities = RTCRtpSender.getCapabilities("audio");
|
|
3841
|
+
for (let i = 0; i < capabilities.codecs.length; i++) {
|
|
3842
|
+
if (redOn && capabilities.codecs[i].mimeType.toLowerCase() === "audio/red") {
|
|
3843
|
+
capabilities.codecs.unshift(capabilities.codecs.splice(i, 1)[0]);
|
|
3844
|
+
break;
|
|
3845
|
+
}
|
|
3803
3846
|
}
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
.
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3847
|
+
if (typeof audioTransceiver.setCodecPreferences === "undefined")
|
|
3848
|
+
return;
|
|
3849
|
+
audioTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3850
|
+
});
|
|
3851
|
+
const videoTransceivers = pc
|
|
3852
|
+
.getTransceivers()
|
|
3853
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "video"; });
|
|
3854
|
+
yield Promise.all(videoTransceivers.map((videoTransceiver) => __awaiter(this, void 0, void 0, function* () {
|
|
3855
|
+
if (RTCRtpReceiver.getCapabilities === undefined)
|
|
3856
|
+
return;
|
|
3857
|
+
if (videoTransceiver.setCodecPreferences === undefined)
|
|
3858
|
+
return;
|
|
3859
|
+
const capabilities = RTCRtpReceiver.getCapabilities("video");
|
|
3860
|
+
if (p2pVp9On || p2pAv1On || preferHardwareDecodingOn) {
|
|
3861
|
+
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3862
|
+
vp9On: p2pVp9On,
|
|
3863
|
+
av1On: p2pAv1On,
|
|
3864
|
+
preferHardwareDecodingOn,
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3868
|
+
})));
|
|
3869
|
+
}
|
|
3870
|
+
catch (error) {
|
|
3871
|
+
logger$7.error("Error during setting setCodecPreferences:", error);
|
|
3872
|
+
}
|
|
3873
|
+
});
|
|
3827
3874
|
}
|
|
3828
3875
|
_negotiatePeerConnection(clientId, session, constraints) {
|
|
3829
3876
|
if (!session) {
|
|
@@ -3838,16 +3885,14 @@ class P2pRtcManager {
|
|
|
3838
3885
|
return;
|
|
3839
3886
|
}
|
|
3840
3887
|
session.isOperationPending = true;
|
|
3841
|
-
const {
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
}
|
|
3845
|
-
pc.createOffer(constraints || this.offerOptions)
|
|
3888
|
+
const { p2pVp9On, redOn, rtpAbsCaptureTimeOn, cleanSdpOn } = this._features;
|
|
3889
|
+
this._setCodecPreferences(pc).then(() => pc
|
|
3890
|
+
.createOffer(constraints || this.offerOptions)
|
|
3846
3891
|
.then((offer) => {
|
|
3847
3892
|
if (rtpAbsCaptureTimeOn)
|
|
3848
3893
|
offer.sdp = addAbsCaptureTimeExtMap(offer.sdp);
|
|
3849
|
-
if ((
|
|
3850
|
-
offer.sdp = setCodecPreferenceSDP(offer.sdp,
|
|
3894
|
+
if ((p2pVp9On || redOn) && browserName$1 === "firefox") {
|
|
3895
|
+
offer.sdp = setCodecPreferenceSDP(offer.sdp, p2pVp9On, redOn);
|
|
3851
3896
|
}
|
|
3852
3897
|
if (cleanSdpOn)
|
|
3853
3898
|
offer.sdp = cleanSdp(offer.sdp);
|
|
@@ -3866,7 +3911,7 @@ class P2pRtcManager {
|
|
|
3866
3911
|
})
|
|
3867
3912
|
.catch((e) => {
|
|
3868
3913
|
logger$7.warn("RTCPeerConnection.createOffer() failed to create local offer", e);
|
|
3869
|
-
});
|
|
3914
|
+
}));
|
|
3870
3915
|
}
|
|
3871
3916
|
_withForcedRenegotiation(session, action) {
|
|
3872
3917
|
const pc = session.pc;
|
|
@@ -5384,7 +5429,7 @@ class VegaRtcManager {
|
|
|
5384
5429
|
return;
|
|
5385
5430
|
}
|
|
5386
5431
|
const currentPaused = this._micPaused;
|
|
5387
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, this._features)), { appData: {
|
|
5432
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5388
5433
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5389
5434
|
sourceClientId: this._selfId,
|
|
5390
5435
|
screenShare: false,
|
|
@@ -5550,7 +5595,7 @@ class VegaRtcManager {
|
|
|
5550
5595
|
var _b, _c;
|
|
5551
5596
|
try {
|
|
5552
5597
|
const currentPaused = this._webcamPaused;
|
|
5553
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
|
|
5598
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5554
5599
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5555
5600
|
sourceClientId: this._selfId,
|
|
5556
5601
|
screenShare: false,
|
|
@@ -5652,7 +5697,7 @@ class VegaRtcManager {
|
|
|
5652
5697
|
this._screenVideoProducerPromise = null;
|
|
5653
5698
|
return;
|
|
5654
5699
|
}
|
|
5655
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video",
|
|
5700
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5656
5701
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5657
5702
|
sourceClientId: this._selfId,
|
|
5658
5703
|
screenShare: true,
|
|
@@ -5726,7 +5771,7 @@ class VegaRtcManager {
|
|
|
5726
5771
|
this._screenAudioProducerPromise = null;
|
|
5727
5772
|
return;
|
|
5728
5773
|
}
|
|
5729
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio",
|
|
5774
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5730
5775
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5731
5776
|
sourceClientId: this._selfId,
|
|
5732
5777
|
screenShare: true,
|
|
@@ -8054,7 +8099,7 @@ exports.setClientProvider = setClientProvider;
|
|
|
8054
8099
|
exports.setCodecPreferenceSDP = setCodecPreferenceSDP;
|
|
8055
8100
|
exports.setPeerConnectionsForTests = setPeerConnectionsForTests;
|
|
8056
8101
|
exports.setVideoBandwidthUsingSetParameters = setVideoBandwidthUsingSetParameters;
|
|
8057
|
-
exports.
|
|
8102
|
+
exports.sortCodecs = sortCodecs;
|
|
8058
8103
|
exports.standardDeviation = standardDeviation;
|
|
8059
8104
|
exports.startPerformanceMonitor = startPerformanceMonitor;
|
|
8060
8105
|
exports.stopStreamTracks = stopStreamTracks;
|
package/dist/index.d.cts
CHANGED
|
@@ -541,11 +541,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
541
541
|
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
542
542
|
_connect(clientId: string): Promise<any>;
|
|
543
543
|
_maybeRestartIce(clientId: string, session: any): void;
|
|
544
|
-
_setCodecPreferences(pc: RTCPeerConnection
|
|
545
|
-
vp9On?: boolean;
|
|
546
|
-
av1On?: boolean;
|
|
547
|
-
redOn?: boolean;
|
|
548
|
-
}): void;
|
|
544
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
549
545
|
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
550
546
|
_withForcedRenegotiation(session: any, action: any): void;
|
|
551
547
|
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
@@ -600,19 +596,28 @@ declare const ipRegex: {
|
|
|
600
596
|
}): RegExp;
|
|
601
597
|
};
|
|
602
598
|
|
|
603
|
-
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
599
|
+
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
|
|
600
|
+
lowDataModeEnabled?: boolean;
|
|
601
|
+
simulcastScreenshareOn?: boolean;
|
|
602
|
+
lowBandwidth?: boolean;
|
|
603
|
+
vp9On?: boolean;
|
|
604
|
+
}) => {
|
|
604
605
|
encodings: {}[];
|
|
605
606
|
};
|
|
606
|
-
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features:
|
|
607
|
+
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
608
|
+
vp9On?: boolean;
|
|
609
|
+
h264On?: boolean;
|
|
610
|
+
}) => void;
|
|
607
611
|
interface Codec {
|
|
608
612
|
clockRate: number;
|
|
609
613
|
mimeType: string;
|
|
610
614
|
sdpFmtpLine?: string;
|
|
611
615
|
}
|
|
612
|
-
declare function
|
|
616
|
+
declare function sortCodecs(codecs: Codec[], features: {
|
|
613
617
|
vp9On?: boolean;
|
|
614
618
|
av1On?: boolean;
|
|
615
|
-
|
|
619
|
+
preferHardwareDecodingOn?: boolean;
|
|
620
|
+
}): Promise<Codec[]>;
|
|
616
621
|
|
|
617
622
|
declare function getOptimalBitrate(width: number, height: number, frameRate: number): number;
|
|
618
623
|
|
|
@@ -1088,7 +1093,7 @@ declare const rtcStats: {
|
|
|
1088
1093
|
};
|
|
1089
1094
|
};
|
|
1090
1095
|
|
|
1091
|
-
declare function setCodecPreferenceSDP(sdp: any, vp9On
|
|
1096
|
+
declare function setCodecPreferenceSDP(sdp: any, vp9On?: boolean, redOn?: boolean): string | undefined;
|
|
1092
1097
|
declare function cleanSdp(sdp: string): string;
|
|
1093
1098
|
declare function maybeRejectNoH264(sdp: any): any;
|
|
1094
1099
|
declare function deprioritizeH264(sdp: any): string;
|
|
@@ -1658,4 +1663,4 @@ declare class RtcStream {
|
|
|
1658
1663
|
static getTypeFromId(id: string): string;
|
|
1659
1664
|
}
|
|
1660
1665
|
|
|
1661
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters,
|
|
1666
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.d.mts
CHANGED
|
@@ -541,11 +541,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
541
541
|
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
542
542
|
_connect(clientId: string): Promise<any>;
|
|
543
543
|
_maybeRestartIce(clientId: string, session: any): void;
|
|
544
|
-
_setCodecPreferences(pc: RTCPeerConnection
|
|
545
|
-
vp9On?: boolean;
|
|
546
|
-
av1On?: boolean;
|
|
547
|
-
redOn?: boolean;
|
|
548
|
-
}): void;
|
|
544
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
549
545
|
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
550
546
|
_withForcedRenegotiation(session: any, action: any): void;
|
|
551
547
|
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
@@ -600,19 +596,28 @@ declare const ipRegex: {
|
|
|
600
596
|
}): RegExp;
|
|
601
597
|
};
|
|
602
598
|
|
|
603
|
-
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
599
|
+
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
|
|
600
|
+
lowDataModeEnabled?: boolean;
|
|
601
|
+
simulcastScreenshareOn?: boolean;
|
|
602
|
+
lowBandwidth?: boolean;
|
|
603
|
+
vp9On?: boolean;
|
|
604
|
+
}) => {
|
|
604
605
|
encodings: {}[];
|
|
605
606
|
};
|
|
606
|
-
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features:
|
|
607
|
+
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
608
|
+
vp9On?: boolean;
|
|
609
|
+
h264On?: boolean;
|
|
610
|
+
}) => void;
|
|
607
611
|
interface Codec {
|
|
608
612
|
clockRate: number;
|
|
609
613
|
mimeType: string;
|
|
610
614
|
sdpFmtpLine?: string;
|
|
611
615
|
}
|
|
612
|
-
declare function
|
|
616
|
+
declare function sortCodecs(codecs: Codec[], features: {
|
|
613
617
|
vp9On?: boolean;
|
|
614
618
|
av1On?: boolean;
|
|
615
|
-
|
|
619
|
+
preferHardwareDecodingOn?: boolean;
|
|
620
|
+
}): Promise<Codec[]>;
|
|
616
621
|
|
|
617
622
|
declare function getOptimalBitrate(width: number, height: number, frameRate: number): number;
|
|
618
623
|
|
|
@@ -1088,7 +1093,7 @@ declare const rtcStats: {
|
|
|
1088
1093
|
};
|
|
1089
1094
|
};
|
|
1090
1095
|
|
|
1091
|
-
declare function setCodecPreferenceSDP(sdp: any, vp9On
|
|
1096
|
+
declare function setCodecPreferenceSDP(sdp: any, vp9On?: boolean, redOn?: boolean): string | undefined;
|
|
1092
1097
|
declare function cleanSdp(sdp: string): string;
|
|
1093
1098
|
declare function maybeRejectNoH264(sdp: any): any;
|
|
1094
1099
|
declare function deprioritizeH264(sdp: any): string;
|
|
@@ -1658,4 +1663,4 @@ declare class RtcStream {
|
|
|
1658
1663
|
static getTypeFromId(id: string): string;
|
|
1659
1664
|
}
|
|
1660
1665
|
|
|
1661
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters,
|
|
1666
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.d.ts
CHANGED
|
@@ -541,11 +541,7 @@ declare class P2pRtcManager implements RtcManager {
|
|
|
541
541
|
_monitorVideoTrack(track: CustomMediaStreamTrack): void;
|
|
542
542
|
_connect(clientId: string): Promise<any>;
|
|
543
543
|
_maybeRestartIce(clientId: string, session: any): void;
|
|
544
|
-
_setCodecPreferences(pc: RTCPeerConnection
|
|
545
|
-
vp9On?: boolean;
|
|
546
|
-
av1On?: boolean;
|
|
547
|
-
redOn?: boolean;
|
|
548
|
-
}): void;
|
|
544
|
+
_setCodecPreferences(pc: RTCPeerConnection): Promise<void>;
|
|
549
545
|
_negotiatePeerConnection(clientId: string, session: any, constraints?: any): void;
|
|
550
546
|
_withForcedRenegotiation(session: any, action: any): void;
|
|
551
547
|
_changeBandwidthForAllClients(isJoining: boolean): number;
|
|
@@ -600,19 +596,28 @@ declare const ipRegex: {
|
|
|
600
596
|
}): RegExp;
|
|
601
597
|
};
|
|
602
598
|
|
|
603
|
-
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features:
|
|
599
|
+
declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
|
|
600
|
+
lowDataModeEnabled?: boolean;
|
|
601
|
+
simulcastScreenshareOn?: boolean;
|
|
602
|
+
lowBandwidth?: boolean;
|
|
603
|
+
vp9On?: boolean;
|
|
604
|
+
}) => {
|
|
604
605
|
encodings: {}[];
|
|
605
606
|
};
|
|
606
|
-
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features:
|
|
607
|
+
declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
|
|
608
|
+
vp9On?: boolean;
|
|
609
|
+
h264On?: boolean;
|
|
610
|
+
}) => void;
|
|
607
611
|
interface Codec {
|
|
608
612
|
clockRate: number;
|
|
609
613
|
mimeType: string;
|
|
610
614
|
sdpFmtpLine?: string;
|
|
611
615
|
}
|
|
612
|
-
declare function
|
|
616
|
+
declare function sortCodecs(codecs: Codec[], features: {
|
|
613
617
|
vp9On?: boolean;
|
|
614
618
|
av1On?: boolean;
|
|
615
|
-
|
|
619
|
+
preferHardwareDecodingOn?: boolean;
|
|
620
|
+
}): Promise<Codec[]>;
|
|
616
621
|
|
|
617
622
|
declare function getOptimalBitrate(width: number, height: number, frameRate: number): number;
|
|
618
623
|
|
|
@@ -1088,7 +1093,7 @@ declare const rtcStats: {
|
|
|
1088
1093
|
};
|
|
1089
1094
|
};
|
|
1090
1095
|
|
|
1091
|
-
declare function setCodecPreferenceSDP(sdp: any, vp9On
|
|
1096
|
+
declare function setCodecPreferenceSDP(sdp: any, vp9On?: boolean, redOn?: boolean): string | undefined;
|
|
1092
1097
|
declare function cleanSdp(sdp: string): string;
|
|
1093
1098
|
declare function maybeRejectNoH264(sdp: any): any;
|
|
1094
1099
|
declare function deprioritizeH264(sdp: any): string;
|
|
@@ -1658,4 +1663,4 @@ declare class RtcStream {
|
|
|
1658
1663
|
static getTypeFromId(id: string): string;
|
|
1659
1664
|
}
|
|
1660
1665
|
|
|
1661
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters,
|
|
1666
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, type StatsSubscription, TYPES, type TrackStats, type TurnTransportProtocol, type UpdatedDeviceInfo, type UpdatedDevicesInfo, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, type ViewStats, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/index.mjs
CHANGED
|
@@ -2557,7 +2557,7 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
|
2557
2557
|
encodings: [{ dtx: true }],
|
|
2558
2558
|
};
|
|
2559
2559
|
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2560
|
-
const { lowDataModeEnabled, simulcastScreenshareOn,
|
|
2560
|
+
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2561
2561
|
if (kind === "audio") {
|
|
2562
2562
|
return AUDIO_SETTINGS;
|
|
2563
2563
|
}
|
|
@@ -2610,7 +2610,9 @@ function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
|
|
|
2610
2610
|
return availableCodecs;
|
|
2611
2611
|
}
|
|
2612
2612
|
function sortCodecsByMimeType(codecs, features) {
|
|
2613
|
-
const availableCodecs = codecs
|
|
2613
|
+
const availableCodecs = codecs
|
|
2614
|
+
.map(({ mimeType }) => mimeType)
|
|
2615
|
+
.filter((value, index, array) => array.indexOf(value) === index);
|
|
2614
2616
|
const preferredOrder = getPreferredOrder(availableCodecs, features);
|
|
2615
2617
|
return codecs.sort((a, b) => {
|
|
2616
2618
|
const indexA = preferredOrder.indexOf(a.mimeType.toLowerCase());
|
|
@@ -2620,6 +2622,41 @@ function sortCodecsByMimeType(codecs, features) {
|
|
|
2620
2622
|
return orderA - orderB;
|
|
2621
2623
|
});
|
|
2622
2624
|
}
|
|
2625
|
+
function getIsCodecDecodingPowerEfficient(codec) {
|
|
2626
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2627
|
+
const { powerEfficient } = yield navigator.mediaCapabilities.decodingInfo({
|
|
2628
|
+
type: "webrtc",
|
|
2629
|
+
video: {
|
|
2630
|
+
width: 1280,
|
|
2631
|
+
height: 720,
|
|
2632
|
+
bitrate: 2580,
|
|
2633
|
+
framerate: 24,
|
|
2634
|
+
contentType: codec,
|
|
2635
|
+
},
|
|
2636
|
+
});
|
|
2637
|
+
return powerEfficient;
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
function sortCodecsByPowerEfficiency(codecs) {
|
|
2641
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2642
|
+
const codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
2643
|
+
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
2644
|
+
const sorted = codecs.sort((a, b) => {
|
|
2645
|
+
const aPowerEfficient = codecPowerEfficiencies[a.mimeType];
|
|
2646
|
+
const bPowerEfficient = codecPowerEfficiencies[b.mimeType];
|
|
2647
|
+
return aPowerEfficient === bPowerEfficient ? 0 : aPowerEfficient ? -1 : 1;
|
|
2648
|
+
});
|
|
2649
|
+
return sorted;
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
function sortCodecs(codecs, features) {
|
|
2653
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2654
|
+
if (features.preferHardwareDecodingOn) {
|
|
2655
|
+
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2656
|
+
}
|
|
2657
|
+
return sortCodecsByMimeType(codecs, features);
|
|
2658
|
+
});
|
|
2659
|
+
}
|
|
2623
2660
|
|
|
2624
2661
|
const logger$8 = new Logger();
|
|
2625
2662
|
class ReconnectManager extends EventEmitter {
|
|
@@ -3762,43 +3799,53 @@ class P2pRtcManager {
|
|
|
3762
3799
|
this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
|
|
3763
3800
|
}
|
|
3764
3801
|
}
|
|
3765
|
-
_setCodecPreferences(pc
|
|
3766
|
-
|
|
3767
|
-
const
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3802
|
+
_setCodecPreferences(pc) {
|
|
3803
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3804
|
+
const { p2pVp9On, p2pAv1On, redOn, preferHardwareDecodingOn } = this._features;
|
|
3805
|
+
if (!(p2pVp9On || p2pAv1On || redOn || preferHardwareDecodingOn)) {
|
|
3806
|
+
return;
|
|
3807
|
+
}
|
|
3808
|
+
try {
|
|
3809
|
+
const audioTransceivers = pc
|
|
3810
|
+
.getTransceivers()
|
|
3811
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "audio"; });
|
|
3812
|
+
audioTransceivers.forEach((audioTransceiver) => {
|
|
3813
|
+
if (typeof RTCRtpSender.getCapabilities === "undefined")
|
|
3814
|
+
return;
|
|
3815
|
+
const capabilities = RTCRtpSender.getCapabilities("audio");
|
|
3816
|
+
for (let i = 0; i < capabilities.codecs.length; i++) {
|
|
3817
|
+
if (redOn && capabilities.codecs[i].mimeType.toLowerCase() === "audio/red") {
|
|
3818
|
+
capabilities.codecs.unshift(capabilities.codecs.splice(i, 1)[0]);
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3778
3821
|
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
.
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3822
|
+
if (typeof audioTransceiver.setCodecPreferences === "undefined")
|
|
3823
|
+
return;
|
|
3824
|
+
audioTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3825
|
+
});
|
|
3826
|
+
const videoTransceivers = pc
|
|
3827
|
+
.getTransceivers()
|
|
3828
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "video"; });
|
|
3829
|
+
yield Promise.all(videoTransceivers.map((videoTransceiver) => __awaiter(this, void 0, void 0, function* () {
|
|
3830
|
+
if (RTCRtpReceiver.getCapabilities === undefined)
|
|
3831
|
+
return;
|
|
3832
|
+
if (videoTransceiver.setCodecPreferences === undefined)
|
|
3833
|
+
return;
|
|
3834
|
+
const capabilities = RTCRtpReceiver.getCapabilities("video");
|
|
3835
|
+
if (p2pVp9On || p2pAv1On || preferHardwareDecodingOn) {
|
|
3836
|
+
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3837
|
+
vp9On: p2pVp9On,
|
|
3838
|
+
av1On: p2pAv1On,
|
|
3839
|
+
preferHardwareDecodingOn,
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3843
|
+
})));
|
|
3844
|
+
}
|
|
3845
|
+
catch (error) {
|
|
3846
|
+
logger$7.error("Error during setting setCodecPreferences:", error);
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3802
3849
|
}
|
|
3803
3850
|
_negotiatePeerConnection(clientId, session, constraints) {
|
|
3804
3851
|
if (!session) {
|
|
@@ -3813,16 +3860,14 @@ class P2pRtcManager {
|
|
|
3813
3860
|
return;
|
|
3814
3861
|
}
|
|
3815
3862
|
session.isOperationPending = true;
|
|
3816
|
-
const {
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
}
|
|
3820
|
-
pc.createOffer(constraints || this.offerOptions)
|
|
3863
|
+
const { p2pVp9On, redOn, rtpAbsCaptureTimeOn, cleanSdpOn } = this._features;
|
|
3864
|
+
this._setCodecPreferences(pc).then(() => pc
|
|
3865
|
+
.createOffer(constraints || this.offerOptions)
|
|
3821
3866
|
.then((offer) => {
|
|
3822
3867
|
if (rtpAbsCaptureTimeOn)
|
|
3823
3868
|
offer.sdp = addAbsCaptureTimeExtMap(offer.sdp);
|
|
3824
|
-
if ((
|
|
3825
|
-
offer.sdp = setCodecPreferenceSDP(offer.sdp,
|
|
3869
|
+
if ((p2pVp9On || redOn) && browserName$1 === "firefox") {
|
|
3870
|
+
offer.sdp = setCodecPreferenceSDP(offer.sdp, p2pVp9On, redOn);
|
|
3826
3871
|
}
|
|
3827
3872
|
if (cleanSdpOn)
|
|
3828
3873
|
offer.sdp = cleanSdp(offer.sdp);
|
|
@@ -3841,7 +3886,7 @@ class P2pRtcManager {
|
|
|
3841
3886
|
})
|
|
3842
3887
|
.catch((e) => {
|
|
3843
3888
|
logger$7.warn("RTCPeerConnection.createOffer() failed to create local offer", e);
|
|
3844
|
-
});
|
|
3889
|
+
}));
|
|
3845
3890
|
}
|
|
3846
3891
|
_withForcedRenegotiation(session, action) {
|
|
3847
3892
|
const pc = session.pc;
|
|
@@ -5359,7 +5404,7 @@ class VegaRtcManager {
|
|
|
5359
5404
|
return;
|
|
5360
5405
|
}
|
|
5361
5406
|
const currentPaused = this._micPaused;
|
|
5362
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, this._features)), { appData: {
|
|
5407
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5363
5408
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5364
5409
|
sourceClientId: this._selfId,
|
|
5365
5410
|
screenShare: false,
|
|
@@ -5525,7 +5570,7 @@ class VegaRtcManager {
|
|
|
5525
5570
|
var _b, _c;
|
|
5526
5571
|
try {
|
|
5527
5572
|
const currentPaused = this._webcamPaused;
|
|
5528
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
|
|
5573
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5529
5574
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5530
5575
|
sourceClientId: this._selfId,
|
|
5531
5576
|
screenShare: false,
|
|
@@ -5627,7 +5672,7 @@ class VegaRtcManager {
|
|
|
5627
5672
|
this._screenVideoProducerPromise = null;
|
|
5628
5673
|
return;
|
|
5629
5674
|
}
|
|
5630
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video",
|
|
5675
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5631
5676
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5632
5677
|
sourceClientId: this._selfId,
|
|
5633
5678
|
screenShare: true,
|
|
@@ -5701,7 +5746,7 @@ class VegaRtcManager {
|
|
|
5701
5746
|
this._screenAudioProducerPromise = null;
|
|
5702
5747
|
return;
|
|
5703
5748
|
}
|
|
5704
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio",
|
|
5749
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5705
5750
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5706
5751
|
sourceClientId: this._selfId,
|
|
5707
5752
|
screenShare: true,
|
|
@@ -7945,4 +7990,4 @@ var RtcEventNames;
|
|
|
7945
7990
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7946
7991
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7947
7992
|
|
|
7948
|
-
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters,
|
|
7993
|
+
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2557,7 +2557,7 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
|
|
|
2557
2557
|
encodings: [{ dtx: true }],
|
|
2558
2558
|
};
|
|
2559
2559
|
const getMediaSettings = (kind, isScreenShare, features) => {
|
|
2560
|
-
const { lowDataModeEnabled, simulcastScreenshareOn,
|
|
2560
|
+
const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
|
|
2561
2561
|
if (kind === "audio") {
|
|
2562
2562
|
return AUDIO_SETTINGS;
|
|
2563
2563
|
}
|
|
@@ -2610,7 +2610,9 @@ function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
|
|
|
2610
2610
|
return availableCodecs;
|
|
2611
2611
|
}
|
|
2612
2612
|
function sortCodecsByMimeType(codecs, features) {
|
|
2613
|
-
const availableCodecs = codecs
|
|
2613
|
+
const availableCodecs = codecs
|
|
2614
|
+
.map(({ mimeType }) => mimeType)
|
|
2615
|
+
.filter((value, index, array) => array.indexOf(value) === index);
|
|
2614
2616
|
const preferredOrder = getPreferredOrder(availableCodecs, features);
|
|
2615
2617
|
return codecs.sort((a, b) => {
|
|
2616
2618
|
const indexA = preferredOrder.indexOf(a.mimeType.toLowerCase());
|
|
@@ -2620,6 +2622,41 @@ function sortCodecsByMimeType(codecs, features) {
|
|
|
2620
2622
|
return orderA - orderB;
|
|
2621
2623
|
});
|
|
2622
2624
|
}
|
|
2625
|
+
function getIsCodecDecodingPowerEfficient(codec) {
|
|
2626
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2627
|
+
const { powerEfficient } = yield navigator.mediaCapabilities.decodingInfo({
|
|
2628
|
+
type: "webrtc",
|
|
2629
|
+
video: {
|
|
2630
|
+
width: 1280,
|
|
2631
|
+
height: 720,
|
|
2632
|
+
bitrate: 2580,
|
|
2633
|
+
framerate: 24,
|
|
2634
|
+
contentType: codec,
|
|
2635
|
+
},
|
|
2636
|
+
});
|
|
2637
|
+
return powerEfficient;
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
function sortCodecsByPowerEfficiency(codecs) {
|
|
2641
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2642
|
+
const codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
2643
|
+
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
2644
|
+
const sorted = codecs.sort((a, b) => {
|
|
2645
|
+
const aPowerEfficient = codecPowerEfficiencies[a.mimeType];
|
|
2646
|
+
const bPowerEfficient = codecPowerEfficiencies[b.mimeType];
|
|
2647
|
+
return aPowerEfficient === bPowerEfficient ? 0 : aPowerEfficient ? -1 : 1;
|
|
2648
|
+
});
|
|
2649
|
+
return sorted;
|
|
2650
|
+
});
|
|
2651
|
+
}
|
|
2652
|
+
function sortCodecs(codecs, features) {
|
|
2653
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2654
|
+
if (features.preferHardwareDecodingOn) {
|
|
2655
|
+
codecs = yield sortCodecsByPowerEfficiency(codecs);
|
|
2656
|
+
}
|
|
2657
|
+
return sortCodecsByMimeType(codecs, features);
|
|
2658
|
+
});
|
|
2659
|
+
}
|
|
2623
2660
|
|
|
2624
2661
|
const logger$8 = new Logger();
|
|
2625
2662
|
class ReconnectManager extends EventEmitter {
|
|
@@ -3762,43 +3799,53 @@ class P2pRtcManager {
|
|
|
3762
3799
|
this._negotiatePeerConnection(clientId, session, Object.assign({}, this.offerOptions, { iceRestart: true }));
|
|
3763
3800
|
}
|
|
3764
3801
|
}
|
|
3765
|
-
_setCodecPreferences(pc
|
|
3766
|
-
|
|
3767
|
-
const
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3802
|
+
_setCodecPreferences(pc) {
|
|
3803
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3804
|
+
const { p2pVp9On, p2pAv1On, redOn, preferHardwareDecodingOn } = this._features;
|
|
3805
|
+
if (!(p2pVp9On || p2pAv1On || redOn || preferHardwareDecodingOn)) {
|
|
3806
|
+
return;
|
|
3807
|
+
}
|
|
3808
|
+
try {
|
|
3809
|
+
const audioTransceivers = pc
|
|
3810
|
+
.getTransceivers()
|
|
3811
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "audio"; });
|
|
3812
|
+
audioTransceivers.forEach((audioTransceiver) => {
|
|
3813
|
+
if (typeof RTCRtpSender.getCapabilities === "undefined")
|
|
3814
|
+
return;
|
|
3815
|
+
const capabilities = RTCRtpSender.getCapabilities("audio");
|
|
3816
|
+
for (let i = 0; i < capabilities.codecs.length; i++) {
|
|
3817
|
+
if (redOn && capabilities.codecs[i].mimeType.toLowerCase() === "audio/red") {
|
|
3818
|
+
capabilities.codecs.unshift(capabilities.codecs.splice(i, 1)[0]);
|
|
3819
|
+
break;
|
|
3820
|
+
}
|
|
3778
3821
|
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
.
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3822
|
+
if (typeof audioTransceiver.setCodecPreferences === "undefined")
|
|
3823
|
+
return;
|
|
3824
|
+
audioTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3825
|
+
});
|
|
3826
|
+
const videoTransceivers = pc
|
|
3827
|
+
.getTransceivers()
|
|
3828
|
+
.filter((transceiver) => { var _a, _b; return ((_b = (_a = transceiver === null || transceiver === void 0 ? void 0 : transceiver.sender) === null || _a === void 0 ? void 0 : _a.track) === null || _b === void 0 ? void 0 : _b.kind) === "video"; });
|
|
3829
|
+
yield Promise.all(videoTransceivers.map((videoTransceiver) => __awaiter(this, void 0, void 0, function* () {
|
|
3830
|
+
if (RTCRtpReceiver.getCapabilities === undefined)
|
|
3831
|
+
return;
|
|
3832
|
+
if (videoTransceiver.setCodecPreferences === undefined)
|
|
3833
|
+
return;
|
|
3834
|
+
const capabilities = RTCRtpReceiver.getCapabilities("video");
|
|
3835
|
+
if (p2pVp9On || p2pAv1On || preferHardwareDecodingOn) {
|
|
3836
|
+
capabilities.codecs = yield sortCodecs(capabilities.codecs, {
|
|
3837
|
+
vp9On: p2pVp9On,
|
|
3838
|
+
av1On: p2pAv1On,
|
|
3839
|
+
preferHardwareDecodingOn,
|
|
3840
|
+
});
|
|
3841
|
+
}
|
|
3842
|
+
videoTransceiver.setCodecPreferences(capabilities.codecs);
|
|
3843
|
+
})));
|
|
3844
|
+
}
|
|
3845
|
+
catch (error) {
|
|
3846
|
+
logger$7.error("Error during setting setCodecPreferences:", error);
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3802
3849
|
}
|
|
3803
3850
|
_negotiatePeerConnection(clientId, session, constraints) {
|
|
3804
3851
|
if (!session) {
|
|
@@ -3813,16 +3860,14 @@ class P2pRtcManager {
|
|
|
3813
3860
|
return;
|
|
3814
3861
|
}
|
|
3815
3862
|
session.isOperationPending = true;
|
|
3816
|
-
const {
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
}
|
|
3820
|
-
pc.createOffer(constraints || this.offerOptions)
|
|
3863
|
+
const { p2pVp9On, redOn, rtpAbsCaptureTimeOn, cleanSdpOn } = this._features;
|
|
3864
|
+
this._setCodecPreferences(pc).then(() => pc
|
|
3865
|
+
.createOffer(constraints || this.offerOptions)
|
|
3821
3866
|
.then((offer) => {
|
|
3822
3867
|
if (rtpAbsCaptureTimeOn)
|
|
3823
3868
|
offer.sdp = addAbsCaptureTimeExtMap(offer.sdp);
|
|
3824
|
-
if ((
|
|
3825
|
-
offer.sdp = setCodecPreferenceSDP(offer.sdp,
|
|
3869
|
+
if ((p2pVp9On || redOn) && browserName$1 === "firefox") {
|
|
3870
|
+
offer.sdp = setCodecPreferenceSDP(offer.sdp, p2pVp9On, redOn);
|
|
3826
3871
|
}
|
|
3827
3872
|
if (cleanSdpOn)
|
|
3828
3873
|
offer.sdp = cleanSdp(offer.sdp);
|
|
@@ -3841,7 +3886,7 @@ class P2pRtcManager {
|
|
|
3841
3886
|
})
|
|
3842
3887
|
.catch((e) => {
|
|
3843
3888
|
logger$7.warn("RTCPeerConnection.createOffer() failed to create local offer", e);
|
|
3844
|
-
});
|
|
3889
|
+
}));
|
|
3845
3890
|
}
|
|
3846
3891
|
_withForcedRenegotiation(session, action) {
|
|
3847
3892
|
const pc = session.pc;
|
|
@@ -5359,7 +5404,7 @@ class VegaRtcManager {
|
|
|
5359
5404
|
return;
|
|
5360
5405
|
}
|
|
5361
5406
|
const currentPaused = this._micPaused;
|
|
5362
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, this._features)), { appData: {
|
|
5407
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._micTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5363
5408
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5364
5409
|
sourceClientId: this._selfId,
|
|
5365
5410
|
screenShare: false,
|
|
@@ -5525,7 +5570,7 @@ class VegaRtcManager {
|
|
|
5525
5570
|
var _b, _c;
|
|
5526
5571
|
try {
|
|
5527
5572
|
const currentPaused = this._webcamPaused;
|
|
5528
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, this._features)), { appData: {
|
|
5573
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._webcamTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5529
5574
|
streamId: OUTBOUND_CAM_OUTBOUND_STREAM_ID,
|
|
5530
5575
|
sourceClientId: this._selfId,
|
|
5531
5576
|
screenShare: false,
|
|
@@ -5627,7 +5672,7 @@ class VegaRtcManager {
|
|
|
5627
5672
|
this._screenVideoProducerPromise = null;
|
|
5628
5673
|
return;
|
|
5629
5674
|
}
|
|
5630
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video",
|
|
5675
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenVideoTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("video", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5631
5676
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5632
5677
|
sourceClientId: this._selfId,
|
|
5633
5678
|
screenShare: true,
|
|
@@ -5701,7 +5746,7 @@ class VegaRtcManager {
|
|
|
5701
5746
|
this._screenAudioProducerPromise = null;
|
|
5702
5747
|
return;
|
|
5703
5748
|
}
|
|
5704
|
-
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio",
|
|
5749
|
+
const producer = yield this._sendTransport.produce(Object.assign(Object.assign({ track: this._screenAudioTrack, disableTrackOnPause: false, stopTracks: false }, getMediaSettings("audio", false, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }))), { appData: {
|
|
5705
5750
|
streamId: OUTBOUND_SCREEN_OUTBOUND_STREAM_ID,
|
|
5706
5751
|
sourceClientId: this._selfId,
|
|
5707
5752
|
screenShare: true,
|
|
@@ -7945,5 +7990,5 @@ var RtcEventNames;
|
|
|
7945
7990
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7946
7991
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7947
7992
|
|
|
7948
|
-
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters,
|
|
7993
|
+
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDevice, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, turnServerOverride, variance };
|
|
7949
7994
|
//# sourceMappingURL=legacy-esm.js.map
|