@whereby.com/media 1.26.0 → 1.28.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 CHANGED
@@ -2553,13 +2553,25 @@ const VIDEO_SETTINGS_VP9 = {
2553
2553
  codecOptions: {
2554
2554
  videoGoogleStartBitrate: 500,
2555
2555
  },
2556
- encodings: [{ scalabilityMode: "L3T2_KEY" }],
2556
+ encodings: [{ scalabilityMode: "L3T2", maxBitrate: 1000000 }],
2557
+ };
2558
+ const VIDEO_SETTINGS_VP9_KEY = {
2559
+ codecOptions: {
2560
+ videoGoogleStartBitrate: 500,
2561
+ },
2562
+ encodings: [{ scalabilityMode: "L3T2_KEY", maxBitrate: 1250000 }],
2557
2563
  };
2558
2564
  const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH = {
2559
2565
  codecOptions: {
2560
2566
  videoGoogleStartBitrate: 500,
2561
2567
  },
2562
- encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 800000 }],
2568
+ encodings: [{ scalabilityMode: "L2T2", maxBitrate: 500000 }],
2569
+ };
2570
+ const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY = {
2571
+ codecOptions: {
2572
+ videoGoogleStartBitrate: 500,
2573
+ },
2574
+ encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 650000 }],
2563
2575
  };
2564
2576
  const SCREEN_SHARE_SETTINGS = {
2565
2577
  encodings: [{}],
@@ -2592,54 +2604,98 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
2592
2604
  encodings: [{ dtx: true }],
2593
2605
  };
2594
2606
  const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
2595
- const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
2607
+ const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On, svcKeyScalabilityModeOn } = features;
2596
2608
  if (kind === "audio") {
2597
2609
  return AUDIO_SETTINGS;
2598
2610
  }
2611
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2612
+ const isVp9Available = isChrome && vp9On;
2599
2613
  if (isScreenShare) {
2600
- if (isSomeoneAlreadyPresenting) {
2601
- if (vp9On)
2602
- return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2603
- return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2604
- }
2605
- if (lowBandwidth && !vp9On)
2606
- return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2607
- if (vp9On)
2608
- return SCREEN_SHARE_SETTINGS_VP9;
2609
- if (simulcastScreenshareOn)
2610
- return SCREEN_SHARE_SIMULCAST_SETTINGS;
2611
- return SCREEN_SHARE_SETTINGS;
2614
+ return getScreenShareMediaSettings({
2615
+ lowBandwidth: lowBandwidth,
2616
+ isVp9Available,
2617
+ isSomeoneAlreadyPresenting,
2618
+ simulcastScreenshareOn,
2619
+ });
2612
2620
  }
2613
2621
  else {
2614
- if (lowBandwidth) {
2615
- if (vp9On)
2616
- return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2617
- return VIDEO_SETTINGS_SD;
2622
+ return getCameraMediaSettings({
2623
+ lowBandwidth: lowBandwidth || lowDataModeEnabled,
2624
+ isVp9Available,
2625
+ svcKeyScalabilityModeOn,
2626
+ });
2627
+ }
2628
+ };
2629
+ const getCameraMediaSettings = ({ lowBandwidth, isVp9Available, svcKeyScalabilityModeOn, }) => {
2630
+ if (lowBandwidth) {
2631
+ if (isVp9Available) {
2632
+ if (svcKeyScalabilityModeOn)
2633
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY;
2634
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2618
2635
  }
2619
- if (vp9On)
2620
- return VIDEO_SETTINGS_VP9;
2621
- if (lowDataModeEnabled)
2622
- return VIDEO_SETTINGS_SD;
2623
- return VIDEO_SETTINGS_HD;
2636
+ return VIDEO_SETTINGS_SD;
2624
2637
  }
2638
+ if (isVp9Available) {
2639
+ if (svcKeyScalabilityModeOn)
2640
+ return VIDEO_SETTINGS_VP9_KEY;
2641
+ return VIDEO_SETTINGS_VP9;
2642
+ }
2643
+ return VIDEO_SETTINGS_HD;
2644
+ };
2645
+ const getScreenShareMediaSettings = ({ lowBandwidth, isVp9Available, isSomeoneAlreadyPresenting, simulcastScreenshareOn, }) => {
2646
+ if (isSomeoneAlreadyPresenting) {
2647
+ if (isVp9Available)
2648
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2649
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2650
+ }
2651
+ if (lowBandwidth && !isVp9Available)
2652
+ return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2653
+ if (isVp9Available)
2654
+ return SCREEN_SHARE_SETTINGS_VP9;
2655
+ if (simulcastScreenshareOn)
2656
+ return SCREEN_SHARE_SIMULCAST_SETTINGS;
2657
+ return SCREEN_SHARE_SETTINGS;
2625
2658
  };
2659
+ var PrioritizableCodec;
2660
+ (function (PrioritizableCodec) {
2661
+ PrioritizableCodec["H264"] = "video/h264";
2662
+ PrioritizableCodec["VP9"] = "video/vp9";
2663
+ })(PrioritizableCodec || (PrioritizableCodec = {}));
2626
2664
  const modifyMediaCapabilities = (routerRtpCapabilities, features) => {
2627
2665
  const { vp9On, h264On } = features;
2628
- if (vp9On) {
2629
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/vp9");
2630
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2631
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2632
- codec.preferredPayloadType === preferredPayloadType ||
2633
- codec.preferredPayloadType === aptPreferredPayloadType);
2666
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2667
+ if (!(routerRtpCapabilities === null || routerRtpCapabilities === void 0 ? void 0 : routerRtpCapabilities.codecs)) {
2668
+ return routerRtpCapabilities;
2669
+ }
2670
+ if (vp9On && isChrome) {
2671
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.VP9);
2672
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2634
2673
  }
