livekit-client 0.14.3 → 0.15.0

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.
Files changed (90) hide show
  1. package/.github/workflows/{lint.yaml → test.yaml} +7 -4
  2. package/README.md +27 -12
  3. package/dist/api/SignalClient.d.ts +4 -31
  4. package/dist/api/SignalClient.js +25 -7
  5. package/dist/api/SignalClient.js.map +1 -1
  6. package/dist/connect.d.ts +1 -1
  7. package/dist/connect.js +68 -73
  8. package/dist/connect.js.map +1 -1
  9. package/dist/index.d.ts +3 -4
  10. package/dist/index.js +4 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/logger.d.ts +10 -0
  13. package/dist/logger.js +14 -0
  14. package/dist/logger.js.map +1 -1
  15. package/dist/options.d.ts +67 -12
  16. package/dist/options.js +0 -10
  17. package/dist/options.js.map +1 -1
  18. package/dist/proto/livekit_models.d.ts +27 -1
  19. package/dist/proto/livekit_models.js +188 -3
  20. package/dist/proto/livekit_models.js.map +1 -1
  21. package/dist/proto/livekit_rtc.d.ts +49 -7
  22. package/dist/proto/livekit_rtc.js +303 -28
  23. package/dist/proto/livekit_rtc.js.map +1 -1
  24. package/dist/room/RTCEngine.d.ts +2 -2
  25. package/dist/room/RTCEngine.js +6 -4
  26. package/dist/room/RTCEngine.js.map +1 -1
  27. package/dist/room/Room.d.ts +9 -18
  28. package/dist/room/Room.js +61 -36
  29. package/dist/room/Room.js.map +1 -1
  30. package/dist/room/events.d.ts +93 -0
  31. package/dist/room/events.js +93 -0
  32. package/dist/room/events.js.map +1 -1
  33. package/dist/room/participant/LocalParticipant.d.ts +27 -11
  34. package/dist/room/participant/LocalParticipant.js +183 -155
  35. package/dist/room/participant/LocalParticipant.js.map +1 -1
  36. package/dist/room/participant/Participant.js +2 -1
  37. package/dist/room/participant/Participant.js.map +1 -1
  38. package/dist/room/participant/RemoteParticipant.js +3 -2
  39. package/dist/room/participant/RemoteParticipant.js.map +1 -1
  40. package/dist/room/participant/publishUtils.d.ts +11 -0
  41. package/dist/room/participant/publishUtils.js +148 -0
  42. package/dist/room/participant/publishUtils.js.map +1 -0
  43. package/dist/room/participant/publishUtils.test.d.ts +1 -0
  44. package/dist/room/participant/publishUtils.test.js +79 -0
  45. package/dist/room/participant/publishUtils.test.js.map +1 -0
  46. package/dist/room/track/LocalAudioTrack.d.ts +4 -3
  47. package/dist/room/track/LocalAudioTrack.js +5 -3
  48. package/dist/room/track/LocalAudioTrack.js.map +1 -1
  49. package/dist/room/track/LocalTrack.d.ts +1 -3
  50. package/dist/room/track/LocalTrack.js +2 -49
  51. package/dist/room/track/LocalTrack.js.map +1 -1
  52. package/dist/room/track/LocalVideoTrack.d.ts +6 -4
  53. package/dist/room/track/LocalVideoTrack.js +41 -12
  54. package/dist/room/track/LocalVideoTrack.js.map +1 -1
  55. package/dist/room/track/LocalVideoTrack.test.d.ts +1 -0
  56. package/dist/room/track/LocalVideoTrack.test.js +68 -0
  57. package/dist/room/track/LocalVideoTrack.test.js.map +1 -0
  58. package/dist/room/track/RemoteTrackPublication.d.ts +1 -2
  59. package/dist/room/track/RemoteTrackPublication.js +5 -4
  60. package/dist/room/track/RemoteTrackPublication.js.map +1 -1
  61. package/dist/room/track/RemoteVideoTrack.d.ts +0 -2
  62. package/dist/room/track/RemoteVideoTrack.js +11 -19
  63. package/dist/room/track/RemoteVideoTrack.js.map +1 -1
  64. package/dist/room/track/Track.d.ts +1 -2
  65. package/dist/room/track/Track.js +1 -2
  66. package/dist/room/track/Track.js.map +1 -1
  67. package/dist/room/track/options.d.ts +15 -65
  68. package/dist/room/track/options.js +14 -13
  69. package/dist/room/track/options.js.map +1 -1
  70. package/dist/room/track/utils.d.ts +3 -0
  71. package/dist/room/track/utils.js +68 -0
  72. package/dist/room/track/utils.js.map +1 -0
  73. package/dist/room/track/utils.test.d.ts +1 -0
  74. package/dist/room/track/utils.test.js +85 -0
  75. package/dist/room/track/utils.test.js.map +1 -0
  76. package/dist/version.d.ts +1 -1
  77. package/dist/version.js +1 -1
  78. package/example/index.html +183 -178
  79. package/example/sample.ts +410 -327
  80. package/example/styles.css +144 -0
  81. package/example/webpack.config.js +1 -1
  82. package/jest.config.js +6 -0
  83. package/package.json +8 -5
  84. package/tsconfig.eslint.json +8 -1
  85. package/dist/room/defaults.d.ts +0 -5
  86. package/dist/room/defaults.js +0 -32
  87. package/dist/room/defaults.js.map +0 -1
  88. package/dist/room/track/create.d.ts +0 -25
  89. package/dist/room/track/create.js +0 -172
  90. package/dist/room/track/create.js.map +0 -1
