@whereby.com/media 1.17.13 → 1.17.15

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
@@ -11,11 +11,10 @@ var validate = require('uuid-validate');
11
11
  var EventEmitter = require('events');
12
12
  var mediasoupClient = require('mediasoup-client');
13
13
  var uaParserJs = require('ua-parser-js');
14
- var Logger$1 = require('mediasoup-client/lib/Logger');
14
+ var Logger_js = require('mediasoup-client/lib/Logger.js');
15
15
  var utils = require('mediasoup-client/lib/utils');
16
16
  var ortc = require('mediasoup-client/lib/ortc');
17
17
  var sdpCommonUtils = require('mediasoup-client/lib/handlers/sdp/commonUtils');
18
- var sdpUnifiedPlanUtils = require('mediasoup-client/lib/handlers/sdp/unifiedPlanUtils');
19
18
  var ortcUtils = require('mediasoup-client/lib/handlers/ortc/utils');
20
19
  var errors = require('mediasoup-client/lib/errors');
21
20
  var HandlerInterface = require('mediasoup-client/lib/handlers/HandlerInterface');
@@ -45,7 +44,6 @@ var sdpTransform__namespace = /*#__PURE__*/_interopNamespaceDefault(sdpTransform
45
44
  var utils__namespace = /*#__PURE__*/_interopNamespaceDefault(utils);
46
45
  var ortc__namespace = /*#__PURE__*/_interopNamespaceDefault(ortc);
47
46
  var sdpCommonUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(sdpCommonUtils);
48
- var sdpUnifiedPlanUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(sdpUnifiedPlanUtils);
49
47
  var ortcUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(ortcUtils);
50
48
 
51
49
  const debugOn = process.env.NODE_ENV === "development" || new URLSearchParams(window.location.search).has("debug");
@@ -3512,7 +3510,7 @@ const modifyMediaCapabilities = (routerRtpCapabilities, features) => {
3512
3510
  }
3513
3511
  };
3514
3512
 
3515
- const logger$5 = new Logger$1.Logger("Safari17");
3513
+ const logger$5 = new Logger_js.Logger("Safari17");
3516
3514
  const NAME = "Safari17";
3517
3515
  const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