2635
2674
  else if (h264On) {
2636
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/h264");
2637
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2638
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2639
- codec.preferredPayloadType === preferredPayloadType ||
2640
- codec.preferredPayloadType === aptPreferredPayloadType);
2675
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.H264);
2676
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2641
2677
  }
2678
+ return routerRtpCapabilities;
2642
2679
  };
2680
+ function prioritizeRouterRtpCapabilitiesCodecs(codecs, preferredCodec) {
2681
+ const preferredCodecEntry = codecs.find(({ mimeType }) => mimeType.toLowerCase() === preferredCodec);
2682
+ if (!preferredCodecEntry) {
2683
+ return codecs;
2684
+ }
2685
+ return [...codecs].sort((left, right) => {
2686
+ if (left.mimeType.toLowerCase() === preferredCodec) {
2687
+ return -1;
2688
+ }
2689
+ if (left.mimeType.toLowerCase() === "video/rtx" &&
2690
+ left.parameters.apt === preferredCodecEntry.preferredPayloadType) {
2691
+ if (right.mimeType.toLowerCase() === preferredCodec) {
2692
+ return 1;
2693
+ }
2694
+ return -1;
2695
+ }
2696
+ return 0;
2697
+ });
2698
+ }
2643
2699
  function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
2644
2700
  if (vp9On) {
2645
2701
  availableCodecs.unshift("video/vp9");
@@ -5245,9 +5301,9 @@ class VegaRtcManager {
5245
5301
  try {
5246
5302
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
5247
5303
  if (!this._routerRtpCapabilities) {
5248
- modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5249
- this._routerRtpCapabilities = routerRtpCapabilities;
5250
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
5304
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5305
+ this._routerRtpCapabilities = modifiedCapabilities;
5306
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
5251
5307
  }
5252
5308
  this._vegaConnection.message("setCapabilities", {
5253
5309
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -7360,9 +7416,9 @@ class BandwidthTester extends EventEmitter {
7360
7416
  try {
7361
7417
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
7362
7418
  if (!this._routerRtpCapabilities) {
7363
- modifyMediaCapabilities(routerRtpCapabilities, this._features);
7364
- this._routerRtpCapabilities = routerRtpCapabilities;
7365
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
7419
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
7420
+ this._routerRtpCapabilities = modifiedCapabilities;
7421
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
7366
7422
  }
7367
7423
  this._vegaConnection.message("setCapabilities", {
7368
7424
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -8023,6 +8079,9 @@ exports.RtcEventNames = void 0;
8023
8079
  RtcEventNames["stream_added"] = "stream_added";
8024
8080
  })(exports.RtcEventNames || (exports.RtcEventNames = {}));
8025
8081
 
8082
+ exports.ADDITIONAL_SCREEN_SHARE_SETTINGS = ADDITIONAL_SCREEN_SHARE_SETTINGS;
8083
+ exports.ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9 = ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
8084
+ exports.AUDIO_SETTINGS = AUDIO_SETTINGS;
8026
8085
  exports.BandwidthTester = BandwidthTester;
8027
8086
  exports.EVENTS = EVENTS;
8028
8087
  exports.KNOCK_MESSAGES = KNOCK_MESSAGES;
@@ -8041,11 +8100,21 @@ exports.RELAY_MESSAGES = RELAY_MESSAGES;
8041
8100
  exports.ReconnectManager = ReconnectManager;
8042
8101
  exports.RtcManagerDispatcher = RtcManagerDispatcher;
8043
8102
  exports.RtcStream = RtcStream;
8103
+ exports.SCREEN_SHARE_SETTINGS = SCREEN_SHARE_SETTINGS;
8104
+ exports.SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH = SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
8105
+ exports.SCREEN_SHARE_SETTINGS_VP9 = SCREEN_SHARE_SETTINGS_VP9;
8106
+ exports.SCREEN_SHARE_SIMULCAST_SETTINGS = SCREEN_SHARE_SIMULCAST_SETTINGS;
8044
8107
  exports.STREAM_TYPES = STREAM_TYPES;
8045
8108
  exports.ServerSocket = ServerSocket;
8046
8109
  exports.Session = Session;
8047
8110
  exports.SfuV2Parser = SfuV2Parser;
8048
8111
  exports.TYPES = TYPES;
8112
+ exports.VIDEO_SETTINGS_HD = VIDEO_SETTINGS_HD;
8113
+ exports.VIDEO_SETTINGS_SD = VIDEO_SETTINGS_SD;
8114
+ exports.VIDEO_SETTINGS_VP9 = VIDEO_SETTINGS_VP9;
8115
+ exports.VIDEO_SETTINGS_VP9_KEY = VIDEO_SETTINGS_VP9_KEY;
8116
+ exports.VIDEO_SETTINGS_VP9_LOW_BANDWIDTH = VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
8117
+ exports.VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY = VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY;
8049
8118
  exports.VegaConnection = VegaConnection;
8050
8119
  exports.VegaMediaQualityMonitor = VegaMediaQualityMonitor;
8051
8120
  exports.VegaRtcManager = VegaRtcManager;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Device } from 'mediasoup-client';
2
2
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
3
+ import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
3
4
 
4
5
  interface MetricData {
5
6
  ticks: number;
@@ -596,18 +597,117 @@ declare const ipRegex: {
596
597
  }): RegExp;
597
598
  };
598
599
 
600
+ declare const AUDIO_SETTINGS: {
601
+ codecOptions: {
602
+ opusDtx: boolean;
603
+ opusFec: boolean;
604
+ };
605
+ encodings: {
606
+ dtx: boolean;
607
+ }[];
608
+ };
609
+ declare const VIDEO_SETTINGS_HD: {
610
+ codecOptions: {
611
+ videoGoogleStartBitrate: number;
612
+ };
613
+ encodings: {
614
+ scaleResolutionDownBy: number;
615
+ maxBitrate: number;
616
+ }[];
617
+ };
618
+ declare const VIDEO_SETTINGS_SD: {
619
+ codecOptions: {
620
+ videoGoogleStartBitrate: number;
621
+ };
622
+ encodings: {
623
+ scaleResolutionDownBy: number;
624
+ maxBitrate: number;
625
+ }[];
626
+ };
627
+ declare const VIDEO_SETTINGS_VP9: {
628
+ codecOptions: {
629
+ videoGoogleStartBitrate: number;
630
+ };
631
+ encodings: {
632
+ scalabilityMode: string;
633
+ maxBitrate: number;
634
+ }[];
635
+ };
636
+ declare const VIDEO_SETTINGS_VP9_KEY: {
637
+ codecOptions: {
638
+ videoGoogleStartBitrate: number;
639
+ };
640
+ encodings: {
641
+ scalabilityMode: string;
642
+ maxBitrate: number;
643
+ }[];
644
+ };
645
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH: {
646
+ codecOptions: {
647
+ videoGoogleStartBitrate: number;
648
+ };
649
+ encodings: {
650
+ scalabilityMode: string;
651
+ maxBitrate: number;
652
+ }[];
653
+ };
654
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY: {
655
+ codecOptions: {
656
+ videoGoogleStartBitrate: number;
657
+ };
658
+ encodings: {
659
+ scalabilityMode: string;
660
+ maxBitrate: number;
661
+ }[];
662
+ };
663
+ declare const SCREEN_SHARE_SETTINGS: {
664
+ encodings: {}[];
665
+ };
666
+ declare const SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH: {
667
+ encodings: {
668
+ maxBitrate: number;
669
+ maxFramerate: number;
670
+ }[];
671
+ };
672
+ declare const SCREEN_SHARE_SIMULCAST_SETTINGS: {
673
+ encodings: {
674
+ scaleResolutionDownBy: number;
675
+ dtx: boolean;
676
+ maxBitrate: number;
677
+ }[];
678
+ };
679
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS: {
680
+ encodings: {
681
+ scaleResolutionDownBy: number;
682
+ dtx: boolean;
683
+ maxBitrate: number;
684
+ }[];
685
+ };
686
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9: {
687
+ encodings: {
688
+ scalabilityMode: string;
689
+ dtx: boolean;
690
+ maxBitrate: number;
691
+ }[];
692
+ };
693
+ declare const SCREEN_SHARE_SETTINGS_VP9: {
694
+ encodings: {
695
+ dtx: boolean;
696
+ }[];
697
+ };
599
698
  declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
600
699
  lowDataModeEnabled?: boolean;
601
700
  simulcastScreenshareOn?: boolean;
602
701
  lowBandwidth?: boolean;
603
702
  vp9On?: boolean;
703
+ svcKeyScalabilityModeOn?: boolean;
604
704
  }, isSomeoneAlreadyPresenting?: boolean) => {
605
705
  encodings: {}[];
606
706
  };
607
- declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
707
+ declare const modifyMediaCapabilities: (routerRtpCapabilities: RtpCapabilities, features: {
608
708
  vp9On?: boolean;
609
709
  h264On?: boolean;
610
- }) => void;
710
+ }) => RtpCapabilities;
611
711
  interface Codec {
612
712
  clockRate: number;
613
713
  mimeType: string;
@@ -1717,4 +1817,4 @@ declare class RtcStream {
1717
1817
  static getTypeFromId(id: string): string;
1718
1818
  }
1719
1819
 
1720
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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 };
1820
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9, AUDIO_SETTINGS, type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH, SCREEN_SHARE_SETTINGS_VP9, SCREEN_SHARE_SIMULCAST_SETTINGS, 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, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_KEY, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY, 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
@@ -1,5 +1,6 @@
1
1
  import { Device } from 'mediasoup-client';
2
2
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
3
+ import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
3
4
 
4
5
  interface MetricData {
5
6
  ticks: number;
@@ -596,18 +597,117 @@ declare const ipRegex: {
596
597
  }): RegExp;
597
598
  };