package/dist/options.d.ts CHANGED
@@ -1,4 +1,53 @@
1
- import { CreateLocalTracksOptions, TrackCaptureDefaults, TrackPublishDefaults } from './room/track/options';
1
+ import { LogLevel, LogLevelDesc } from './logger';
2
+ import { AudioCaptureOptions, CreateLocalTracksOptions, TrackPublishDefaults, VideoCaptureOptions } from './room/track/options';
3
+ /**
4
+ * Options for when creating a new room
5
+ */
6
+ export interface RoomOptions {
7
+ /**
8
+ * automatically manage quality of subscribed video tracks, subscribe to the
9
+ * an appropriate resolution based on the size of the video elements that
10
+ * tracks are attached to.
11
+ *
12
+ * also observes the visibility of attached tracks and pauses receiving data
13
+ * if they are not visible. when an attached element becomes visible again,
14
+ * the track resumes receiving data.
15
+ */
16
+ autoManageVideo?: boolean;
17
+ /**
18
+ * default options to use when capturing user's audio
19
+ */
20
+ audioCaptureDefaults?: AudioCaptureOptions;
21
+ /**
22
+ * default options to use when capturing user's video
23
+ */
24
+ videoCaptureDefaults?: VideoCaptureOptions;
25
+ /**
26
+ * default options to use when publishing tracks
27
+ */
28
+ publishDefaults?: TrackPublishDefaults;
29
+ /**
30
+ * should local tracks be stopped when they are unpublished. defaults to true
31
+ * set this to false if you would prefer to clean up unpublished local tracks manually.
32
+ */
33
+ stopLocalTrackOnUnpublish?: boolean;
34
+ /**
35
+ * @internal
36
+ * experimental flag, disable client managed layer pause when publishing capability is limited
37
+ */
38
+ expDisableLayerPause?: boolean;
39
+ }
40
+ /**
41
+ * Options for Room.connect()
42
+ */
43
+ export interface RoomConnectOptions {
44
+ /** autosubscribe to room tracks after joining, defaults to true */
45
+ autoSubscribe?: boolean;
46
+ /**
47
+ * use to override any RTCConfiguration options.
48
+ */
49
+ rtcConfig?: RTCConfiguration;
50
+ }
2
51
  /**
3
52
  * if video or audio tracks are created as part of [[connect]], it'll automatically
4
53
  * publish those tracks to the room.
@@ -17,7 +66,7 @@ export interface ConnectOptions extends CreateLocalTracksOptions {
17
66
  */
18
67
  autoManageVideo?: boolean;
19
68
  /** configures LiveKit internal log level */
20
- logLevel?: LogLevel;
69
+ logLevel?: LogLevel | LogLevelDesc;
21
70
  /**
22
71
  * set ICE servers. When deployed correctly, LiveKit automatically uses the built-in TURN servers
23
72
  */
