@dtelecom/livekit-client 1.12.25 → 1.12.26

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.
@@ -14086,6 +14086,16 @@ class NegotiationError extends LivekitError {
14086
14086
  super(13, message !== null && message !== void 0 ? message : 'unable to negotiate');
14087
14087
  }
14088
14088
  }
14089
+ /**
14090
+ * Publishing a track that the participant's permissions do not allow (`canPublish` false, or a
14091
+ * source outside `canPublishSources`). The node drops such a request without an answer, so the
14092
+ * SDK refuses it before sending.
14093
+ */
14094
+ class PublishTrackError extends LivekitError {
14095
+ constructor(message) {
14096
+ super(15, message !== null && message !== void 0 ? message : 'not permitted to publish this track');
14097
+ }
14098
+ }
14089
14099
  class PublishDataError extends LivekitError {
14090
14100
  constructor(message) {
14091
14101
  super(13, message !== null && message !== void 0 ? message : 'unable to publish data');
@@ -14202,7 +14212,7 @@ function getMatch(exp, ua) {
14202
14212
  return match && match.length >= id && match[id] || '';
14203
14213
  }
14204
14214
 
14205
- var version$1 = "1.12.25";
14215
+ var version$1 = "1.12.26";
14206
14216
 
14207
14217
  const version = version$1;
14208
14218
  const protocolVersion = 9;
@@ -22445,9 +22455,26 @@ class LocalParticipant extends Participant {
22445
22455
  }
22446
22456
  });
22447
22457
  }
22458
+ /**
22459
+ * Throws when the participant may not publish a track from `source`: the node would drop the
22460
+ * request without answering and the publish would wait forever.
22461
+ */
22462
+ checkPublishPermission(source) {
22463
+ var _a;
22464
+ const permissions = this.permissions;
22465
+ if (!permissions) return;
22466
+ if (!permissions.canPublish) {
22467
+ throw new PublishTrackError('not permitted to publish: the token has canPublish false');
22468
+ }
22469
+ const sources = (_a = permissions.canPublishSources) !== null && _a !== void 0 ? _a : [];
22470
+ if (sources.length > 0 && !sources.includes(Track.sourceToProto(source))) {
22471
+ throw new PublishTrackError("not permitted to publish a ".concat(source, " track"));
22472
+ }
22473
+ }
22448
22474
  publish(track, opts, options, isStereo) {
22449
22475
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
22450
22476
  return __awaiter(this, void 0, void 0, function* () {
22477
+ this.checkPublishPermission(track.source);
22451
22478
  const existingTrackOfSource = Array.from(this.tracks.values()).find(publishedTrack => track instanceof LocalTrack && publishedTrack.source === track.source);
22452
22479
  if (existingTrackOfSource && track.source !== Track.Source.Unknown) {
22453
22480
  try {
@@ -24945,5 +24972,5 @@ function isFacingModeValue(item) {
24945
24972
  return item === undefined || allowedValues.includes(item);
24946
24973
  }
24947
24974
 
24948
- export { AudioPresets, BaseKeyProvider, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, Mutex, NegotiationError, Participant, ParticipantEvent, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createE2EEKey, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, importKey, isBackupCodec, isBrowserSupported, isCodecEqual, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, mimeTypeToVideoCodecString, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs };
24975
+ export { AudioPresets, BaseKeyProvider, ConnectionCheck, ConnectionError, ConnectionQuality, ConnectionState, CriticalTimers, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, MediaDeviceFailure, Mutex, NegotiationError, Participant, ParticipantEvent, PublishDataError, PublishTrackError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RoomState, ScreenSharePresets, Track, TrackEvent, TrackInvalidError, TrackPublication, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, createAudioAnalyser, createE2EEKey, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, importKey, isBackupCodec, isBrowserSupported, isCodecEqual, isE2EESupported, isInsertableStreamSupported, isScriptTransformSupported, isVideoFrame, mimeTypeToVideoCodecString, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs };
24949
24976
  //# sourceMappingURL=livekit-client.esm.mjs.map