598
599
 
600
+ declare const AUDIO_SETTINGS: {
601
+ codecOptions: {
602
+ opusDtx: boolean;
603
+ opusFec: boolean;
604
+ };
605
+ encodings: {
606
+ dtx: boolean;
607
+ }[];
608
+ };
609
+ declare const VIDEO_SETTINGS_HD: {
610
+ codecOptions: {
611
+ videoGoogleStartBitrate: number;
612
+ };
613
+ encodings: {
614
+ scaleResolutionDownBy: number;
615
+ maxBitrate: number;
616
+ }[];
617
+ };
618
+ declare const VIDEO_SETTINGS_SD: {
619
+ codecOptions: {
620
+ videoGoogleStartBitrate: number;
621
+ };
622
+ encodings: {
623
+ scaleResolutionDownBy: number;
624
+ maxBitrate: number;
625
+ }[];
626
+ };
627
+ declare const VIDEO_SETTINGS_VP9: {
628
+ codecOptions: {
629
+ videoGoogleStartBitrate: number;
630
+ };
631
+ encodings: {
632
+ scalabilityMode: string;
633
+ maxBitrate: number;
634
+ }[];
635
+ };
636
+ declare const VIDEO_SETTINGS_VP9_KEY: {
637
+ codecOptions: {
638
+ videoGoogleStartBitrate: number;
639
+ };
640
+ encodings: {
641
+ scalabilityMode: string;
642
+ maxBitrate: number;
643
+ }[];
644
+ };
645
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH: {
646
+ codecOptions: {
647
+ videoGoogleStartBitrate: number;
648
+ };
649
+ encodings: {
650
+ scalabilityMode: string;
651
+ maxBitrate: number;
652
+ }[];
653
+ };
654
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY: {
655
+ codecOptions: {
656
+ videoGoogleStartBitrate: number;
657
+ };
658
+ encodings: {
659
+ scalabilityMode: string;
660
+ maxBitrate: number;
661
+ }[];
662
+ };
663
+ declare const SCREEN_SHARE_SETTINGS: {
664
+ encodings: {}[];
665
+ };
666
+ declare const SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH: {
667
+ encodings: {
668
+ maxBitrate: number;
669
+ maxFramerate: number;
670
+ }[];
671
+ };
672
+ declare const SCREEN_SHARE_SIMULCAST_SETTINGS: {
673
+ encodings: {
674
+ scaleResolutionDownBy: number;
675
+ dtx: boolean;
676
+ maxBitrate: number;
677
+ }[];
678
+ };
679
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS: {
680
+ encodings: {
681
+ scaleResolutionDownBy: number;
682
+ dtx: boolean;
683
+ maxBitrate: number;
684
+ }[];
685
+ };
686
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9: {
687
+ encodings: {
688
+ scalabilityMode: string;
689
+ dtx: boolean;
690
+ maxBitrate: number;
691
+ }[];
692
+ };
693
+ declare const SCREEN_SHARE_SETTINGS_VP9: {
694
+ encodings: {
695
+ dtx: boolean;
696
+ }[];
697
+ };
599
698
  declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
