livekit-server-sdk 0.5.5 → 0.5.9

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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UserPacket = exports.SpeakerInfo = exports.ActiveSpeakerUpdate = exports.DataPacket = exports.TrackInfo = exports.ParticipantInfo = exports.Codec = exports.Room = exports.dataPacket_KindToJSON = exports.dataPacket_KindFromJSON = exports.DataPacket_Kind = exports.participantInfo_StateToJSON = exports.participantInfo_StateFromJSON = exports.ParticipantInfo_State = exports.trackSourceToJSON = exports.trackSourceFromJSON = exports.TrackSource = exports.trackTypeToJSON = exports.trackTypeFromJSON = exports.TrackType = exports.protobufPackage = void 0;
6
+ exports.ParticipantTracks = exports.UserPacket = exports.SpeakerInfo = exports.ActiveSpeakerUpdate = exports.DataPacket = exports.VideoLayer = exports.TrackInfo = exports.ParticipantInfo = exports.Codec = exports.Room = exports.dataPacket_KindToJSON = exports.dataPacket_KindFromJSON = exports.DataPacket_Kind = exports.participantInfo_StateToJSON = exports.participantInfo_StateFromJSON = exports.ParticipantInfo_State = exports.connectionQualityToJSON = exports.connectionQualityFromJSON = exports.ConnectionQuality = exports.videoQualityToJSON = exports.videoQualityFromJSON = exports.VideoQuality = exports.trackSourceToJSON = exports.trackSourceFromJSON = exports.TrackSource = exports.trackTypeToJSON = exports.trackTypeFromJSON = exports.TrackType = exports.protobufPackage = void 0;
7
7
  /* eslint-disable */
8
8
  const long_1 = __importDefault(require("long"));
9
9
  const minimal_1 = __importDefault(require("protobufjs/minimal"));
@@ -52,6 +52,7 @@ var TrackSource;
52
52
  TrackSource[TrackSource["CAMERA"] = 1] = "CAMERA";
53
53
  TrackSource[TrackSource["MICROPHONE"] = 2] = "MICROPHONE";
54
54
  TrackSource[TrackSource["SCREEN_SHARE"] = 3] = "SCREEN_SHARE";
55
+ TrackSource[TrackSource["SCREEN_SHARE_AUDIO"] = 4] = "SCREEN_SHARE_AUDIO";
55
56
  TrackSource[TrackSource["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
56
57
  })(TrackSource = exports.TrackSource || (exports.TrackSource = {}));