@@ -39,19 +88,25 @@ export interface ConnectOptions extends CreateLocalTracksOptions {
39
88
  */
40
89
  video?: boolean;
41
90
  /**
42
- * default options to use when capturing user media
91
+ * default options to use when capturing user's audio
43
92
  */
44
- captureDefaults?: TrackCaptureDefaults;
93
+ audioCaptureDefaults?: AudioCaptureOptions;
94
+ /**
95
+ * default options to use when capturing user's video
96
+ */
97
+ videoCaptureDefaults?: VideoCaptureOptions;
45
98
  /**
46
99
  * default options to use when publishing tracks
47
100
  */
48
101
  publishDefaults?: TrackPublishDefaults;
49
- }
50
- export declare enum LogLevel {
51
- trace = "trace",
52
- debug = "debug",
53
- info = "info",
54
- warn = "warn",
55
- error = "error",
56
- silent = "silent"
102
+ /**
103
+ * should local tracks be stopped when they are unpublished. defaults to true
104
+ * set this to false if you would prefer to clean up unpublished local tracks manually.
105
+ */
106
+ stopLocalTrackOnUnpublish?: boolean;
107
+ /**
108
+ * @internal
109
+ * experimental flag, disable client managed layer pause when publishing capability is limited
110
+ */
111
+ expDisableLayerPause?: boolean;
57
112
  }
package/dist/options.js CHANGED
@@ -1,13 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogLevel = void 0;
4
- var LogLevel;
5
- (function (LogLevel) {
6
- LogLevel["trace"] = "trace";
7
- LogLevel["debug"] = "debug";
8
- LogLevel["info"] = "info";
9
- LogLevel["warn"] = "warn";
10
- LogLevel["error"] = "error";
11
- LogLevel["silent"] = "silent";
12
- })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
13
3
  //# sourceMappingURL=options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;AA6DA,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,6BAAiB,CAAA;AACnB,CAAC,EAPW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAOnB"}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":""}
@@ -18,6 +18,14 @@ export declare enum TrackSource {
18
18
  }
19
19
  export declare function trackSourceFromJSON(object: any): TrackSource;
20
20
  export declare function trackSourceToJSON(object: TrackSource): string;