600
699
  lowDataModeEnabled?: boolean;
601
700
  simulcastScreenshareOn?: boolean;
602
701
  lowBandwidth?: boolean;
603
702
  vp9On?: boolean;
703
+ svcKeyScalabilityModeOn?: boolean;
604
704
  }, isSomeoneAlreadyPresenting?: boolean) => {
605
705
  encodings: {}[];
606
706
  };
607
- declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
707
+ declare const modifyMediaCapabilities: (routerRtpCapabilities: RtpCapabilities, features: {
608
708
  vp9On?: boolean;
609
709
  h264On?: boolean;
610
- }) => void;
710
+ }) => RtpCapabilities;
611
711
  interface Codec {
612
712
  clockRate: number;
613
713
  mimeType: string;
@@ -1717,4 +1817,4 @@ declare class RtcStream {
1717
1817
  static getTypeFromId(id: string): string;
1718
1818
  }
1719
1819
 
1720
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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 };
1820
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9, AUDIO_SETTINGS, type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH, SCREEN_SHARE_SETTINGS_VP9, SCREEN_SHARE_SIMULCAST_SETTINGS, 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, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_KEY, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY, 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
@@ -1,5 +1,6 @@
1
1
  import { Device } from 'mediasoup-client';
2
2
  import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
3
+ import { RtpCapabilities } from 'mediasoup-client/lib/RtpParameters';
3
4
 
4
5
  interface MetricData {
5
6
  ticks: number;
@@ -596,18 +597,117 @@ declare const ipRegex: {
596
597
  }): RegExp;
597
598
  };
598
599
 
600
+ declare const AUDIO_SETTINGS: {
601
+ codecOptions: {
602
+ opusDtx: boolean;
603
+ opusFec: boolean;
604
+ };
605
+ encodings: {
606
+ dtx: boolean;
607
+ }[];
608
+ };
609
+ declare const VIDEO_SETTINGS_HD: {
610
+ codecOptions: {
611
+ videoGoogleStartBitrate: number;
612
+ };
613
+ encodings: {
614
+ scaleResolutionDownBy: number;
615
+ maxBitrate: number;
616
+ }[];
617
+ };
618
+ declare const VIDEO_SETTINGS_SD: {
619
+ codecOptions: {
620
+ videoGoogleStartBitrate: number;
621
+ };
622
+ encodings: {
623
+ scaleResolutionDownBy: number;
624
+ maxBitrate: number;
625
+ }[];
626
+ };
627
+ declare const VIDEO_SETTINGS_VP9: {
628
+ codecOptions: {
629
+ videoGoogleStartBitrate: number;
630
+ };
631
+ encodings: {
632
+ scalabilityMode: string;
633
+ maxBitrate: number;
634
+ }[];
635
+ };
636
+ declare const VIDEO_SETTINGS_VP9_KEY: {
637
+ codecOptions: {
638
+ videoGoogleStartBitrate: number;
639
+ };
640
+ encodings: {
641
+ scalabilityMode: string;
642
+ maxBitrate: number;
643
+ }[];
644
+ };
645
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH: {
646
+ codecOptions: {
647
+ videoGoogleStartBitrate: number;
648
+ };
649
+ encodings: {
650
+ scalabilityMode: string;
651
+ maxBitrate: number;
652
+ }[];
653
+ };
654
+ declare const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY: {
655
+ codecOptions: {
656
+ videoGoogleStartBitrate: number;
657
+ };
658
+ encodings: {
659
+ scalabilityMode: string;
660
+ maxBitrate: number;
661
+ }[];
662
+ };
663
+ declare const SCREEN_SHARE_SETTINGS: {
664
+ encodings: {}[];
665
+ };
666
+ declare const SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH: {
667
+ encodings: {
668
+ maxBitrate: number;
669
+ maxFramerate: number;
670
+ }[];
671
+ };
672
+ declare const SCREEN_SHARE_SIMULCAST_SETTINGS: {
673
+ encodings: {
674
+ scaleResolutionDownBy: number;
675
+ dtx: boolean;
676
+ maxBitrate: number;
677
+ }[];
678
+ };
679
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS: {
680
+ encodings: {
681
+ scaleResolutionDownBy: number;
682
+ dtx: boolean;
683
+ maxBitrate: number;
684
+ }[];
685
+ };
686
+ declare const ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9: {
687
+ encodings: {
688
+ scalabilityMode: string;
689
+ dtx: boolean;
690
+ maxBitrate: number;
691
+ }[];
692
+ };
693
+ declare const SCREEN_SHARE_SETTINGS_VP9: {
694
+ encodings: {
695
+ dtx: boolean;
696
+ }[];
697
+ };
599
698
  declare const getMediaSettings: (kind: string, isScreenShare: boolean, features: {
600
699
  lowDataModeEnabled?: boolean;
601
700
  simulcastScreenshareOn?: boolean;
602
701
  lowBandwidth?: boolean;
603
702
  vp9On?: boolean;
703
+ svcKeyScalabilityModeOn?: boolean;
604
704
  }, isSomeoneAlreadyPresenting?: boolean) => {
605
705
  encodings: {}[];
606
706
  };
