livekit-client 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/livekit-client.esm.mjs +468 -140
- 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/api/SignalClient.d.ts +3 -3
- package/dist/src/api/SignalClient.d.ts.map +1 -1
- package/dist/src/connectionHelper/ConnectionCheck.d.ts +2 -2
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/proto/livekit_models.d.ts +53 -4
- package/dist/src/proto/livekit_models.d.ts.map +1 -1
- package/dist/src/proto/livekit_rtc.d.ts +650 -91
- package/dist/src/proto/livekit_rtc.d.ts.map +1 -1
- package/dist/src/room/PCTransport.d.ts +1 -0
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/RTCEngine.d.ts +2 -0
- package/dist/src/room/RTCEngine.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/errors.d.ts +3 -0
- package/dist/src/room/errors.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts +1 -3
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/Participant.d.ts +1 -1
- package/dist/src/room/participant/Participant.d.ts.map +1 -1
- package/dist/src/room/timers.d.ts +13 -0
- package/dist/src/room/timers.d.ts.map +1 -0
- package/dist/src/room/track/RemoteVideoTrack.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +2 -2
- package/dist/src/room/track/options.d.ts.map +1 -1
- package/dist/src/test/mocks.d.ts +1 -1
- package/dist/ts4.2/src/api/SignalClient.d.ts +3 -3
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -2
- package/dist/ts4.2/src/index.d.ts +2 -1
- package/dist/ts4.2/src/proto/livekit_models.d.ts +59 -4
- package/dist/ts4.2/src/proto/livekit_rtc.d.ts +739 -120
- package/dist/ts4.2/src/room/PCTransport.d.ts +1 -0
- package/dist/ts4.2/src/room/RTCEngine.d.ts +2 -0
- package/dist/ts4.2/src/room/Room.d.ts +1 -1
- package/dist/ts4.2/src/room/errors.d.ts +3 -0
- package/dist/ts4.2/src/room/participant/LocalParticipant.d.ts +1 -3
- package/dist/ts4.2/src/room/participant/Participant.d.ts +1 -1
- package/dist/ts4.2/src/room/timers.d.ts +13 -0
- package/dist/ts4.2/src/room/track/options.d.ts +2 -2
- package/dist/ts4.2/src/test/mocks.d.ts +1 -1
- package/package.json +17 -17
- package/src/api/SignalClient.ts +33 -21
- package/src/connectionHelper/ConnectionCheck.ts +1 -1
- package/src/index.ts +2 -0
- package/src/proto/google/protobuf/timestamp.ts +2 -2
- package/src/proto/livekit_models.ts +158 -10
- package/src/proto/livekit_rtc.ts +205 -6
- package/src/room/PCTransport.ts +22 -6
- package/src/room/RTCEngine.ts +58 -45
- package/src/room/Room.ts +8 -10
- package/src/room/errors.ts +6 -0
- package/src/room/participant/LocalParticipant.ts +12 -17
- package/src/room/participant/Participant.ts +10 -2
- package/src/room/timers.ts +16 -0
- package/src/room/track/RemoteVideoTrack.ts +2 -1
- package/src/room/track/create.ts +6 -1
- package/src/room/track/options.ts +2 -2
@@ -312,6 +312,8 @@ export interface ParticipantPermission {
|
|
312
312
|
canPublish: boolean;
|
313
313
|
/** allow participant to publish data */
|
314
314
|
canPublishData: boolean;
|
315
|
+
/** sources that are allowed to be published */
|
316
|
+
canPublishSources: TrackSource[];
|
315
317
|
/** indicates that it's hidden to others */
|
316
318
|
hidden: boolean;
|
317
319
|
/** indicates it's a recorder instance */
|
@@ -386,6 +388,48 @@ export function participantInfo_StateToJSON(object: ParticipantInfo_State): stri
|
|
386
388
|
}
|
387
389
|
}
|
388
390
|
|
391
|
+
export interface Encryption {
|
392
|
+
}
|
393
|
+
|
394
|
+
export enum Encryption_Type {
|
395
|
+
NONE = 0,
|
396
|
+
GCM = 1,
|
397
|
+
CUSTOM = 2,
|
398
|
+
UNRECOGNIZED = -1,
|
399
|
+
}
|
400
|
+
|
401
|
+
export function encryption_TypeFromJSON(object: any): Encryption_Type {
|
402
|
+
switch (object) {
|
403
|
+
case 0:
|
404
|
+
case "NONE":
|
405
|
+
return Encryption_Type.NONE;
|
406
|
+
case 1:
|
407
|
+
case "GCM":
|
408
|
+
return Encryption_Type.GCM;
|
409
|
+
case 2:
|
410
|
+
case "CUSTOM":
|
411
|
+
return Encryption_Type.CUSTOM;
|
412
|
+
case -1:
|
413
|
+
case "UNRECOGNIZED":
|
414
|
+
default:
|
415
|
+
return Encryption_Type.UNRECOGNIZED;
|
416
|
+
}
|
417
|
+
}
|
418
|
+
|
419
|
+
export function encryption_TypeToJSON(object: Encryption_Type): string {
|
420
|
+
switch (object) {
|
421
|
+
case Encryption_Type.NONE:
|
422
|
+
return "NONE";
|
423
|
+
case Encryption_Type.GCM:
|
424
|
+
return "GCM";
|
425
|
+
case Encryption_Type.CUSTOM:
|
426
|
+
return "CUSTOM";
|
427
|
+
case Encryption_Type.UNRECOGNIZED:
|
428
|
+
default:
|
429
|
+
return "UNRECOGNIZED";
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
389
433
|
export interface SimulcastCodecInfo {
|
390
434
|
mimeType: string;
|
391
435
|
mid: string;
|
@@ -416,6 +460,10 @@ export interface TrackInfo {
|
|
416
460
|
mimeType: string;
|
417
461
|
mid: string;
|
418
462
|
codecs: SimulcastCodecInfo[];
|
463
|
+
stereo: boolean;
|
464
|
+
/** true if RED (Redundant Encoding) is disabled for audio */
|
465
|
+
disableRed: boolean;
|
466
|
+
encryption: Encryption_Type;
|
419
467
|
}
|
420
468
|
|
421
469
|
/** provide information about available spatial layers */
|
@@ -424,7 +472,7 @@ export interface VideoLayer {
|
|
424
472
|
quality: VideoQuality;
|
425
473
|
width: number;
|
426
474
|
height: number;
|
427
|
-
/** target bitrate, server will measure actual */
|
475
|
+
/** target bitrate in bit per second (bps), server will measure actual */
|
428
476
|
bitrate: number;
|
429
477
|
ssrc: number;
|
430
478
|
}
|
@@ -894,7 +942,14 @@ export const Codec = {
|
|
894
942
|
};
|
895
943
|
|
896
944
|
function createBaseParticipantPermission(): ParticipantPermission {
|
897
|
-
return {
|
945
|
+
return {
|
946
|
+
canSubscribe: false,
|
947
|
+
canPublish: false,
|
948
|
+
canPublishData: false,
|
949
|
+
canPublishSources: [],
|
950
|
+
hidden: false,
|
951
|
+
recorder: false,
|
952
|
+
};
|
898
953
|
}
|
899
954
|
|
900
955
|
export const ParticipantPermission = {
|
@@ -908,6 +963,11 @@ export const ParticipantPermission = {
|
|
908
963
|
if (message.canPublishData === true) {
|
909
964
|
writer.uint32(24).bool(message.canPublishData);
|
910
965
|
}
|
966
|
+
writer.uint32(74).fork();
|
967
|
+
for (const v of message.canPublishSources) {
|
968
|
+
writer.int32(v);
|
969
|
+
}
|
970
|
+
writer.ldelim();
|
911
971
|
if (message.hidden === true) {
|
912
972
|
writer.uint32(56).bool(message.hidden);
|
913
973
|
}
|
@@ -933,6 +993,16 @@ export const ParticipantPermission = {
|
|
933
993
|
case 3:
|
934
994
|
message.canPublishData = reader.bool();
|
935
995
|
break;
|
996
|
+
case 9:
|
997
|
+
if ((tag & 7) === 2) {
|
998
|
+
const end2 = reader.uint32() + reader.pos;
|
999
|
+
while (reader.pos < end2) {
|
1000
|
+
message.canPublishSources.push(reader.int32() as any);
|
1001
|
+
}
|
1002
|
+
} else {
|
1003
|
+
message.canPublishSources.push(reader.int32() as any);
|
1004
|
+
}
|
1005
|
+
break;
|
936
1006
|
case 7:
|
937
1007
|
message.hidden = reader.bool();
|
938
1008
|
break;
|
@@ -952,6 +1022,9 @@ export const ParticipantPermission = {
|
|
952
1022
|
canSubscribe: isSet(object.canSubscribe) ? Boolean(object.canSubscribe) : false,
|
953
1023
|
canPublish: isSet(object.canPublish) ? Boolean(object.canPublish) : false,
|
954
1024
|
canPublishData: isSet(object.canPublishData) ? Boolean(object.canPublishData) : false,
|
1025
|
+
canPublishSources: Array.isArray(object?.canPublishSources)
|
1026
|
+
? object.canPublishSources.map((e: any) => trackSourceFromJSON(e))
|
1027
|
+
: [],
|
955
1028
|
hidden: isSet(object.hidden) ? Boolean(object.hidden) : false,
|
956
1029
|
recorder: isSet(object.recorder) ? Boolean(object.recorder) : false,
|
957
1030
|
};
|
@@ -962,6 +1035,11 @@ export const ParticipantPermission = {
|
|
962
1035
|
message.canSubscribe !== undefined && (obj.canSubscribe = message.canSubscribe);
|
963
1036
|
message.canPublish !== undefined && (obj.canPublish = message.canPublish);
|
964
1037
|
message.canPublishData !== undefined && (obj.canPublishData = message.canPublishData);
|
1038
|
+
if (message.canPublishSources) {
|
1039
|
+
obj.canPublishSources = message.canPublishSources.map((e) => trackSourceToJSON(e));
|
1040
|
+
} else {
|
1041
|
+
obj.canPublishSources = [];
|
1042
|
+
}
|
965
1043
|
message.hidden !== undefined && (obj.hidden = message.hidden);
|
966
1044
|
message.recorder !== undefined && (obj.recorder = message.recorder);
|
967
1045
|
return obj;
|
@@ -972,6 +1050,7 @@ export const ParticipantPermission = {
|
|
972
1050
|
message.canSubscribe = object.canSubscribe ?? false;
|
973
1051
|
message.canPublish = object.canPublish ?? false;
|
974
1052
|
message.canPublishData = object.canPublishData ?? false;
|
1053
|
+
message.canPublishSources = object.canPublishSources?.map((e) => e) || [];
|
975
1054
|
message.hidden = object.hidden ?? false;
|
976
1055
|
message.recorder = object.recorder ?? false;
|
977
1056
|
return message;
|
@@ -1136,6 +1215,45 @@ export const ParticipantInfo = {
|
|
1136
1215
|
},
|
1137
1216
|
};
|
1138
1217
|
|
1218
|
+
function createBaseEncryption(): Encryption {
|
1219
|
+
return {};
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
export const Encryption = {
|
1223
|
+
encode(_: Encryption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
1224
|
+
return writer;
|
1225
|
+
},
|
1226
|
+
|
1227
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Encryption {
|
1228
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
1229
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
1230
|
+
const message = createBaseEncryption();
|
1231
|
+
while (reader.pos < end) {
|
1232
|
+
const tag = reader.uint32();
|
1233
|
+
switch (tag >>> 3) {
|
1234
|
+
default:
|
1235
|
+
reader.skipType(tag & 7);
|
1236
|
+
break;
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
return message;
|
1240
|
+
},
|
1241
|
+
|
1242
|
+
fromJSON(_: any): Encryption {
|
1243
|
+
return {};
|
1244
|
+
},
|
1245
|
+
|
1246
|
+
toJSON(_: Encryption): unknown {
|
1247
|
+
const obj: any = {};
|
1248
|
+
return obj;
|
1249
|
+
},
|
1250
|
+
|
1251
|
+
fromPartial<I extends Exact<DeepPartial<Encryption>, I>>(_: I): Encryption {
|
1252
|
+
const message = createBaseEncryption();
|
1253
|
+
return message;
|
1254
|
+
},
|
1255
|
+
};
|
1256
|
+
|
1139
1257
|
function createBaseSimulcastCodecInfo(): SimulcastCodecInfo {
|
1140
1258
|
return { mimeType: "", mid: "", cid: "", layers: [] };
|
1141
1259
|
}
|
@@ -1231,6 +1349,9 @@ function createBaseTrackInfo(): TrackInfo {
|
|
1231
1349
|
mimeType: "",
|
1232
1350
|
mid: "",
|
1233
1351
|
codecs: [],
|
1352
|
+
stereo: false,
|
1353
|
+
disableRed: false,
|
1354
|
+
encryption: 0,
|
1234
1355
|
};
|
1235
1356
|
}
|
1236
1357
|
|
@@ -1275,6 +1396,15 @@ export const TrackInfo = {
|
|
1275
1396
|
for (const v of message.codecs) {
|
1276
1397
|
SimulcastCodecInfo.encode(v!, writer.uint32(106).fork()).ldelim();
|
1277
1398
|
}
|
1399
|
+
if (message.stereo === true) {
|
1400
|
+
writer.uint32(112).bool(message.stereo);
|
1401
|
+
}
|
1402
|
+
if (message.disableRed === true) {
|
1403
|
+
writer.uint32(120).bool(message.disableRed);
|
1404
|
+
}
|
1405
|
+
if (message.encryption !== 0) {
|
1406
|
+
writer.uint32(128).int32(message.encryption);
|
1407
|
+
}
|
1278
1408
|
return writer;
|
1279
1409
|
},
|
1280
1410
|
|
@@ -1324,6 +1454,15 @@ export const TrackInfo = {
|
|
1324
1454
|
case 13:
|
1325
1455
|
message.codecs.push(SimulcastCodecInfo.decode(reader, reader.uint32()));
|
1326
1456
|
break;
|
1457
|
+
case 14:
|
1458
|
+
message.stereo = reader.bool();
|
1459
|
+
break;
|
1460
|
+
case 15:
|
1461
|
+
message.disableRed = reader.bool();
|
1462
|
+
break;
|
1463
|
+
case 16:
|
1464
|
+
message.encryption = reader.int32() as any;
|
1465
|
+
break;
|
1327
1466
|
default:
|
1328
1467
|
reader.skipType(tag & 7);
|
1329
1468
|
break;
|
@@ -1347,6 +1486,9 @@ export const TrackInfo = {
|
|
1347
1486
|
mimeType: isSet(object.mimeType) ? String(object.mimeType) : "",
|
1348
1487
|
mid: isSet(object.mid) ? String(object.mid) : "",
|
1349
1488
|
codecs: Array.isArray(object?.codecs) ? object.codecs.map((e: any) => SimulcastCodecInfo.fromJSON(e)) : [],
|
1489
|
+
stereo: isSet(object.stereo) ? Boolean(object.stereo) : false,
|
1490
|
+
disableRed: isSet(object.disableRed) ? Boolean(object.disableRed) : false,
|
1491
|
+
encryption: isSet(object.encryption) ? encryption_TypeFromJSON(object.encryption) : 0,
|
1350
1492
|
};
|
1351
1493
|
},
|
1352
1494
|
|
@@ -1373,6 +1515,9 @@ export const TrackInfo = {
|
|
1373
1515
|
} else {
|
1374
1516
|
obj.codecs = [];
|
1375
1517
|
}
|
1518
|
+
message.stereo !== undefined && (obj.stereo = message.stereo);
|
1519
|
+
message.disableRed !== undefined && (obj.disableRed = message.disableRed);
|
1520
|
+
message.encryption !== undefined && (obj.encryption = encryption_TypeToJSON(message.encryption));
|
1376
1521
|
return obj;
|
1377
1522
|
},
|
1378
1523
|
|
@@ -1391,6 +1536,9 @@ export const TrackInfo = {
|
|
1391
1536
|
message.mimeType = object.mimeType ?? "";
|
1392
1537
|
message.mid = object.mid ?? "";
|
1393
1538
|
message.codecs = object.codecs?.map((e) => SimulcastCodecInfo.fromPartial(e)) || [];
|
1539
|
+
message.stereo = object.stereo ?? false;
|
1540
|
+
message.disableRed = object.disableRed ?? false;
|
1541
|
+
message.encryption = object.encryption ?? 0;
|
1394
1542
|
return message;
|
1395
1543
|
},
|
1396
1544
|
};
|
@@ -2825,7 +2973,7 @@ export const TimedVersion = {
|
|
2825
2973
|
declare var self: any | undefined;
|
2826
2974
|
declare var window: any | undefined;
|
2827
2975
|
declare var global: any | undefined;
|
2828
|
-
var
|
2976
|
+
var tsProtoGlobalThis: any = (() => {
|
2829
2977
|
if (typeof globalThis !== "undefined") {
|
2830
2978
|
return globalThis;
|
2831
2979
|
}
|
@@ -2842,10 +2990,10 @@ var globalThis: any = (() => {
|
|
2842
2990
|
})();
|
2843
2991
|
|
2844
2992
|
function bytesFromBase64(b64: string): Uint8Array {
|
2845
|
-
if (
|
2846
|
-
return Uint8Array.from(
|
2993
|
+
if (tsProtoGlobalThis.Buffer) {
|
2994
|
+
return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));
|
2847
2995
|
} else {
|
2848
|
-
const bin =
|
2996
|
+
const bin = tsProtoGlobalThis.atob(b64);
|
2849
2997
|
const arr = new Uint8Array(bin.length);
|
2850
2998
|
for (let i = 0; i < bin.length; ++i) {
|
2851
2999
|
arr[i] = bin.charCodeAt(i);
|
@@ -2855,14 +3003,14 @@ function bytesFromBase64(b64: string): Uint8Array {
|
|
2855
3003
|
}
|
2856
3004
|
|
2857
3005
|
function base64FromBytes(arr: Uint8Array): string {
|
2858
|
-
if (
|
2859
|
-
return
|
3006
|
+
if (tsProtoGlobalThis.Buffer) {
|
3007
|
+
return tsProtoGlobalThis.Buffer.from(arr).toString("base64");
|
2860
3008
|
} else {
|
2861
3009
|
const bin: string[] = [];
|
2862
3010
|
arr.forEach((byte) => {
|
2863
3011
|
bin.push(String.fromCharCode(byte));
|
2864
3012
|
});
|
2865
|
-
return
|
3013
|
+
return tsProtoGlobalThis.btoa(bin.join(""));
|
2866
3014
|
}
|
2867
3015
|
}
|
2868
3016
|
|
@@ -2902,7 +3050,7 @@ function fromJsonTimestamp(o: any): Date {
|
|
2902
3050
|
|
2903
3051
|
function longToNumber(long: Long): number {
|
2904
3052
|
if (long.gt(Number.MAX_SAFE_INTEGER)) {
|
2905
|
-
throw new
|
3053
|
+
throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
2906
3054
|
}
|
2907
3055
|
return long.toNumber();
|
2908
3056
|
}
|