livekit-client 2.9.4 → 2.9.5
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/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +42 -3
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +4 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +1 -0
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts +2 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/room/errors.d.ts +4 -0
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +1 -0
- package/dist/ts4.2/src/room/track/utils.d.ts +2 -1
- package/package.json +1 -1
- package/src/room/Room.ts +1 -2
- package/src/room/errors.ts +10 -0
- package/src/room/participant/LocalParticipant.ts +28 -0
- package/src/room/track/utils.ts +16 -1
@@ -10455,6 +10455,13 @@ class PublishDataError extends LivekitError {
|
|
10455
10455
|
this.name = 'PublishDataError';
|
10456
10456
|
}
|
10457
10457
|
}
|
10458
|
+
class PublishTrackError extends LivekitError {
|
10459
|
+
constructor(message, status) {
|
10460
|
+
super(15, message);
|
10461
|
+
this.name = 'PublishTrackError';
|
10462
|
+
this.status = status;
|
10463
|
+
}
|
10464
|
+
}
|
10458
10465
|
class SignalRequestError extends LivekitError {
|
10459
10466
|
constructor(message, reason) {
|
10460
10467
|
super(15, message);
|
@@ -11162,7 +11169,7 @@ function getOSVersion(ua) {
|
|
11162
11169
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
11163
11170
|
}
|
11164
11171
|
|
11165
|
-
var version$1 = "2.9.
|
11172
|
+
var version$1 = "2.9.5";
|
11166
11173
|
|
11167
11174
|
const version = version$1;
|
11168
11175
|
const protocolVersion = 15;
|
@@ -12421,6 +12428,20 @@ function extractProcessorsFromOptions(options) {
|
|
12421
12428
|
optionsWithoutProcessor: newOptions
|
12422
12429
|
};
|
12423
12430
|
}
|
12431
|
+
function getTrackSourceFromProto(source) {
|
12432
|
+
switch (source) {
|
12433
|
+
case TrackSource.CAMERA:
|
12434
|
+
return Track.Source.Camera;
|
12435
|
+
case TrackSource.MICROPHONE:
|
12436
|
+
return Track.Source.Microphone;
|
12437
|
+
case TrackSource.SCREEN_SHARE:
|
12438
|
+
return Track.Source.ScreenShare;
|
12439
|
+
case TrackSource.SCREEN_SHARE_AUDIO:
|
12440
|
+
return Track.Source.ScreenShareAudio;
|
12441
|
+
default:
|
12442
|
+
return Track.Source.Unknown;
|
12443
|
+
}
|
12444
|
+
}
|
12424
12445
|
|
12425
12446
|
/**
|
12426
12447
|
* @experimental
|
@@ -20295,9 +20316,27 @@ class LocalParticipant extends Participant {
|
|
20295
20316
|
}();
|
20296
20317
|
});
|
20297
20318
|
}
|
20319
|
+
hasPermissionsToPublish(track) {
|
20320
|
+
if (!this.permissions) {
|
20321
|
+
this.log.warn('no permissions present for publishing track', Object.assign(Object.assign({}, this.logContext), getLogContextFromTrack(track)));
|
20322
|
+
return false;
|
20323
|
+
}
|
20324
|
+
const {
|
20325
|
+
canPublish,
|
20326
|
+
canPublishSources
|
20327
|
+
} = this.permissions;
|
20328
|
+
if (canPublish && (canPublishSources.length === 0 || canPublishSources.map(source => getTrackSourceFromProto(source)).includes(track.source))) {
|
20329
|
+
return true;
|
20330
|
+
}
|
20331
|
+
this.log.warn('insufficient permissions to publish', Object.assign(Object.assign({}, this.logContext), getLogContextFromTrack(track)));
|
20332
|
+
return false;
|
20333
|
+
}
|
20298
20334
|
publish(track, opts, isStereo) {
|
20299
20335
|
return __awaiter(this, void 0, void 0, function* () {
|
20300
20336
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
20337
|
+
if (!this.hasPermissionsToPublish(track)) {
|
20338
|
+
throw new PublishTrackError('failed to publish track, insufficient permissions', 403);
|
20339
|
+
}
|
20301
20340
|
const existingTrackOfSource = Array.from(this.trackPublications.values()).find(publishedTrack => isLocalTrack(track) && publishedTrack.source === track.source);
|
20302
20341
|
if (existingTrackOfSource && track.source !== Track.Source.Unknown) {
|
20303
20342
|
this.log.info("publishing a second track with the same source: ".concat(track.source), Object.assign(Object.assign({}, this.logContext), getLogContextFromTrack(track)));
|
@@ -23323,7 +23362,7 @@ class Room extends eventsExports.EventEmitter {
|
|
23323
23362
|
if (textBuffer) {
|
23324
23363
|
textBuffer.info.attributes = Object.assign(Object.assign({}, textBuffer.info.attributes), trailer.attributes);
|
23325
23364
|
textBuffer.controller.close();
|
23326
|
-
this.
|
23365
|
+
this.textStreamControllers.delete(trailer.streamId);
|
23327
23366
|
}
|
23328
23367
|
const fileBuffer = this.byteStreamControllers.get(trailer.streamId);
|
23329
23368
|
if (fileBuffer) {
|
@@ -24625,5 +24664,5 @@ function isFacingModeValue(item) {
|
|
24625
24664
|
return item === undefined || allowedValues.includes(item);
|
24626
24665
|
}
|
24627
24666
|
|
24628
|
-
export { AudioPresets, BackupCodecPolicy, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, _ as Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RpcError, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, TrackType, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isAudioTrack, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isLocalParticipant, isLocalTrack, isRemoteParticipant, isRemoteTrack, isScriptTransformSupported, isVideoFrame, isVideoTrack, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
|
24667
|
+
export { AudioPresets, BackupCodecPolicy, BaseKeyProvider, CheckStatus, Checker, ConnectionCheck, ConnectionError, ConnectionErrorReason, ConnectionQuality, ConnectionState, CriticalTimers, CryptorError, CryptorErrorReason, CryptorEvent, DataPacket_Kind, DefaultReconnectPolicy, DeviceUnsupportedError, DisconnectReason, EncryptionEvent, EngineEvent, ExternalE2EEKeyProvider, KeyHandlerEvent, KeyProviderEvent, LivekitError, LocalAudioTrack, LocalParticipant, LocalTrack, LocalTrackPublication, LocalVideoTrack, LogLevel, LoggerNames, MediaDeviceFailure, _ as Mutex, NegotiationError, Participant, ParticipantEvent, ParticipantInfo_Kind as ParticipantKind, PublishDataError, PublishTrackError, RemoteAudioTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, RemoteVideoTrack, Room, RoomEvent, RpcError, ScreenSharePresets, SignalRequestError, SubscriptionError, Track, TrackEvent, TrackInvalidError, TrackPublication, TrackType, UnexpectedConnectionState, UnsupportedServer, VideoPreset, VideoPresets, VideoPresets43, VideoQuality, attachToElement, compareVersions, createAudioAnalyser, createE2EEKey, createKeyMaterialFromBuffer, createKeyMaterialFromString, createLocalAudioTrack, createLocalScreenTracks, createLocalTracks, createLocalVideoTrack, deriveKeys, detachTrack, facingModeFromDeviceLabel, facingModeFromLocalTrack, getBrowser, getEmptyAudioStreamTrack, getEmptyVideoStreamTrack, getLogger, importKey, isAudioTrack, isBackupCodec, isBrowserSupported, isE2EESupported, isInsertableStreamSupported, isLocalParticipant, isLocalTrack, isRemoteParticipant, isRemoteTrack, isScriptTransformSupported, isVideoFrame, isVideoTrack, needsRbspUnescaping, parseRbsp, protocolVersion, ratchet, setLogExtension, setLogLevel, supportsAV1, supportsAdaptiveStream, supportsDynacast, supportsVP9, version, videoCodecs, writeRbsp };
|
24629
24668
|
//# sourceMappingURL=livekit-client.esm.mjs.map
|