607
- declare const modifyMediaCapabilities: (routerRtpCapabilities: any, features: {
707
+ declare const modifyMediaCapabilities: (routerRtpCapabilities: RtpCapabilities, features: {
608
708
  vp9On?: boolean;
609
709
  h264On?: boolean;
610
- }) => void;
710
+ }) => RtpCapabilities;
611
711
  interface Codec {
612
712
  clockRate: number;
613
713
  mimeType: string;
@@ -1717,4 +1817,4 @@ declare class RtcStream {
1717
1817
  static getTypeFromId(id: string): string;
1718
1818
  }
1719
1819
 
1720
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, 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 };
1820
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9, AUDIO_SETTINGS, type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutConfig, type BreakoutGroupJoinedEvent, type BreakoutSessionUpdatedEvent, type CannotJoinUnclaimedRoomError, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Codec, type Credentials, type CustomMediaStreamTrack, EVENTS, type ForbiddenError, type ForbiddenErrorNames, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type HostPresenceControlsError, type IdentifyDeviceRequest, type InternalServerError, 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 MaxViewerLimitReachedError, type NewClientEvent, NoDevicesError, type OrganizationPlanExhaustedError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomConcurrencyControlsError, type RoomFullError, type RoomJoinedErrors, type RoomJoinedEvent, type RoomJoinedSuccess, type RoomKnockedEvent, type RoomLockedError, type RoomLockedEvent, type RoomMeetingTimeExhaustedError, type RoomMode, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH, SCREEN_SHARE_SETTINGS_VP9, SCREEN_SHARE_SIMULCAST_SETTINGS, 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, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_KEY, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY, 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
@@ -2528,13 +2528,25 @@ const VIDEO_SETTINGS_VP9 = {
2528
2528
  codecOptions: {
2529
2529
  videoGoogleStartBitrate: 500,
2530
2530
  },
2531
- encodings: [{ scalabilityMode: "L3T2_KEY" }],
2531
+ encodings: [{ scalabilityMode: "L3T2", maxBitrate: 1000000 }],
2532
+ };
2533
+ const VIDEO_SETTINGS_VP9_KEY = {
2534
+ codecOptions: {
2535
+ videoGoogleStartBitrate: 500,
2536
+ },
2537
+ encodings: [{ scalabilityMode: "L3T2_KEY", maxBitrate: 1250000 }],
2532
2538
  };
2533
2539
  const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH = {
2534
2540
  codecOptions: {
2535
2541
  videoGoogleStartBitrate: 500,
2536
2542
  },
2537
- encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 800000 }],
2543
+ encodings: [{ scalabilityMode: "L2T2", maxBitrate: 500000 }],
2544
+ };
2545
+ const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY = {
2546
+ codecOptions: {
2547
+ videoGoogleStartBitrate: 500,
2548
+ },
2549
+ encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 650000 }],
2538
2550
  };
2539
2551
  const SCREEN_SHARE_SETTINGS = {
2540
2552
  encodings: [{}],
@@ -2567,54 +2579,98 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
2567
2579
  encodings: [{ dtx: true }],
2568
2580
  };
2569
2581
  const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
2570
- const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
2582
+ const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On, svcKeyScalabilityModeOn } = features;
2571
2583
  if (kind === "audio") {
2572
2584
  return AUDIO_SETTINGS;
2573
2585
  }
2586
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2587
+ const isVp9Available = isChrome && vp9On;
2574
2588
  if (isScreenShare) {
2575
- if (isSomeoneAlreadyPresenting) {
2576
- if (vp9On)
2577
- return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2578
- return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2579
- }
2580
- if (lowBandwidth && !vp9On)
2581
- return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2582
- if (vp9On)
2583
- return SCREEN_SHARE_SETTINGS_VP9;
2584
- if (simulcastScreenshareOn)
2585
- return SCREEN_SHARE_SIMULCAST_SETTINGS;
2586
- return SCREEN_SHARE_SETTINGS;
2589
+ return getScreenShareMediaSettings({
2590
+ lowBandwidth: lowBandwidth,
2591
+ isVp9Available,
2592
+ isSomeoneAlreadyPresenting,
2593
+ simulcastScreenshareOn,
2594
+ });
2587
2595
  }