3518
3516
  class Safari17 extends HandlerInterface.HandlerInterface {
@@ -3694,20 +3692,31 @@ class Safari17 extends HandlerInterface.HandlerInterface {
3694
3692
  logger$5.debug("send() [kind:%s, track.id:%s]", track.kind, track.id);
3695
3693
  const sendingRtpParameters = utils__namespace.clone(this._sendingRtpParametersByKind[track.kind]);
3696
3694
  sendingRtpParameters.codecs = ortc__namespace.reduceCodecs(sendingRtpParameters.codecs, codec);
3697
- if (encodings && encodings.length > 1) {
3698
- let maxTemporalLayers = 1;
3699
- for (const encoding of encodings) {
3700
- const temporalLayers = encoding.scalabilityMode
3701
- ? scalabilityModes.parse(encoding.scalabilityMode).temporalLayers
3702
- : 3;
3703
- if (temporalLayers > maxTemporalLayers) {
3704
- maxTemporalLayers = temporalLayers;
3695
+ if (encodings && encodings.length > 1 && encodings.every(({ rid }) => !rid)) {
3696
+ encodings = encodings.map((e, i) => {
3697
+ e.rid = `r${i}`;
3698
+ return e;
3699
+ });
3700
+ }
3701
+ if (encodings) {
3702
+ if (!sendingRtpParameters.encodings) {
3703
+ sendingRtpParameters.encodings = [];
3704
+ }
3705
+ Object.assign(sendingRtpParameters.encodings, encodings);
3706
+ }
3707
+ const layers = scalabilityModes.parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3708
+ if (sendingRtpParameters.encodings &&
3709
+ sendingRtpParameters.encodings.length > 1 &&
3710
+ (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3711
+ sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3712
+ for (const encoding of sendingRtpParameters.encodings) {
3713
+ if (encoding.scalabilityMode) {
3714
+ encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3715
+ }
3716
+ else {
3717
+ encoding.scalabilityMode = "L1T3";
3705
3718
  }
3706
3719
  }
3707
- encodings.forEach((encoding, idx) => {
3708
- encoding.rid = `r${idx}`;
3709
- encoding.scalabilityMode = `L1T${maxTemporalLayers}`;
3710
- });
3711
3720
  }
3712
3721
  const sendingRemoteRtpParameters = utils__namespace.clone(this._sendingRemoteRtpParametersByKind[track.kind]);
3713
3722
  sendingRemoteRtpParameters.codecs = ortc__namespace.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
@@ -3715,56 +3724,28 @@ class Safari17 extends HandlerInterface.HandlerInterface {
3715
3724
  const transceiver = this._pc.addTransceiver(track, {
3716
3725
  direction: "sendonly",
3717
3726
  streams: [this._sendStream],
3718
- sendEncodings: encodings,
3727
+ sendEncodings: track.kind === "video" ? encodings : undefined,
3719
3728
  });
3720
3729
  if (onRtpSender) {
3721
3730
  onRtpSender(transceiver.sender);
3722
3731
  }
3723
3732
  const offer = yield this._pc.createOffer();
3724
- let localSdpObject = sdpTransform__namespace.parse(offer.sdp);
3733
+ const localSdpObject = sdpTransform__namespace.parse(offer.sdp);
3734
+ let offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3725
3735
  if (!this._transportReady) {
3726
3736
  yield this.setupTransport({
3727
3737
  localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : "client",
3728
3738
  localSdpObject,
3729
3739
  });
3730
3740
  }
3731
- const layers = scalabilityModes.parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3732
3741
  logger$5.debug("send() | calling pc.setLocalDescription() [offer:%o]", offer);
3733
3742
  yield this._pc.setLocalDescription(offer);
3734
3743
  const localId = transceiver.mid;
3735
3744
  sendingRtpParameters.mid = localId;
3736
- localSdpObject = sdpTransform__namespace.parse(this._pc.localDescription.sdp);
3737
- const offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3745
+ offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3738
3746
  sendingRtpParameters.rtcp.cname = sdpCommonUtils__namespace.getCname({
3739
3747
  offerMediaObject,
3740
3748
  });
3741
- if (!encodings) {
3742
- sendingRtpParameters.encodings = sdpUnifiedPlanUtils__namespace.getRtpEncodings({
3743
- offerMediaObject,
3744
- });
3745
- }
3746
- else if (encodings.length === 1) {
3747
- const newEncodings = sdpUnifiedPlanUtils__namespace.getRtpEncodings({
3748
- offerMediaObject,
3749
- });
3750
- Object.assign(newEncodings[0], encodings[0]);
3751
- sendingRtpParameters.encodings = newEncodings;
3752
- }
3753
- else {
3754
- sendingRtpParameters.encodings = encodings;
3755
- }
3756
- if (sendingRtpParameters.encodings.length > 1 &&
3757
- (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3758
- sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3759
- for (const encoding of sendingRtpParameters.encodings) {
3760
- if (encoding.scalabilityMode) {
3761
- encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3762
- }
3763
- else {
3764
- encoding.scalabilityMode = "L1T3";
3765
- }
3766
- }
3767
- }
3768
3749
  this._remoteSdp.send({
3769
3750
  offerMediaObject,
3770
3751
  reuseMid: mediaSectionIdx.reuseMid,
package/dist/index.d.cts CHANGED
@@ -705,6 +705,7 @@ interface SignalClient {
705
705
  displayName: string;
706
706
  id: string;
707
707
  streams: string[];
708
+ deviceId: string;
708
709
  isAudioEnabled: boolean;
709
710
  isVideoEnabled: boolean;
710
711
  role: ClientRole;
@@ -734,6 +735,8 @@ interface ChatMessage {
734
735
  text: string;
735
736
  timestamp: string;
736
737
  userId: string;
738
+ breakoutGroup?: string;
739
+ broadcast?: boolean;
737
740
  }
738
741
  interface CloudRecordingStartedEvent {
739
742
  error?: string;
@@ -769,6 +772,32 @@ interface KnockRejectedEvent {
769
772
  clientId: string;
770
773
  resolution: "rejected";
771
774
  }
775
+ interface BreakoutConfig {
776
+ assignments?: {
777
+ [key: string]: string;
778
+ } | null;
779
+ autoMoveToGroup?: boolean;
780
+ autoMoveToMain?: boolean;
781
+ breakoutEnabledAt?: string | null;
782
+ breakoutNotification?: string | null;
783
+ breakoutTimerDuration?: number;
784
+ breakoutStartedAt?: string | null;
785
+ breakoutEndedAt?: string | null;
786
+ breakoutTimerSetting?: boolean;
787
+ moveToGroupGracePeriod?: number | null;
788
+ moveToMainGracePeriod?: number | null;
789
+ enforceAssignment?: boolean;
790
+ groups?: {
791
+ [key: string]: string;
792
+ } | null;
793
+ initiatedBy?: {
794
+ clientId: string;
795
+ userId: string;
796
+ deviceId: string;
797
+ active: boolean;
798
+ } | null;
799
+ startedAt?: Date | null;
800
+ }
772
801
  interface RoomJoinedEvent {
773
802
  error?: string;
774
803
  isLocked: boolean;
@@ -784,6 +813,9 @@ interface RoomJoinedEvent {
784
813
  selfId: string;
785
814
  breakoutGroup: string | null;
786
815
  clientClaim?: string;
816
+ breakout?: BreakoutConfig;
817
+ }
818
+ interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
787
819
  }
788
820
  interface RoomKnockedEvent {
789
821
  clientId: string;
@@ -859,6 +891,7 @@ interface SignalEvents {
859
891
  audio_enabled: AudioEnabledEvent;
860
892
  audio_enable_requested: AudioEnableRequestedEvent;
861
893
  breakout_group_joined: BreakoutGroupJoinedEvent;
894
+ breakout_session_updated: BreakoutSessionUpdatedEvent;
862
895
  client_left: ClientLeftEvent;
863
896
  client_kicked: ClientKickedEvent;
864
897
  client_metadata_received: ClientMetadataReceivedEvent;
@@ -1559,4 +1592,4 @@ declare class RtcStream {
1559
1592
  static getTypeFromId(id: string): string;
1560
1593
  }
1561
1594
 
1562
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1595
+ 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 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.mts CHANGED
@@ -705,6 +705,7 @@ interface SignalClient {
705
705
  displayName: string;
706
706
  id: string;
707
707
  streams: string[];
708
+ deviceId: string;
708
709
  isAudioEnabled: boolean;
709
710
  isVideoEnabled: boolean;
710
711
  role: ClientRole;
@@ -734,6 +735,8 @@ interface ChatMessage {
734
735
  text: string;
735
736
  timestamp: string;
736
737
  userId: string;
738
+ breakoutGroup?: string;
739
+ broadcast?: boolean;
737
740
  }
738
741
  interface CloudRecordingStartedEvent {
739
742
  error?: string;
@@ -769,6 +772,32 @@ interface KnockRejectedEvent {
769
772
  clientId: string;
770
773
  resolution: "rejected";
771
774
  }
775
+ interface BreakoutConfig {
776
+ assignments?: {
777
+ [key: string]: string;
778
+ } | null;
779
+ autoMoveToGroup?: boolean;
780
+ autoMoveToMain?: boolean;
781
+ breakoutEnabledAt?: string | null;
782
+ breakoutNotification?: string | null;
783
+ breakoutTimerDuration?: number;
784
+ breakoutStartedAt?: string | null;
785
+ breakoutEndedAt?: string | null;
786
+ breakoutTimerSetting?: boolean;
787
+ moveToGroupGracePeriod?: number | null;
788
+ moveToMainGracePeriod?: number | null;
789
+ enforceAssignment?: boolean;
790
+ groups?: {
791
+ [key: string]: string;
792
+ } | null;
793
+ initiatedBy?: {
794
+ clientId: string;
795
+ userId: string;
796
+ deviceId: string;
797
+ active: boolean;
798
+ } | null;
799
+ startedAt?: Date | null;
800
+ }
772
801
  interface RoomJoinedEvent {
773
802
  error?: string;
774
803
  isLocked: boolean;
@@ -784,6 +813,9 @@ interface RoomJoinedEvent {
784
813
  selfId: string;
785
814
  breakoutGroup: string | null;
786
815
  clientClaim?: string;
816
+ breakout?: BreakoutConfig;
817
+ }
818
+ interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
787
819
  }
788
820
  interface RoomKnockedEvent {
789
821
  clientId: string;
@@ -859,6 +891,7 @@ interface SignalEvents {
859
891
  audio_enabled: AudioEnabledEvent;
860
892
  audio_enable_requested: AudioEnableRequestedEvent;
861
893
  breakout_group_joined: BreakoutGroupJoinedEvent;
894
+ breakout_session_updated: BreakoutSessionUpdatedEvent;
862
895
  client_left: ClientLeftEvent;
863
896
  client_kicked: ClientKickedEvent;
864
897
  client_metadata_received: ClientMetadataReceivedEvent;
@@ -1559,4 +1592,4 @@ declare class RtcStream {
1559
1592
  static getTypeFromId(id: string): string;
1560
1593
  }
1561
1594
 
1562
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1595
+ 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 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.d.ts CHANGED
@@ -705,6 +705,7 @@ interface SignalClient {
705
705
  displayName: string;
706
706
  id: string;
707
707
  streams: string[];
708
+ deviceId: string;
708
709
  isAudioEnabled: boolean;
709
710
  isVideoEnabled: boolean;
710
711
  role: ClientRole;
@@ -734,6 +735,8 @@ interface ChatMessage {
734
735
  text: string;
735
736
  timestamp: string;
736
737
  userId: string;
738
+ breakoutGroup?: string;
739
+ broadcast?: boolean;
737
740
  }
738
741
  interface CloudRecordingStartedEvent {
739
742
  error?: string;
@@ -769,6 +772,32 @@ interface KnockRejectedEvent {
769
772
  clientId: string;
770
773
  resolution: "rejected";
771
774
  }
775
+ interface BreakoutConfig {
776
+ assignments?: {
777
+ [key: string]: string;
778
+ } | null;
779
+ autoMoveToGroup?: boolean;
780
+ autoMoveToMain?: boolean;
781
+ breakoutEnabledAt?: string | null;
782
+ breakoutNotification?: string | null;
783
+ breakoutTimerDuration?: number;
784
+ breakoutStartedAt?: string | null;
785
+ breakoutEndedAt?: string | null;
786
+ breakoutTimerSetting?: boolean;
787
+ moveToGroupGracePeriod?: number | null;
788
+ moveToMainGracePeriod?: number | null;
789
+ enforceAssignment?: boolean;
790
+ groups?: {
791
+ [key: string]: string;
792
+ } | null;
793
+ initiatedBy?: {
794
+ clientId: string;
795
+ userId: string;
796
+ deviceId: string;
797
+ active: boolean;
798
+ } | null;
799
+ startedAt?: Date | null;
800
+ }
772
801
  interface RoomJoinedEvent {
773
802
  error?: string;
774
803
  isLocked: boolean;
@@ -784,6 +813,9 @@ interface RoomJoinedEvent {
784
813
  selfId: string;
785
814
  breakoutGroup: string | null;
786
815
  clientClaim?: string;
816
+ breakout?: BreakoutConfig;
817
+ }
818
+ interface BreakoutSessionUpdatedEvent extends BreakoutConfig {
787
819
  }
788
820
  interface RoomKnockedEvent {
789
821
  clientId: string;
@@ -859,6 +891,7 @@ interface SignalEvents {
859
891
  audio_enabled: AudioEnabledEvent;
860
892
  audio_enable_requested: AudioEnableRequestedEvent;
861
893
  breakout_group_joined: BreakoutGroupJoinedEvent;
894
+ breakout_session_updated: BreakoutSessionUpdatedEvent;
862
895
  client_left: ClientLeftEvent;
863
896
  client_kicked: ClientKickedEvent;
864
897
  client_metadata_received: ClientMetadataReceivedEvent;
@@ -1559,4 +1592,4 @@ declare class RtcStream {
1559
1592
  static getTypeFromId(id: string): string;
1560
1593
  }
1561
1594
 
1562
- export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
1595
+ 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 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, 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, type ssrcStats, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
package/dist/index.mjs CHANGED
@@ -9,11 +9,10 @@ import validate from 'uuid-validate';
9
9
  import EventEmitter$1, { EventEmitter } from 'events';
10
10
  import { Device, detectDevice } from 'mediasoup-client';
11
11
  import { UAParser } from 'ua-parser-js';
12
- import { Logger as Logger$1 } from 'mediasoup-client/lib/Logger';
12
+ import { Logger as Logger$1 } from 'mediasoup-client/lib/Logger.js';
13
13
  import * as utils from 'mediasoup-client/lib/utils';
14
14
  import * as ortc from 'mediasoup-client/lib/ortc';
15
15
  import * as sdpCommonUtils from 'mediasoup-client/lib/handlers/sdp/commonUtils';
16
- import * as sdpUnifiedPlanUtils from 'mediasoup-client/lib/handlers/sdp/unifiedPlanUtils';
17
16
  import * as ortcUtils from 'mediasoup-client/lib/handlers/ortc/utils';
18
17
  import { InvalidStateError } from 'mediasoup-client/lib/errors';
19
18
  import { HandlerInterface } from 'mediasoup-client/lib/handlers/HandlerInterface';
@@ -3668,20 +3667,31 @@ class Safari17 extends HandlerInterface {
3668
3667
  logger$5.debug("send() [kind:%s, track.id:%s]", track.kind, track.id);
3669
3668
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind]);
3670
3669
  sendingRtpParameters.codecs = ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
3671
- if (encodings && encodings.length > 1) {
3672
- let maxTemporalLayers = 1;
3673
- for (const encoding of encodings) {
3674
- const temporalLayers = encoding.scalabilityMode
3675
- ? parse(encoding.scalabilityMode).temporalLayers
3676
- : 3;
3677
- if (temporalLayers > maxTemporalLayers) {
3678
- maxTemporalLayers = temporalLayers;
3670
+ if (encodings && encodings.length > 1 && encodings.every(({ rid }) => !rid)) {
3671
+ encodings = encodings.map((e, i) => {
3672
+ e.rid = `r${i}`;
3673
+ return e;
3674
+ });
3675
+ }
3676
+ if (encodings) {
3677
+ if (!sendingRtpParameters.encodings) {
3678
+ sendingRtpParameters.encodings = [];
3679
+ }
3680
+ Object.assign(sendingRtpParameters.encodings, encodings);
3681
+ }
3682
+ const layers = parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3683
+ if (sendingRtpParameters.encodings &&
3684
+ sendingRtpParameters.encodings.length > 1 &&
3685
+ (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3686
+ sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3687
+ for (const encoding of sendingRtpParameters.encodings) {
3688
+ if (encoding.scalabilityMode) {
3689
+ encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3690
+ }
3691
+ else {
3692
+ encoding.scalabilityMode = "L1T3";
3679
3693
  }
3680
3694
  }
3681
- encodings.forEach((encoding, idx) => {
3682
- encoding.rid = `r${idx}`;
3683
- encoding.scalabilityMode = `L1T${maxTemporalLayers}`;
3684
- });
3685
3695
  }
3686
3696
  const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind]);
3687
3697
  sendingRemoteRtpParameters.codecs = ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
@@ -3689,56 +3699,28 @@ class Safari17 extends HandlerInterface {
3689
3699
  const transceiver = this._pc.addTransceiver(track, {
3690
3700
  direction: "sendonly",
3691
3701
  streams: [this._sendStream],
3692
- sendEncodings: encodings,
3702
+ sendEncodings: track.kind === "video" ? encodings : undefined,
3693
3703
  });
3694
3704
  if (onRtpSender) {
3695
3705
  onRtpSender(transceiver.sender);
3696
3706
  }
3697
3707
  const offer = yield this._pc.createOffer();
3698
- let localSdpObject = sdpTransform.parse(offer.sdp);
3708
+ const localSdpObject = sdpTransform.parse(offer.sdp);
3709
+ let offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3699
3710
  if (!this._transportReady) {
3700
3711
  yield this.setupTransport({
3701
3712
  localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : "client",
3702
3713
  localSdpObject,
3703
3714
  });
3704
3715
  }
3705
- const layers = parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3706
3716
  logger$5.debug("send() | calling pc.setLocalDescription() [offer:%o]", offer);
3707
3717
  yield this._pc.setLocalDescription(offer);
3708
3718
  const localId = transceiver.mid;
3709
3719
  sendingRtpParameters.mid = localId;
3710
- localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
3711
- const offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3720
+ offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3712
3721
  sendingRtpParameters.rtcp.cname = sdpCommonUtils.getCname({
3713
3722
  offerMediaObject,
3714
3723
  });
3715
- if (!encodings) {
3716
- sendingRtpParameters.encodings = sdpUnifiedPlanUtils.getRtpEncodings({
3717
- offerMediaObject,
3718
- });
3719
- }
3720
- else if (encodings.length === 1) {
3721
- const newEncodings = sdpUnifiedPlanUtils.getRtpEncodings({
3722
- offerMediaObject,
3723
- });
3724
- Object.assign(newEncodings[0], encodings[0]);
3725
- sendingRtpParameters.encodings = newEncodings;
3726
- }
3727
- else {
3728
- sendingRtpParameters.encodings = encodings;
3729
- }
3730
- if (sendingRtpParameters.encodings.length > 1 &&
3731
- (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3732
- sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3733
- for (const encoding of sendingRtpParameters.encodings) {
3734
- if (encoding.scalabilityMode) {
3735
- encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3736
- }
3737
- else {
3738
- encoding.scalabilityMode = "L1T3";
3739
- }
3740
- }
3741
- }
3742
3724
  this._remoteSdp.send({
3743
3725
  offerMediaObject,
3744
3726
  reuseMid: mediaSectionIdx.reuseMid,
@@ -9,11 +9,10 @@ import validate from 'uuid-validate';
9
9
  import EventEmitter$1, { EventEmitter } from 'events';
10
10
  import { Device, detectDevice } from 'mediasoup-client';
11
11
  import { UAParser } from 'ua-parser-js';
12
- import { Logger as Logger$1 } from 'mediasoup-client/lib/Logger';
12
+ import { Logger as Logger$1 } from 'mediasoup-client/lib/Logger.js';
13
13
  import * as utils from 'mediasoup-client/lib/utils';
14
14
  import * as ortc from 'mediasoup-client/lib/ortc';
15
15
  import * as sdpCommonUtils from 'mediasoup-client/lib/handlers/sdp/commonUtils';
16
- import * as sdpUnifiedPlanUtils from 'mediasoup-client/lib/handlers/sdp/unifiedPlanUtils';
17
16
  import * as ortcUtils from 'mediasoup-client/lib/handlers/ortc/utils';
18
17
  import { InvalidStateError } from 'mediasoup-client/lib/errors';
19
18
  import { HandlerInterface } from 'mediasoup-client/lib/handlers/HandlerInterface';
@@ -3668,20 +3667,31 @@ class Safari17 extends HandlerInterface {
3668
3667
  logger$5.debug("send() [kind:%s, track.id:%s]", track.kind, track.id);
3669
3668
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind]);
3670
3669
  sendingRtpParameters.codecs = ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
3671
- if (encodings && encodings.length > 1) {
3672
- let maxTemporalLayers = 1;
3673
- for (const encoding of encodings) {
3674
- const temporalLayers = encoding.scalabilityMode
3675
- ? parse(encoding.scalabilityMode).temporalLayers
3676
- : 3;
3677
- if (temporalLayers > maxTemporalLayers) {
3678
- maxTemporalLayers = temporalLayers;
3670
+ if (encodings && encodings.length > 1 && encodings.every(({ rid }) => !rid)) {
3671
+ encodings = encodings.map((e, i) => {
3672
+ e.rid = `r${i}`;
3673
+ return e;
3674
+ });
3675
+ }
3676
+ if (encodings) {
3677
+ if (!sendingRtpParameters.encodings) {
3678
+ sendingRtpParameters.encodings = [];
3679
+ }
3680
+ Object.assign(sendingRtpParameters.encodings, encodings);
3681
+ }
3682
+ const layers = parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3683
+ if (sendingRtpParameters.encodings &&
3684
+ sendingRtpParameters.encodings.length > 1 &&
3685
+ (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3686
+ sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3687
+ for (const encoding of sendingRtpParameters.encodings) {
3688
+ if (encoding.scalabilityMode) {
3689
+ encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3690
+ }
3691
+ else {
3692
+ encoding.scalabilityMode = "L1T3";
3679
3693
  }
3680
3694
  }
3681
- encodings.forEach((encoding, idx) => {
3682
- encoding.rid = `r${idx}`;
3683
- encoding.scalabilityMode = `L1T${maxTemporalLayers}`;
3684
- });
3685
3695
  }
3686
3696
  const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind]);
3687
3697
  sendingRemoteRtpParameters.codecs = ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
@@ -3689,56 +3699,28 @@ class Safari17 extends HandlerInterface {
3689
3699
  const transceiver = this._pc.addTransceiver(track, {
3690
3700
  direction: "sendonly",
3691
3701
  streams: [this._sendStream],
3692
- sendEncodings: encodings,
3702
+ sendEncodings: track.kind === "video" ? encodings : undefined,
3693
3703
  });
3694
3704
  if (onRtpSender) {
3695
3705
  onRtpSender(transceiver.sender);
3696
3706
  }
3697
3707
  const offer = yield this._pc.createOffer();
3698
- let localSdpObject = sdpTransform.parse(offer.sdp);
3708
+ const localSdpObject = sdpTransform.parse(offer.sdp);
3709
+ let offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3699
3710
  if (!this._transportReady) {
3700
3711
  yield this.setupTransport({
3701
3712
  localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : "client",
3702
3713
  localSdpObject,
3703
3714
  });
3704
3715
  }
3705
- const layers = parse((encodings !== null && encodings !== void 0 ? encodings : [{}])[0].scalabilityMode);
3706
3716
  logger$5.debug("send() | calling pc.setLocalDescription() [offer:%o]", offer);
3707
3717
  yield this._pc.setLocalDescription(offer);
3708
3718
  const localId = transceiver.mid;
3709
3719
  sendingRtpParameters.mid = localId;
3710
- localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
3711
- const offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3720
+ offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
3712
3721
  sendingRtpParameters.rtcp.cname = sdpCommonUtils.getCname({
3713
3722
  offerMediaObject,
3714
3723
  });
3715
- if (!encodings) {
3716
- sendingRtpParameters.encodings = sdpUnifiedPlanUtils.getRtpEncodings({
3717
- offerMediaObject,
3718
- });
3719
- }
3720
- else if (encodings.length === 1) {
3721
- const newEncodings = sdpUnifiedPlanUtils.getRtpEncodings({
3722
- offerMediaObject,
3723
- });
3724
- Object.assign(newEncodings[0], encodings[0]);
3725
- sendingRtpParameters.encodings = newEncodings;
3726
- }
3727
- else {
3728
- sendingRtpParameters.encodings = encodings;
3729
- }
3730
- if (sendingRtpParameters.encodings.length > 1 &&
3731
- (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/vp8" ||
3732
- sendingRtpParameters.codecs[0].mimeType.toLowerCase() === "video/h264")) {
3733
- for (const encoding of sendingRtpParameters.encodings) {
3734
- if (encoding.scalabilityMode) {
3735
- encoding.scalabilityMode = `L1T${layers.temporalLayers}`;
3736
- }
3737
- else {
3738
- encoding.scalabilityMode = "L1T3";
3739
- }
3740
- }
3741
- }
3742
3724
  this._remoteSdp.send({
3743
3725
  offerMediaObject,
3744
3726
  reuseMid: mediaSectionIdx.reuseMid,
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.17.13",
4
+ "version": "1.17.15",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/whereby/sdk",
7
7
  "repository": {