21
+ export declare enum VideoQuality {
22
+ LOW = 0,
23
+ MEDIUM = 1,
24
+ HIGH = 2,
25
+ UNRECOGNIZED = -1
26
+ }
27
+ export declare function videoQualityFromJSON(object: any): VideoQuality;
28
+ export declare function videoQualityToJSON(object: VideoQuality): string;
21
29
  export declare enum ConnectionQuality {
22
30
  POOR = 0,
23
31
  GOOD = 1,
@@ -36,6 +44,7 @@ export interface Room {
36
44
  enabledCodecs: Codec[];
37
45
  metadata: string;
38
46
  numParticipants: number;
47
+ activeRecording: boolean;
39
48
  }
40
49
  export interface Codec {
41
50
  mime: string;
@@ -49,8 +58,8 @@ export interface ParticipantInfo {
49
58
  metadata: string;
50
59
  /** timestamp when participant joined room, in seconds */
51
60
  joinedAt: number;
52
- /** hidden participant (used for recording) */
53
61
  hidden: boolean;
62
+ recorder: boolean;
54
63
  }
55
64
  export declare enum ParticipantInfo_State {
56
65
  /** JOINING - websocket' connected, but not offered yet */
@@ -83,6 +92,16 @@ export interface TrackInfo {
83
92
  disableDtx: boolean;
84
93
  /** source of media */
85
94
  source: TrackSource;
95
+ layers: VideoLayer[];
96
+ }
97
+ /** provide information about available spatial layers */
98
+ export interface VideoLayer {
99
+ /** for tracks with a single layer, this should be HIGH */
100
+ quality: VideoQuality;
101
+ width: number;
102
+ height: number;
103
+ /** target bitrate, server will measure actual */
104
+ bitrate: number;
86
105
  }
87
106
  /** new DataPacket API */
88
107
  export interface DataPacket {
@@ -143,6 +162,13 @@ export declare const TrackInfo: {
143
162
  toJSON(message: TrackInfo): unknown;
144
163
  fromPartial(object: DeepPartial<TrackInfo>): TrackInfo;
145
164
  };
165
+ export declare const VideoLayer: {
166
+ encode(message: VideoLayer, writer?: _m0.Writer): _m0.Writer;
167
+ decode(input: _m0.Reader | Uint8Array, length?: number | undefined): VideoLayer;
168
+ fromJSON(object: any): VideoLayer;
169
+ toJSON(message: VideoLayer): unknown;
170
+ fromPartial(object: DeepPartial<VideoLayer>): VideoLayer;
171
+ };
146
172
  export declare const DataPacket: {
147
173
  encode(message: DataPacket, writer?: _m0.Writer): _m0.Writer;
148
174
  decode(input: _m0.Reader | Uint8Array, length?: number | undefined): DataPacket;
@@ -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.connectionQualityToJSON = exports.connectionQualityFromJSON = exports.ConnectionQuality = exports.trackSourceToJSON = exports.trackSourceFromJSON = exports.TrackSource = exports.trackTypeToJSON = exports.trackTypeFromJSON = exports.TrackType = exports.protobufPackage = void 0;
6
+ 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"));
@@ -96,6 +96,44 @@ function trackSourceToJSON(object) {
96
96
  }
97
97
  }
98
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;
99
137
  var ConnectionQuality;
100
138
  (function (ConnectionQuality) {
101
139
  ConnectionQuality[ConnectionQuality["POOR"] = 0] = "POOR";
@@ -223,6 +261,7 @@ const baseRoom = {
223
261
  turnPassword: "",
224
262
  metadata: "",
225
263
  numParticipants: 0,
264
+ activeRecording: false,
226
265
  };
227
266
  exports.Room = {
228
267
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -253,6 +292,9 @@ exports.Room = {
253
292
  if (message.numParticipants !== 0) {
254
293
  writer.uint32(72).uint32(message.numParticipants);
255
294
  }
295
+ if (message.activeRecording === true) {
296
+ writer.uint32(80).bool(message.activeRecording);
297
+ }
256
298
  return writer;
257
299
  },
258
300
  decode(input, length) {
@@ -290,6 +332,9 @@ exports.Room = {
290
332
  case 9:
291
333
  message.numParticipants = reader.uint32();
292
334
  break;
335
+ case 10:
336
+ message.activeRecording = reader.bool();
337
+ break;
293
338
  default:
294
339
  reader.skipType(tag & 7);
295
340
  break;
@@ -355,6 +400,13 @@ exports.Room = {
355
400
  else {
356
401
  message.numParticipants = 0;
357
402
  }
403
+ if (object.activeRecording !== undefined &&
404
+ object.activeRecording !== null) {
405
+ message.activeRecording = Boolean(object.activeRecording);
406
+ }
407
+ else {
408
+ message.activeRecording = false;
409
+ }
358
410
  return message;
359
411
  },
360
412
  toJSON(message) {
@@ -378,10 +430,12 @@ exports.Room = {
378
430
  message.metadata !== undefined && (obj.metadata = message.metadata);
379
431
  message.numParticipants !== undefined &&
380
432
  (obj.numParticipants = message.numParticipants);
433
+ message.activeRecording !== undefined &&
434
+ (obj.activeRecording = message.activeRecording);
381
435
  return obj;
382
436
  },
383
437
  fromPartial(object) {
384
- var _a, _b, _c, _d, _e, _f, _g, _h;
438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
385
439
  const message = Object.assign({}, baseRoom);
386
440
  message.sid = (_a = object.sid) !== null && _a !== void 0 ? _a : "";
387
441
  message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
@@ -397,6 +451,7 @@ exports.Room = {
397
451
  }
398
452
  message.metadata = (_g = object.metadata) !== null && _g !== void 0 ? _g : "";
399
453
  message.numParticipants = (_h = object.numParticipants) !== null && _h !== void 0 ? _h : 0;
454
+ message.activeRecording = (_j = object.activeRecording) !== null && _j !== void 0 ? _j : false;
400
455
  return message;
401
456
  },
402
457
  };
@@ -468,6 +523,7 @@ const baseParticipantInfo = {
468
523
  metadata: "",
469
524
  joinedAt: 0,
470
525
  hidden: false,
526
+ recorder: false,
471
527
  };
472
528
  exports.ParticipantInfo = {
473
529
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -492,6 +548,9 @@ exports.ParticipantInfo = {
492
548
  if (message.hidden === true) {
493
549
  writer.uint32(56).bool(message.hidden);
494
550
  }
551
+ if (message.recorder === true) {
552
+ writer.uint32(64).bool(message.recorder);
553
+ }
495
554
  return writer;
496
555
  },
497
556
  decode(input, length) {
@@ -523,6 +582,9 @@ exports.ParticipantInfo = {
523
582
  case 7:
524
583
  message.hidden = reader.bool();
525
584
  break;
585
+ case 8:
586
+ message.recorder = reader.bool();
587
+ break;
526
588
  default:
527
589
  reader.skipType(tag & 7);
528
590
  break;
@@ -574,6 +636,12 @@ exports.ParticipantInfo = {
574
636
  else {
575
637
  message.hidden = false;
576
638
  }
639
+ if (object.recorder !== undefined && object.recorder !== null) {
640
+ message.recorder = Boolean(object.recorder);
641
+ }
642
+ else {
643
+ message.recorder = false;
644
+ }
577
645
  return message;
578
646
  },
579
647
  toJSON(message) {
@@ -591,10 +659,11 @@ exports.ParticipantInfo = {
591
659
  message.metadata !== undefined && (obj.metadata = message.metadata);
592
660
  message.joinedAt !== undefined && (obj.joinedAt = message.joinedAt);
593
661
  message.hidden !== undefined && (obj.hidden = message.hidden);
662
+ message.recorder !== undefined && (obj.recorder = message.recorder);
594
663
  return obj;
595
664
  },
596
665
  fromPartial(object) {
597
- var _a, _b, _c, _d, _e, _f;
666
+ var _a, _b, _c, _d, _e, _f, _g;
598
667
  const message = Object.assign({}, baseParticipantInfo);
599
668
  message.sid = (_a = object.sid) !== null && _a !== void 0 ? _a : "";
600
669
  message.identity = (_b = object.identity) !== null && _b !== void 0 ? _b : "";
@@ -608,6 +677,7 @@ exports.ParticipantInfo = {
608
677
  message.metadata = (_d = object.metadata) !== null && _d !== void 0 ? _d : "";
609
678
  message.joinedAt = (_e = object.joinedAt) !== null && _e !== void 0 ? _e : 0;
610
679
  message.hidden = (_f = object.hidden) !== null && _f !== void 0 ? _f : false;
680
+ message.recorder = (_g = object.recorder) !== null && _g !== void 0 ? _g : false;
611
681
  return message;
612
682
  },
613
683
  };
@@ -651,12 +721,16 @@ exports.TrackInfo = {
651
721
  if (message.source !== 0) {
652
722
  writer.uint32(72).int32(message.source);
653
723
  }
724
+ for (const v of message.layers) {
725
+ exports.VideoLayer.encode(v, writer.uint32(82).fork()).ldelim();
726
+ }
654
727
  return writer;
655
728
  },
656
729
  decode(input, length) {
657
730
  const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
658
731
  let end = length === undefined ? reader.len : reader.pos + length;
659
732
  const message = Object.assign({}, baseTrackInfo);
733
+ message.layers = [];
660
734
  while (reader.pos < end) {
661
735
  const tag = reader.uint32();
662
736
  switch (tag >>> 3) {
@@ -687,6 +761,9 @@ exports.TrackInfo = {
687
761
  case 9:
688
762
  message.source = reader.int32();
689
763
  break;
764
+ case 10:
765
+ message.layers.push(exports.VideoLayer.decode(reader, reader.uint32()));
766
+ break;
690
767
  default:
691
768
  reader.skipType(tag & 7);
692
769
  break;
@@ -696,6 +773,7 @@ exports.TrackInfo = {
696
773
  },
697
774
  fromJSON(object) {
698
775
  const message = Object.assign({}, baseTrackInfo);
776
+ message.layers = [];
699
777
  if (object.sid !== undefined && object.sid !== null) {
700
778
  message.sid = String(object.sid);
701
779
  }
@@ -750,6 +828,11 @@ exports.TrackInfo = {
750
828
  else {
751
829
  message.source = 0;
752
830
  }
831
+ if (object.layers !== undefined && object.layers !== null) {
832
+ for (const e of object.layers) {
833
+ message.layers.push(exports.VideoLayer.fromJSON(e));
834
+ }
835
+ }
753
836
  return message;
754
837
  },
755
838
  toJSON(message) {
@@ -764,6 +847,12 @@ exports.TrackInfo = {
764
847
  message.disableDtx !== undefined && (obj.disableDtx = message.disableDtx);
765
848
  message.source !== undefined &&
766
849
  (obj.source = trackSourceToJSON(message.source));
850
+ if (message.layers) {
851
+ obj.layers = message.layers.map((e) => e ? exports.VideoLayer.toJSON(e) : undefined);
852
+ }
853
+ else {
854
+ obj.layers = [];
855
+ }
767
856
  return obj;
768
857
  },
769
858
  fromPartial(object) {
@@ -778,6 +867,102 @@ exports.TrackInfo = {
778
867
  message.simulcast = (_g = object.simulcast) !== null && _g !== void 0 ? _g : false;
779
868
  message.disableDtx = (_h = object.disableDtx) !== null && _h !== void 0 ? _h : false;
780
869
  message.source = (_j = object.source) !== null && _j !== void 0 ? _j : 0;
870
+ message.layers = [];
871
+ if (object.layers !== undefined && object.layers !== null) {
872
+ for (const e of object.layers) {
873
+ message.layers.push(exports.VideoLayer.fromPartial(e));
874
+ }
875
+ }
876
+ return message;
877
+ },
878
+ };
879
+ const baseVideoLayer = { quality: 0, width: 0, height: 0, bitrate: 0 };
880
+ exports.VideoLayer = {
881
+ encode(message, writer = minimal_1.default.Writer.create()) {
882
+ if (message.quality !== 0) {
883
+ writer.uint32(8).int32(message.quality);
884
+ }
885
+ if (message.width !== 0) {
886
+ writer.uint32(16).uint32(message.width);
887
+ }
888
+ if (message.height !== 0) {
889
+ writer.uint32(24).uint32(message.height);
890
+ }
891
+ if (message.bitrate !== 0) {
892
+ writer.uint32(32).uint32(message.bitrate);
893
+ }
894
+ return writer;
895
+ },
896
+ decode(input, length) {
897
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
898
+ let end = length === undefined ? reader.len : reader.pos + length;
899
+ const message = Object.assign({}, baseVideoLayer);
900
+ while (reader.pos < end) {
901
+ const tag = reader.uint32();
902
+ switch (tag >>> 3) {
903
+ case 1:
904
+ message.quality = reader.int32();
905
+ break;
906
+ case 2:
907
+ message.width = reader.uint32();
908
+ break;
909
+ case 3:
910
+ message.height = reader.uint32();
911
+ break;
912
+ case 4:
913
+ message.bitrate = reader.uint32();
914
+ break;
915
+ default:
916
+ reader.skipType(tag & 7);
917
+ break;
918
+ }
919
+ }
920
+ return message;
921
+ },
922
+ fromJSON(object) {
923
+ const message = Object.assign({}, baseVideoLayer);
924
+ if (object.quality !== undefined && object.quality !== null) {
925
+ message.quality = videoQualityFromJSON(object.quality);
926
+ }
927
+ else {
928
+ message.quality = 0;
929
+ }
930
+ if (object.width !== undefined && object.width !== null) {
931
+ message.width = Number(object.width);
932
+ }
933
+ else {
934
+ message.width = 0;
935
+ }
936
+ if (object.height !== undefined && object.height !== null) {
937
+ message.height = Number(object.height);
938
+ }
939
+ else {
940
+ message.height = 0;
941
+ }
942
+ if (object.bitrate !== undefined && object.bitrate !== null) {
943
+ message.bitrate = Number(object.bitrate);
944
+ }
945
+ else {
946
+ message.bitrate = 0;
947
+ }
948
+ return message;
949
+ },
950
+ toJSON(message) {
951
+ const obj = {};
952
+ message.quality !== undefined &&
953
+ (obj.quality = videoQualityToJSON(message.quality));
954
+ message.width !== undefined && (obj.width = message.width);
955
+ message.height !== undefined && (obj.height = message.height);
956
+ message.bitrate !== undefined && (obj.bitrate = message.bitrate);
957
+ return obj;
958
+ },
959
+ fromPartial(object) {
960
+ var _a, _b, _c, _d;
961
+ const message = Object.assign({}, baseVideoLayer);
962
+ message.quality = (_a = object.quality) !== null && _a !== void 0 ? _a : 0;
963
+ message.width = (_b = object.width) !== null && _b !== void 0 ? _b : 0;
964
+ message.height = (_c = object.height) !== null && _c !== void 0 ? _c : 0;
965
+ message.bitrate = (_d = object.bitrate) !== null && _d !== void 0 ? _d : 0;
781
966
  return message;
782
967
  },
783
968
  };