2588
2596
  else {
2589
- if (lowBandwidth) {
2590
- if (vp9On)
2591
- return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2592
- return VIDEO_SETTINGS_SD;
2597
+ return getCameraMediaSettings({
2598
+ lowBandwidth: lowBandwidth || lowDataModeEnabled,
2599
+ isVp9Available,
2600
+ svcKeyScalabilityModeOn,
2601
+ });
2602
+ }
2603
+ };
2604
+ const getCameraMediaSettings = ({ lowBandwidth, isVp9Available, svcKeyScalabilityModeOn, }) => {
2605
+ if (lowBandwidth) {
2606
+ if (isVp9Available) {
2607
+ if (svcKeyScalabilityModeOn)
2608
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY;
2609
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2593
2610
  }
2594
- if (vp9On)
2595
- return VIDEO_SETTINGS_VP9;
2596
- if (lowDataModeEnabled)
2597
- return VIDEO_SETTINGS_SD;
2598
- return VIDEO_SETTINGS_HD;
2611
+ return VIDEO_SETTINGS_SD;
2599
2612
  }
2613
+ if (isVp9Available) {
2614
+ if (svcKeyScalabilityModeOn)
2615
+ return VIDEO_SETTINGS_VP9_KEY;
2616
+ return VIDEO_SETTINGS_VP9;
2617
+ }
2618
+ return VIDEO_SETTINGS_HD;
2619
+ };
2620
+ const getScreenShareMediaSettings = ({ lowBandwidth, isVp9Available, isSomeoneAlreadyPresenting, simulcastScreenshareOn, }) => {
2621
+ if (isSomeoneAlreadyPresenting) {
2622
+ if (isVp9Available)
2623
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2624
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2625
+ }
2626
+ if (lowBandwidth && !isVp9Available)
2627
+ return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2628
+ if (isVp9Available)
2629
+ return SCREEN_SHARE_SETTINGS_VP9;
2630
+ if (simulcastScreenshareOn)
2631
+ return SCREEN_SHARE_SIMULCAST_SETTINGS;
2632
+ return SCREEN_SHARE_SETTINGS;
2600
2633
  };
2634
+ var PrioritizableCodec;
2635
+ (function (PrioritizableCodec) {
2636
+ PrioritizableCodec["H264"] = "video/h264";
2637
+ PrioritizableCodec["VP9"] = "video/vp9";
2638
+ })(PrioritizableCodec || (PrioritizableCodec = {}));
2601
2639
  const modifyMediaCapabilities = (routerRtpCapabilities, features) => {
2602
2640
  const { vp9On, h264On } = features;
2603
- if (vp9On) {
2604
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/vp9");
2605
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2606
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2607
- codec.preferredPayloadType === preferredPayloadType ||
2608
- codec.preferredPayloadType === aptPreferredPayloadType);
2641
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2642
+ if (!(routerRtpCapabilities === null || routerRtpCapabilities === void 0 ? void 0 : routerRtpCapabilities.codecs)) {
2643
+ return routerRtpCapabilities;
2644
+ }
2645
+ if (vp9On && isChrome) {
2646
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.VP9);
2647
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2609
2648
  }
2610
2649
  else if (h264On) {
2611
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/h264");
2612
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2613
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2614
- codec.preferredPayloadType === preferredPayloadType ||
2615
- codec.preferredPayloadType === aptPreferredPayloadType);
2650
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.H264);
2651
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2616
2652
  }
2653
+ return routerRtpCapabilities;
2617
2654
  };
2655
+ function prioritizeRouterRtpCapabilitiesCodecs(codecs, preferredCodec) {
2656
+ const preferredCodecEntry = codecs.find(({ mimeType }) => mimeType.toLowerCase() === preferredCodec);
2657
+ if (!preferredCodecEntry) {
2658
+ return codecs;
2659
+ }
2660
+ return [...codecs].sort((left, right) => {
2661
+ if (left.mimeType.toLowerCase() === preferredCodec) {
2662
+ return -1;
2663
+ }
2664
+ if (left.mimeType.toLowerCase() === "video/rtx" &&
2665
+ left.parameters.apt === preferredCodecEntry.preferredPayloadType) {
2666
+ if (right.mimeType.toLowerCase() === preferredCodec) {
2667
+ return 1;
2668
+ }
2669
+ return -1;
2670
+ }
2671
+ return 0;
2672
+ });
2673
+ }
2618
2674
  function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