57
58
  function trackSourceFromJSON(object) {
@@ -68,6 +69,9 @@ function trackSourceFromJSON(object) {
68
69
  case 3:
69
70
  case "SCREEN_SHARE":
70
71
  return TrackSource.SCREEN_SHARE;
72
+ case 4:
73
+ case "SCREEN_SHARE_AUDIO":
74
+ return TrackSource.SCREEN_SHARE_AUDIO;
71
75
  case -1:
72
76
  case "UNRECOGNIZED":
73
77
  default:
@@ -85,11 +89,89 @@ function trackSourceToJSON(object) {
85
89
  return "MICROPHONE";
86
90
  case TrackSource.SCREEN_SHARE:
87
91
  return "SCREEN_SHARE";
92
+ case TrackSource.SCREEN_SHARE_AUDIO:
93
+ return "SCREEN_SHARE_AUDIO";
88
94
  default:
89
95
  return "UNKNOWN";
90
96
  }
91
97
  }
92
98
  exports.trackSourceToJSON = trackSourceToJSON;
99
+ var VideoQuality;
100
+ (function (VideoQuality) {
101
+ VideoQuality[VideoQuality["LOW"] = 0] = "LOW";
102
+ VideoQuality[VideoQuality["MEDIUM"] = 1] = "MEDIUM";
103
+ VideoQuality[VideoQuality["HIGH"] = 2] = "HIGH";
104
+ VideoQuality[VideoQuality["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
105
+ })(VideoQuality = exports.VideoQuality || (exports.VideoQuality = {}));
106
+ function videoQualityFromJSON(object) {
107
+ switch (object) {
108
+ case 0:
109
+ case "LOW":
110
+ return VideoQuality.LOW;
111
+ case 1:
112
+ case "MEDIUM":
113
+ return VideoQuality.MEDIUM;
114
+ case 2:
115
+ case "HIGH":
116
+ return VideoQuality.HIGH;
117
+ case -1:
118
+ case "UNRECOGNIZED":
119
+ default:
120
+ return VideoQuality.UNRECOGNIZED;
121
+ }
122
+ }
123
+ exports.videoQualityFromJSON = videoQualityFromJSON;
124
+ function videoQualityToJSON(object) {
125
+ switch (object) {
126
+ case VideoQuality.LOW:
127
+ return "LOW";
128
+ case VideoQuality.MEDIUM:
129
+ return "MEDIUM";
130
+ case VideoQuality.HIGH:
131
+ return "HIGH";
132
+ default:
133
+ return "UNKNOWN";
134
+ }
135
+ }
136
+ exports.videoQualityToJSON = videoQualityToJSON;
137
+ var ConnectionQuality;
138
+ (function (ConnectionQuality) {
139
+ ConnectionQuality[ConnectionQuality["POOR"] = 0] = "POOR";
140
+ ConnectionQuality[ConnectionQuality["GOOD"] = 1] = "GOOD";
141
+ ConnectionQuality[ConnectionQuality["EXCELLENT"] = 2] = "EXCELLENT";
142
+ ConnectionQuality[ConnectionQuality["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
143
+ })(ConnectionQuality = exports.ConnectionQuality || (exports.ConnectionQuality = {}));
144
+ function connectionQualityFromJSON(object) {
145
+ switch (object) {
146
+ case 0:
147
+ case "POOR":
148
+ return ConnectionQuality.POOR;
149
+ case 1:
150
+ case "GOOD":
151
+ return ConnectionQuality.GOOD;
152
+ case 2:
153
+ case "EXCELLENT":
154
+ return ConnectionQuality.EXCELLENT;
155
+ case -1:
156
+ case "UNRECOGNIZED":
157
+ default:
158
+ return ConnectionQuality.UNRECOGNIZED;
159
+ }
160
+ }
161
+ exports.connectionQualityFromJSON = connectionQualityFromJSON;
162
+ function connectionQualityToJSON(object) {
163
+ switch (object) {
164
+ case ConnectionQuality.POOR:
165
+ return "POOR";
166
+ case ConnectionQuality.GOOD:
167
+ return "GOOD";
168
+ case ConnectionQuality.EXCELLENT:
169
+ return "EXCELLENT";
170
+ default:
171
+ return "UNKNOWN";
172
+ }
173
+ }
174
+ exports.connectionQualityToJSON = connectionQualityToJSON;
93
175
  var ParticipantInfo_State;
94
176
  (function (ParticipantInfo_State) {
95
177
  /** JOINING - websocket' connected, but not offered yet */
@@ -179,6 +261,7 @@ const baseRoom = {
179
261
  turnPassword: "",
180
262
  metadata: "",
181
263
  numParticipants: 0,
264
+ activeRecording: false,
182
265
  };
183
266
  exports.Room = {
184
267
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -209,6 +292,9 @@ exports.Room = {
209
292
  if (message.numParticipants !== 0) {
210
293
  writer.uint32(72).uint32(message.numParticipants);
211
294
  }
295
+ if (message.activeRecording === true) {
296
+ writer.uint32(80).bool(message.activeRecording);
297
+ }
212
298
  return writer;
213
299
  },
214
300
  decode(input, length) {
@@ -246,6 +332,9 @@ exports.Room = {
246
332
  case 9:
247
333
  message.numParticipants = reader.uint32();
248
334
  break;
335
+ case 10:
336
+ message.activeRecording = reader.bool();
337
+ break;
249
338
  default:
250
339
  reader.skipType(tag & 7);
251
340
  break;
@@ -311,6 +400,13 @@ exports.Room = {
311
400
  else {
312
401
  message.numParticipants = 0;
313
402
  }
403
+ if (object.activeRecording !== undefined &&
404
+ object.activeRecording !== null) {
405
+ message.activeRecording = Boolean(object.activeRecording);
406
+ }
407
+ else {
408
+ message.activeRecording = false;
409
+ }
314
410
  return message;
315
411
  },
316
412
  toJSON(message) {
@@ -334,6 +430,8 @@ exports.Room = {
334
430
  message.metadata !== undefined && (obj.metadata = message.metadata);
335
431
  message.numParticipants !== undefined &&
336
432
  (obj.numParticipants = message.numParticipants);
433
+ message.activeRecording !== undefined &&
434
+ (obj.activeRecording = message.activeRecording);
337
435
  return obj;
338
436
  },
339
437
  fromPartial(object) {
@@ -394,6 +492,13 @@ exports.Room = {
394
492
  else {
395
493
  message.numParticipants = 0;
396
494
  }
495
+ if (object.activeRecording !== undefined &&
496
+ object.activeRecording !== null) {
497
+ message.activeRecording = object.activeRecording;
498
+ }
499
+ else {
500
+ message.activeRecording = false;
501
+ }
397
502
  return message;
398
503
  },
399
504
  };
@@ -474,6 +579,8 @@ const baseParticipantInfo = {
474
579
  metadata: "",
475
580
  joinedAt: 0,
476
581
  hidden: false,
582
+ recorder: false,
583
+ name: "",
477
584
  };
478
585
  exports.ParticipantInfo = {
479
586
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -498,6 +605,12 @@ exports.ParticipantInfo = {
498
605
  if (message.hidden === true) {
499
606
  writer.uint32(56).bool(message.hidden);
500
607
  }
608
+ if (message.recorder === true) {
609
+ writer.uint32(64).bool(message.recorder);
610
+ }
611
+ if (message.name !== "") {
612
+ writer.uint32(74).string(message.name);
613
+ }
501
614
  return writer;
502
615
  },
503
616
  decode(input, length) {
@@ -529,6 +642,12 @@ exports.ParticipantInfo = {
529
642
  case 7:
530
643
  message.hidden = reader.bool();
531
644
  break;
645
+ case 8:
646
+ message.recorder = reader.bool();
647
+ break;
648
+ case 9:
649
+ message.name = reader.string();
650
+ break;
532
651
  default:
533
652
  reader.skipType(tag & 7);
534
653
  break;
@@ -580,6 +699,18 @@ exports.ParticipantInfo = {
580
699
  else {
581
700
  message.hidden = false;
582
701
  }
702
+ if (object.recorder !== undefined && object.recorder !== null) {
703
+ message.recorder = Boolean(object.recorder);
704
+ }
705
+ else {
706
+ message.recorder = false;
707
+ }
708
+ if (object.name !== undefined && object.name !== null) {
709
+ message.name = String(object.name);
710
+ }
711
+ else {
712
+ message.name = "";
713
+ }
583
714
  return message;
584
715
  },
585
716
  toJSON(message) {
@@ -597,6 +728,8 @@ exports.ParticipantInfo = {
597
728
  message.metadata !== undefined && (obj.metadata = message.metadata);
598
729
  message.joinedAt !== undefined && (obj.joinedAt = message.joinedAt);
599
730
  message.hidden !== undefined && (obj.hidden = message.hidden);
731
+ message.recorder !== undefined && (obj.recorder = message.recorder);
732
+ message.name !== undefined && (obj.name = message.name);
600
733
  return obj;
601
734
  },
602
735
  fromPartial(object) {
@@ -643,6 +776,18 @@ exports.ParticipantInfo = {
643
776
  else {
644
777
  message.hidden = false;
645
778
  }
779
+ if (object.recorder !== undefined && object.recorder !== null) {
780
+ message.recorder = object.recorder;
781
+ }
782
+ else {
783
+ message.recorder = false;
784
+ }
785
+ if (object.name !== undefined && object.name !== null) {
786
+ message.name = object.name;
787
+ }
788
+ else {
789
+ message.name = "";
790
+ }
646
791
  return message;
647
792
  },
648
793
  };
@@ -656,6 +801,7 @@ const baseTrackInfo = {
656
801
  simulcast: false,
657
802
  disableDtx: false,
658
803
  source: 0,
804
+ mimeType: "",
659
805
  };
660
806
  exports.TrackInfo = {
661
807
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -686,12 +832,19 @@ exports.TrackInfo = {
686
832
  if (message.source !== 0) {
687
833
  writer.uint32(72).int32(message.source);
688
834
  }
835
+ for (const v of message.layers) {
836
+ exports.VideoLayer.encode(v, writer.uint32(82).fork()).ldelim();
837
+ }
838
+ if (message.mimeType !== "") {
839
+ writer.uint32(90).string(message.mimeType);
840
+ }
689
841
  return writer;
690
842
  },
691
843
  decode(input, length) {
692
844
  const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
693
845
  let end = length === undefined ? reader.len : reader.pos + length;
694
846
  const message = Object.assign({}, baseTrackInfo);
847
+ message.layers = [];
695
848
  while (reader.pos < end) {
696
849
  const tag = reader.uint32();
697
850
  switch (tag >>> 3) {
@@ -722,6 +875,12 @@ exports.TrackInfo = {
722
875
  case 9:
723
876
  message.source = reader.int32();
724
877
  break;
878
+ case 10:
879
+ message.layers.push(exports.VideoLayer.decode(reader, reader.uint32()));
880
+ break;
881
+ case 11:
882
+ message.mimeType = reader.string();
883
+ break;
725
884
  default:
726
885
  reader.skipType(tag & 7);
727
886
  break;
@@ -731,6 +890,7 @@ exports.TrackInfo = {
731
890
  },
732
891
  fromJSON(object) {
733
892
  const message = Object.assign({}, baseTrackInfo);
893
+ message.layers = [];
734
894
  if (object.sid !== undefined && object.sid !== null) {
735
895
  message.sid = String(object.sid);
736
896
  }
@@ -785,6 +945,17 @@ exports.TrackInfo = {
785
945
  else {
786
946
  message.source = 0;
787
947
  }
948
+ if (object.layers !== undefined && object.layers !== null) {
949
+ for (const e of object.layers) {
950
+ message.layers.push(exports.VideoLayer.fromJSON(e));
951
+ }
952
+ }
953
+ if (object.mimeType !== undefined && object.mimeType !== null) {
954
+ message.mimeType = String(object.mimeType);
955
+ }
956
+ else {
957
+ message.mimeType = "";
958
+ }
788
959
  return message;
789
960
  },
790
961
  toJSON(message) {
@@ -799,10 +970,18 @@ exports.TrackInfo = {
799
970
  message.disableDtx !== undefined && (obj.disableDtx = message.disableDtx);
800
971
  message.source !== undefined &&
801
972
  (obj.source = trackSourceToJSON(message.source));
973
+ if (message.layers) {
974
+ obj.layers = message.layers.map((e) => e ? exports.VideoLayer.toJSON(e) : undefined);
975
+ }
976
+ else {
977
+ obj.layers = [];
978
+ }
979
+ message.mimeType !== undefined && (obj.mimeType = message.mimeType);
802
980
  return obj;
803
981
  },
804
982
  fromPartial(object) {
805
983
  const message = Object.assign({}, baseTrackInfo);
984
+ message.layers = [];
806
985
  if (object.sid !== undefined && object.sid !== null) {
807
986
  message.sid = object.sid;
808
987
  }
@@ -857,6 +1036,126 @@ exports.TrackInfo = {
857
1036
  else {
858
1037
  message.source = 0;
859
1038
  }
1039
+ if (object.layers !== undefined && object.layers !== null) {
1040
+ for (const e of object.layers) {
1041
+ message.layers.push(exports.VideoLayer.fromPartial(e));
1042
+ }
1043
+ }
1044
+ if (object.mimeType !== undefined && object.mimeType !== null) {
1045
+ message.mimeType = object.mimeType;
1046
+ }
1047
+ else {
1048
+ message.mimeType = "";
1049
+ }
1050
+ return message;
1051
+ },
1052
+ };
1053
+ const baseVideoLayer = { quality: 0, width: 0, height: 0, bitrate: 0 };
1054
+ exports.VideoLayer = {
1055
+ encode(message, writer = minimal_1.default.Writer.create()) {
1056
+ if (message.quality !== 0) {
1057
+ writer.uint32(8).int32(message.quality);
1058
+ }
1059
+ if (message.width !== 0) {
1060
+ writer.uint32(16).uint32(message.width);
1061
+ }
1062
+ if (message.height !== 0) {
1063
+ writer.uint32(24).uint32(message.height);
1064
+ }
1065
+ if (message.bitrate !== 0) {
1066
+ writer.uint32(32).uint32(message.bitrate);
1067
+ }
1068
+ return writer;
1069
+ },
1070
+ decode(input, length) {
1071
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1072
+ let end = length === undefined ? reader.len : reader.pos + length;
1073
+ const message = Object.assign({}, baseVideoLayer);
1074
+ while (reader.pos < end) {
1075
+ const tag = reader.uint32();
1076
+ switch (tag >>> 3) {
1077
+ case 1:
1078
+ message.quality = reader.int32();
1079
+ break;
1080
+ case 2:
1081
+ message.width = reader.uint32();
1082
+ break;
1083
+ case 3:
1084
+ message.height = reader.uint32();
1085
+ break;
1086
+ case 4:
1087
+ message.bitrate = reader.uint32();
1088
+ break;
1089
+ default:
1090
+ reader.skipType(tag & 7);
1091
+ break;
1092
+ }
1093
+ }
1094
+ return message;
1095
+ },
1096
+ fromJSON(object) {
1097
+ const message = Object.assign({}, baseVideoLayer);
1098
+ if (object.quality !== undefined && object.quality !== null) {
1099
+ message.quality = videoQualityFromJSON(object.quality);
1100
+ }
1101
+ else {
1102
+ message.quality = 0;
1103
+ }
1104
+ if (object.width !== undefined && object.width !== null) {
1105
+ message.width = Number(object.width);
1106
+ }
1107
+ else {
1108
+ message.width = 0;
1109
+ }
1110
+ if (object.height !== undefined && object.height !== null) {
1111
+ message.height = Number(object.height);
1112
+ }
1113
+ else {
1114
+ message.height = 0;
1115
+ }
1116
+ if (object.bitrate !== undefined && object.bitrate !== null) {
1117
+ message.bitrate = Number(object.bitrate);
1118
+ }
1119
+ else {
1120
+ message.bitrate = 0;
1121
+ }
1122
+ return message;
1123
+ },
1124
+ toJSON(message) {
1125
+ const obj = {};
1126
+ message.quality !== undefined &&
1127
+ (obj.quality = videoQualityToJSON(message.quality));
1128
+ message.width !== undefined && (obj.width = message.width);
1129
+ message.height !== undefined && (obj.height = message.height);
1130
+ message.bitrate !== undefined && (obj.bitrate = message.bitrate);
1131
+ return obj;
1132
+ },
1133
+ fromPartial(object) {
1134
+ const message = Object.assign({}, baseVideoLayer);
1135
+ if (object.quality !== undefined && object.quality !== null) {
1136
+ message.quality = object.quality;
1137
+ }
1138
+ else {
1139
+ message.quality = 0;
1140
+ }
1141
+ if (object.width !== undefined && object.width !== null) {
1142
+ message.width = object.width;
1143
+ }
1144
+ else {
1145
+ message.width = 0;
1146
+ }
1147
+ if (object.height !== undefined && object.height !== null) {
1148
+ message.height = object.height;
1149
+ }
1150
+ else {
1151
+ message.height = 0;
1152
+ }
1153
+ if (object.bitrate !== undefined && object.bitrate !== null) {
1154
+ message.bitrate = object.bitrate;
1155
+ }
1156
+ else {
1157
+ message.bitrate = 0;
1158
+ }
860
1159
  return message;
861
1160
  },
862
1161
  };
@@ -1198,6 +1497,83 @@ exports.UserPacket = {
1198
1497
  return message;
1199
1498
  },
1200
1499
  };
1500
+ const baseParticipantTracks = { participantSid: "", trackSids: "" };
1501
+ exports.ParticipantTracks = {
1502
+ encode(message, writer = minimal_1.default.Writer.create()) {
1503
+ if (message.participantSid !== "") {
1504
+ writer.uint32(10).string(message.participantSid);
1505
+ }
1506
+ for (const v of message.trackSids) {
1507
+ writer.uint32(18).string(v);
1508
+ }
1509
+ return writer;
1510
+ },
1511
+ decode(input, length) {
1512
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
1513
+ let end = length === undefined ? reader.len : reader.pos + length;
1514
+ const message = Object.assign({}, baseParticipantTracks);
1515
+ message.trackSids = [];
1516
+ while (reader.pos < end) {
1517
+ const tag = reader.uint32();
1518
+ switch (tag >>> 3) {
1519
+ case 1:
1520
+ message.participantSid = reader.string();
1521
+ break;
1522
+ case 2:
1523
+ message.trackSids.push(reader.string());
1524
+ break;
1525
+ default:
1526
+ reader.skipType(tag & 7);
1527
+ break;
1528
+ }
1529
+ }
1530
+ return message;
1531
+ },
1532
+ fromJSON(object) {
1533
+ const message = Object.assign({}, baseParticipantTracks);
1534
+ message.trackSids = [];
1535
+ if (object.participantSid !== undefined && object.participantSid !== null) {
1536
+ message.participantSid = String(object.participantSid);
1537
+ }
1538
+ else {
1539
+ message.participantSid = "";
1540
+ }
1541
+ if (object.trackSids !== undefined && object.trackSids !== null) {
1542
+ for (const e of object.trackSids) {
1543
+ message.trackSids.push(String(e));
1544
+ }
1545
+ }
1546
+ return message;
1547
+ },
1548
+ toJSON(message) {
1549
+ const obj = {};
1550
+ message.participantSid !== undefined &&
1551
+ (obj.participantSid = message.participantSid);
1552
+ if (message.trackSids) {
1553
+ obj.trackSids = message.trackSids.map((e) => e);
1554
+ }
1555
+ else {
1556
+ obj.trackSids = [];
1557
+ }
1558
+ return obj;
1559
+ },
1560
+ fromPartial(object) {
1561
+ const message = Object.assign({}, baseParticipantTracks);
1562
+ message.trackSids = [];
1563
+ if (object.participantSid !== undefined && object.participantSid !== null) {
1564
+ message.participantSid = object.participantSid;
1565
+ }
1566
+ else {
1567
+ message.participantSid = "";
1568
+ }
1569
+ if (object.trackSids !== undefined && object.trackSids !== null) {
1570
+ for (const e of object.trackSids) {
1571
+ message.trackSids.push(e);
1572
+ }
1573
+ }
1574
+ return message;
1575
+ },
1576
+ };
1201
1577
  var globalThis = (() => {
1202
1578
  if (typeof globalThis !== "undefined")
1203
1579
  return globalThis;
@@ -1223,8 +1599,8 @@ const btoa = globalThis.btoa ||
1223
1599
  ((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
1224
1600
  function base64FromBytes(arr) {
1225
1601
  const bin = [];
1226
- for (let i = 0; i < arr.byteLength; ++i) {
1227
- bin.push(String.fromCharCode(arr[i]));
1602
+ for (const byte of arr) {
1603
+ bin.push(String.fromCharCode(byte));
1228
1604
  }
1229
1605
  return btoa(bin.join(""));
1230
1606
  }