vani-meeting-client 0.7.8 → 0.8.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.
@@ -16,6 +16,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
16
16
  private dataConsumer;
17
17
  constructor(_meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler);
18
18
  onReconnect(): Promise<void>;
19
+ private onRestartIceCandidateResponse;
19
20
  stopTrack(track: Track): void;
20
21
  pauseTrack(track: Track): void;
21
22
  resumeTrack(track: Track): void;
@@ -29,6 +30,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
29
30
  init(): Promise<void>;
30
31
  private onTransportNotFound;
31
32
  private addObserverForDevice;
33
+ private onAllProducers;
32
34
  private onRouterRtpCapabilities;
33
35
  private onTransportConnectDone;
34
36
  private onSendTransport;
@@ -109,6 +109,26 @@ var SFUHandler = /** @class */ (function (_super) {
109
109
  });
110
110
  });
111
111
  };
112
+ SFUHandler.prototype.onRestartIceCandidateResponse = function (data) {
113
+ var _a;
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var transportId, iceParameters, messageJson;
116
+ return __generator(this, function (_b) {
117
+ transportId = data.message.transportId;
118
+ iceParameters = data.message.iceParameters;
119
+ if (this.consumerTransport && this.consumerTransport.id === transportId) {
120
+ this.consumerTransport.restartIce({ iceParameters: iceParameters });
121
+ }
122
+ else if (this.sendTransport && this.sendTransport.id === transportId) {
123
+ this.sendTransport.restartIce({ iceParameters: iceParameters });
124
+ }
125
+ messageJson = { to: "self", type: SFUMessageType.GetAllProducers, message: {} };
126
+ this.sendSFUMessageToSocket(messageJson);
127
+ (_a = this.communicationHandler) === null || _a === void 0 ? void 0 : _a.downloadParticipantsData();
128
+ return [2 /*return*/];
129
+ });
130
+ });
131
+ };
112
132
  SFUHandler.prototype.stopTrack = function (track) {
113
133
  var producer = this.producers.find(function (producer) { return producer.appData.trackId === track.trackId; });
114
134
  if (producer) {
@@ -298,6 +318,26 @@ var SFUHandler = /** @class */ (function (_super) {
298
318
  });
299
319
  });
300
320
  };
321
+ SFUHandler.prototype.onAllProducers = function (data) {
322
+ return __awaiter(this, void 0, void 0, function () {
323
+ var allProducers;
324
+ var _this = this;
325
+ return __generator(this, function (_a) {
326
+ console.log("onAllProducers");
327
+ if (this.consumerTransport) {
328
+ allProducers = data.message.producers;
329
+ allProducers.forEach(function (eachProducer) {
330
+ var producerId = eachProducer.id;
331
+ var consumedProducer = _this.consumers.find(function (eachConsumer) { return eachConsumer.producerId === producerId; });
332
+ if (!consumedProducer) {
333
+ _this.onNewProducer({ data: { message: { producer: eachProducer } } });
334
+ }
335
+ });
336
+ }
337
+ return [2 /*return*/];
338
+ });
339
+ });
340
+ };
301
341
  SFUHandler.prototype.onRouterRtpCapabilities = function (data) {
302
342
  if (data && data.message && data.message.rtpCapabilities) {
303
343
  this.routerRtpCapabilities = data.message.rtpCapabilities;
@@ -367,7 +407,7 @@ var SFUHandler = /** @class */ (function (_super) {
367
407
  var _this = this;
368
408
  var _a, _b;
369
409
  log.info("produceTracks");
370
- if (!this.sendTransport || !this.consumerTransport == null || this.isProduceTrackIntialWorkDone) {
410
+ if (!this.sendTransport || !this.consumerTransport || this.isProduceTrackIntialWorkDone) {
371
411
  return;
372
412
  }
373
413
  this.isProduceTrackIntialWorkDone = true;
@@ -435,6 +475,12 @@ var SFUHandler = /** @class */ (function (_super) {
435
475
  else if (websocketCallHandler.type === SFUMessageType.OnTransportNotFound) {
436
476
  this.onTransportNotFound(websocketCallHandler.data);
437
477
  }
478
+ else if (websocketCallHandler.type === SFUMessageType.OnRestartIceCandidateResponse) {
479
+ this.onRestartIceCandidateResponse(websocketCallHandler.data);
480
+ }
481
+ else if (websocketCallHandler.type === SFUMessageType.OnAllProducers) {
482
+ this.onAllProducers(websocketCallHandler.data);
483
+ }
438
484
  };
439
485
  SFUHandler.prototype.onTrackEnded = function (data) {
440
486
  var _a, _b;
@@ -52,7 +52,10 @@ export declare enum SFUMessageType {
52
52
  OnRestartIceCandidate = "restartIceCandidate",
53
53
  OnTrackEnded = "onTrackEnded",
54
54
  UpdateSpatialConsumer = "updateSpatialConsumer",
55
- OnTransportNotFound = "onTransportNotFound"
55
+ OnRestartIceCandidateResponse = "onRestartIceCandidate",
56
+ OnTransportNotFound = "onTransportNotFound",
57
+ GetAllProducers = "getAllProducers",
58
+ OnAllProducers = "onAllProducers"
56
59
  }
57
60
  export declare type WebSocketEvents = SFUMessageType | WebSocketBasicEvents;
58
61
  export interface WebSocketMessageBody {
@@ -108,7 +108,10 @@ export var SFUMessageType;
108
108
  SFUMessageType["OnRestartIceCandidate"] = "restartIceCandidate";
109
109
  SFUMessageType["OnTrackEnded"] = "onTrackEnded";
110
110
  SFUMessageType["UpdateSpatialConsumer"] = "updateSpatialConsumer";
111
+ SFUMessageType["OnRestartIceCandidateResponse"] = "onRestartIceCandidate";
111
112
  SFUMessageType["OnTransportNotFound"] = "onTransportNotFound";
113
+ SFUMessageType["GetAllProducers"] = "getAllProducers";
114
+ SFUMessageType["OnAllProducers"] = "onAllProducers";
112
115
  })(SFUMessageType || (SFUMessageType = {}));
113
116
  var ConnectionType;
114
117
  (function (ConnectionType) {
@@ -402,8 +405,8 @@ var WebsocketHandler = /** @class */ (function (_super) {
402
405
  }
403
406
  }
404
407
  else if (type === WebSocketBasicEvents.OnMeetingStartTime) {
405
- if (data && data.time) {
406
- var time = data.time;
408
+ if (data && (data.time || data.message)) {
409
+ var time = data.time ? data.time : data.message;
407
410
  if (time > new Date().getTime()) {
408
411
  time = new Date().getTime();
409
412
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",