2619
2675
  if (vp9On) {
2620
2676
  availableCodecs.unshift("video/vp9");
@@ -5220,9 +5276,9 @@ class VegaRtcManager {
5220
5276
  try {
5221
5277
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
5222
5278
  if (!this._routerRtpCapabilities) {
5223
- modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5224
- this._routerRtpCapabilities = routerRtpCapabilities;
5225
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
5279
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5280
+ this._routerRtpCapabilities = modifiedCapabilities;
5281
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
5226
5282
  }
5227
5283
  this._vegaConnection.message("setCapabilities", {
5228
5284
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -7335,9 +7391,9 @@ class BandwidthTester extends EventEmitter {
7335
7391
  try {
7336
7392
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
7337
7393
  if (!this._routerRtpCapabilities) {
7338
- modifyMediaCapabilities(routerRtpCapabilities, this._features);
7339
- this._routerRtpCapabilities = routerRtpCapabilities;
7340
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
7394
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
7395
+ this._routerRtpCapabilities = modifiedCapabilities;
7396
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
7341
7397
  }
7342
7398
  this._vegaConnection.message("setCapabilities", {
7343
7399
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -7998,4 +8054,4 @@ var RtcEventNames;
7998
8054
  RtcEventNames["stream_added"] = "stream_added";
7999
8055
  })(RtcEventNames || (RtcEventNames = {}));
8000
8056
 
8001
- 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 };
8057
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9, AUDIO_SETTINGS, 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, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH, SCREEN_SHARE_SETTINGS_VP9, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_KEY, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY, 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 };
@@ -2528,13 +2528,25 @@ const VIDEO_SETTINGS_VP9 = {
2528
2528
  codecOptions: {
2529
2529
  videoGoogleStartBitrate: 500,
2530
2530
  },
2531
- encodings: [{ scalabilityMode: "L3T2_KEY" }],
2531
+ encodings: [{ scalabilityMode: "L3T2", maxBitrate: 1000000 }],
2532
+ };
2533
+ const VIDEO_SETTINGS_VP9_KEY = {
2534
+ codecOptions: {
2535
+ videoGoogleStartBitrate: 500,
2536
+ },
2537
+ encodings: [{ scalabilityMode: "L3T2_KEY", maxBitrate: 1250000 }],
2532
2538
  };
2533
2539
  const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH = {
2534
2540
  codecOptions: {
2535
2541
  videoGoogleStartBitrate: 500,
2536
2542
  },
2537
- encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 800000 }],
2543
+ encodings: [{ scalabilityMode: "L2T2", maxBitrate: 500000 }],
2544
+ };
2545
+ const VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY = {
2546
+ codecOptions: {
2547
+ videoGoogleStartBitrate: 500,
2548
+ },
2549
+ encodings: [{ scalabilityMode: "L2T2_KEY", maxBitrate: 650000 }],
2538
2550
  };
2539
2551
  const SCREEN_SHARE_SETTINGS = {
2540
2552
  encodings: [{}],
@@ -2567,54 +2579,98 @@ const SCREEN_SHARE_SETTINGS_VP9 = {
2567
2579
  encodings: [{ dtx: true }],
2568
2580
  };
2569
2581
  const getMediaSettings = (kind, isScreenShare, features, isSomeoneAlreadyPresenting = false) => {
2570
- const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On } = features;
2582
+ const { lowDataModeEnabled, simulcastScreenshareOn, lowBandwidth, vp9On, svcKeyScalabilityModeOn } = features;
2571
2583
  if (kind === "audio") {
2572
2584
  return AUDIO_SETTINGS;
2573
2585
  }
2586
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2587
+ const isVp9Available = isChrome && vp9On;
2574
2588
  if (isScreenShare) {
2575
- if (isSomeoneAlreadyPresenting) {
2576
- if (vp9On)
2577
- return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2578
- return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2579
- }
2580
- if (lowBandwidth && !vp9On)
2581
- return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2582
- if (vp9On)
2583
- return SCREEN_SHARE_SETTINGS_VP9;
2584
- if (simulcastScreenshareOn)
2585
- return SCREEN_SHARE_SIMULCAST_SETTINGS;
2586
- return SCREEN_SHARE_SETTINGS;
2589
+ return getScreenShareMediaSettings({
2590
+ lowBandwidth: lowBandwidth,
2591
+ isVp9Available,
2592
+ isSomeoneAlreadyPresenting,
2593
+ simulcastScreenshareOn,
2594
+ });
2587
2595
  }
2588
2596
  else {
2589
- if (lowBandwidth) {
2590
- if (vp9On)
2591
- return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2592
- return VIDEO_SETTINGS_SD;
2597
+ return getCameraMediaSettings({
2598
+ lowBandwidth: lowBandwidth || lowDataModeEnabled,
2599
+ isVp9Available,
2600
+ svcKeyScalabilityModeOn,
2601
+ });
2602
+ }
2603
+ };
2604
+ const getCameraMediaSettings = ({ lowBandwidth, isVp9Available, svcKeyScalabilityModeOn, }) => {
2605
+ if (lowBandwidth) {
2606
+ if (isVp9Available) {
2607
+ if (svcKeyScalabilityModeOn)
2608
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY;
2609
+ return VIDEO_SETTINGS_VP9_LOW_BANDWIDTH;
2593
2610
  }
2594
- if (vp9On)
2595
- return VIDEO_SETTINGS_VP9;
2596
- if (lowDataModeEnabled)
2597
- return VIDEO_SETTINGS_SD;
2598
- return VIDEO_SETTINGS_HD;
2611
+ return VIDEO_SETTINGS_SD;
2599
2612
  }
2613
+ if (isVp9Available) {
2614
+ if (svcKeyScalabilityModeOn)
2615
+ return VIDEO_SETTINGS_VP9_KEY;
2616
+ return VIDEO_SETTINGS_VP9;
2617
+ }
2618
+ return VIDEO_SETTINGS_HD;
2619
+ };
2620
+ const getScreenShareMediaSettings = ({ lowBandwidth, isVp9Available, isSomeoneAlreadyPresenting, simulcastScreenshareOn, }) => {
2621
+ if (isSomeoneAlreadyPresenting) {
2622
+ if (isVp9Available)
2623
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9;
2624
+ return ADDITIONAL_SCREEN_SHARE_SETTINGS;
2625
+ }
2626
+ if (lowBandwidth && !isVp9Available)
2627
+ return SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH;
2628
+ if (isVp9Available)
2629
+ return SCREEN_SHARE_SETTINGS_VP9;
2630
+ if (simulcastScreenshareOn)
2631
+ return SCREEN_SHARE_SIMULCAST_SETTINGS;
2632
+ return SCREEN_SHARE_SETTINGS;
2600
2633
  };
2634
+ var PrioritizableCodec;
2635
+ (function (PrioritizableCodec) {
2636
+ PrioritizableCodec["H264"] = "video/h264";
2637
+ PrioritizableCodec["VP9"] = "video/vp9";
2638
+ })(PrioritizableCodec || (PrioritizableCodec = {}));
2601
2639
  const modifyMediaCapabilities = (routerRtpCapabilities, features) => {
2602
2640
  const { vp9On, h264On } = features;
2603
- if (vp9On) {
2604
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/vp9");
2605
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2606
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2607
- codec.preferredPayloadType === preferredPayloadType ||
2608
- codec.preferredPayloadType === aptPreferredPayloadType);
2641
+ const isChrome = adapterRaw.browserDetails.browser === "chrome";
2642
+ if (!(routerRtpCapabilities === null || routerRtpCapabilities === void 0 ? void 0 : routerRtpCapabilities.codecs)) {
2643
+ return routerRtpCapabilities;
2644
+ }
2645
+ if (vp9On && isChrome) {
2646
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.VP9);
2647
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2609
2648
  }
2610
2649
  else if (h264On) {
2611
- const { preferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/h264");
2612
- const { preferredPayloadType: aptPreferredPayloadType } = routerRtpCapabilities.codecs.find((codec) => codec.mimeType.toLowerCase() === "video/rtx" && codec.parameters.apt === preferredPayloadType);
2613
- routerRtpCapabilities.codecs = routerRtpCapabilities.codecs.filter((codec) => codec.kind === "audio" ||
2614
- codec.preferredPayloadType === preferredPayloadType ||
2615
- codec.preferredPayloadType === aptPreferredPayloadType);
2650
+ const sorted = prioritizeRouterRtpCapabilitiesCodecs(routerRtpCapabilities.codecs, PrioritizableCodec.H264);
2651
+ return Object.assign(Object.assign({}, routerRtpCapabilities), { codecs: sorted });
2616
2652
  }
2653
+ return routerRtpCapabilities;
2617
2654
  };
2655
+ function prioritizeRouterRtpCapabilitiesCodecs(codecs, preferredCodec) {
2656
+ const preferredCodecEntry = codecs.find(({ mimeType }) => mimeType.toLowerCase() === preferredCodec);
2657
+ if (!preferredCodecEntry) {
2658
+ return codecs;
2659
+ }
2660
+ return [...codecs].sort((left, right) => {
2661
+ if (left.mimeType.toLowerCase() === preferredCodec) {
2662
+ return -1;
2663
+ }
2664
+ if (left.mimeType.toLowerCase() === "video/rtx" &&
2665
+ left.parameters.apt === preferredCodecEntry.preferredPayloadType) {
2666
+ if (right.mimeType.toLowerCase() === preferredCodec) {
2667
+ return 1;
2668
+ }
2669
+ return -1;
2670
+ }
2671
+ return 0;
2672
+ });
2673
+ }
2618
2674
  function getPreferredOrder(availableCodecs, { vp9On, av1On }) {
2619
2675
  if (vp9On) {
2620
2676
  availableCodecs.unshift("video/vp9");
@@ -5220,9 +5276,9 @@ class VegaRtcManager {
5220
5276
  try {
5221
5277
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
5222
5278
  if (!this._routerRtpCapabilities) {
5223
- modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5224
- this._routerRtpCapabilities = routerRtpCapabilities;
5225
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
5279
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
5280
+ this._routerRtpCapabilities = modifiedCapabilities;
5281
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
5226
5282
  }
5227
5283
  this._vegaConnection.message("setCapabilities", {
5228
5284
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -7335,9 +7391,9 @@ class BandwidthTester extends EventEmitter {
7335
7391
  try {
7336
7392
  const { routerRtpCapabilities } = yield this._vegaConnection.request("getCapabilities");
7337
7393
  if (!this._routerRtpCapabilities) {
7338
- modifyMediaCapabilities(routerRtpCapabilities, this._features);
7339
- this._routerRtpCapabilities = routerRtpCapabilities;
7340
- yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities }));
7394
+ const modifiedCapabilities = modifyMediaCapabilities(routerRtpCapabilities, Object.assign(Object.assign({}, this._features), { vp9On: this._features.sfuVp9On }));
7395
+ this._routerRtpCapabilities = modifiedCapabilities;
7396
+ yield ((_a = this._mediasoupDevice) === null || _a === void 0 ? void 0 : _a.load({ routerRtpCapabilities: modifiedCapabilities }));
7341
7397
  }
7342
7398
  this._vegaConnection.message("setCapabilities", {
7343
7399
  rtpCapabilities: (_b = this._mediasoupDevice) === null || _b === void 0 ? void 0 : _b.rtpCapabilities,
@@ -7998,5 +8054,5 @@ var RtcEventNames;
7998
8054
  RtcEventNames["stream_added"] = "stream_added";
7999
8055
  })(RtcEventNames || (RtcEventNames = {}));
8000
8056
 
8001
- 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 };
8057
+ export { ADDITIONAL_SCREEN_SHARE_SETTINGS, ADDITIONAL_SCREEN_SHARE_SETTINGS_VP9, AUDIO_SETTINGS, 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, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SETTINGS_LOW_BANDWIDTH, SCREEN_SHARE_SETTINGS_VP9, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_KEY, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH_KEY, 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 };
8002
8058
  //# sourceMappingURL=legacy-esm.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whereby.com/media",
3
3
  "description": "Media library for Whereby",
4
- "version": "1.26.0",
4
+ "version": "1.28.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {