vani-meeting-client 0.3.2 → 0.3.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.
@@ -13,6 +13,7 @@ export declare abstract class BaseVideoCallHandler extends Base {
13
13
  abstract resumeIncomingTrack(track: Track): void;
14
14
  abstract pauseIncomingTrack(track: Track): void;
15
15
  abstract onParticipantUpdated(): void;
16
+ abstract createDataChannel(): any;
16
17
  updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
17
18
  reconnectedWithoutPing(): void;
18
19
  cleanup(): void;
@@ -10,6 +10,8 @@ export declare class SFUHandler extends BaseVideoCallHandler {
10
10
  private isProduceTrackIntialWorkDone;
11
11
  private producers;
12
12
  private consumers;
13
+ private dataProducers;
14
+ private dataConsumer;
13
15
  onReconnect(): Promise<void>;
14
16
  stopTrack(track: Track): void;
15
17
  pauseTrack(track: Track): void;
@@ -18,6 +20,7 @@ export declare class SFUHandler extends BaseVideoCallHandler {
18
20
  resumeIncomingTrack(track: Track): void;
19
21
  updateSpatialForTrack(track: Track, spatialLayerIndex: number): Promise<void>;
20
22
  sendTrack(track: Track): Promise<void>;
23
+ createDataChannel(): Promise<void>;
21
24
  onParticipantUpdated(): void;
22
25
  init(): Promise<void>;
23
26
  private onTransportNotFound;
@@ -75,6 +75,8 @@ var SFUHandler = /** @class */ (function (_super) {
75
75
  _this.isProduceTrackIntialWorkDone = false;
76
76
  _this.producers = [];
77
77
  _this.consumers = [];
78
+ _this.dataProducers = [];
79
+ _this.dataConsumer = [];
78
80
  return _this;
79
81
  }
80
82
  SFUHandler.prototype.onReconnect = function () {
@@ -196,6 +198,7 @@ var SFUHandler = /** @class */ (function (_super) {
196
198
  if (webcamProducer) {
197
199
  this.producers.push(webcamProducer);
198
200
  this.onParticipantUpdated();
201
+ this.createDataChannel();
199
202
  // this.sendMessageReadyToConsume();
200
203
  }
201
204
  _d.label = 4;
@@ -204,6 +207,26 @@ var SFUHandler = /** @class */ (function (_super) {
204
207
  });
205
208
  });
206
209
  };
210
+ SFUHandler.prototype.createDataChannel = function () {
211
+ var _a;
212
+ return __awaiter(this, void 0, void 0, function () {
213
+ var webcamProducer;
214
+ return __generator(this, function (_b) {
215
+ switch (_b.label) {
216
+ case 0:
217
+ if (!(this.dataProducers.length === 0)) return [3 /*break*/, 2];
218
+ return [4 /*yield*/, ((_a = this.sendTransport) === null || _a === void 0 ? void 0 : _a.produceData())];
219
+ case 1:
220
+ webcamProducer = _b.sent();
221
+ if (webcamProducer) {
222
+ this.dataProducers.push(webcamProducer);
223
+ }
224
+ _b.label = 2;
225
+ case 2: return [2 /*return*/];
226
+ }
227
+ });
228
+ });
229
+ };
207
230
  SFUHandler.prototype.onParticipantUpdated = function () {
208
231
  if (!this.communicationHandler || this.communicationHandler.getAllParticipants().length < 2) {
209
232
  this.producers.forEach(function (producer) {
@@ -289,6 +312,16 @@ var SFUHandler = /** @class */ (function (_super) {
289
312
  var messageJson = { to: "self", type: SFUMessageType.OnTransportProduceSyncRequest, message: { type: producerLocalParameters.appData.type, transportId: (_a = _this.sendTransport) === null || _a === void 0 ? void 0 : _a.id, kind: producerLocalParameters.kind, rtpParameters: producerLocalParameters.rtpParameters, appData: producerLocalParameters.appData } };
290
313
  _this.sendSFUMessageToSocket(messageJson);
291
314
  });
315
+ transport.on("producedata", function (producerLocalParameters, callback, errback) { return __awaiter(_this, void 0, void 0, function () {
316
+ var messageJson;
317
+ var _a;
318
+ return __generator(this, function (_b) {
319
+ this.transportCallBacks[this.sendTransport.id] = callback;
320
+ messageJson = { to: "self", type: SFUMessageType.OnTransportProduceSyncRequest, message: { type: producerLocalParameters.appData.type, transportId: (_a = this.sendTransport) === null || _a === void 0 ? void 0 : _a.id, kind: producerLocalParameters.kind, rtpParameters: producerLocalParameters.rtpParameters, appData: producerLocalParameters.appData } };
321
+ this.sendSFUMessageToSocket(messageJson);
322
+ return [2 /*return*/];
323
+ });
324
+ }); });
292
325
  this.sendTransport.on('connectionstatechange', function (newState) {
293
326
  var _a;
294
327
  if (newState === "disconnected" || newState === "failed") {
@@ -400,6 +433,8 @@ var SFUHandler = /** @class */ (function (_super) {
400
433
  return __awaiter(this, void 0, void 0, function () {
401
434
  var producer, producerId, consumerAppData, cosumeObj, message;
402
435
  return __generator(this, function (_a) {
436
+ console.log("onNewProducer");
437
+ console.log(data);
403
438
  if (this.consumerTransport && data && data.message && data.message.producer) {
404
439
  producer = data.message.producer;
405
440
  producerId = producer.id;
@@ -12,4 +12,5 @@ export declare class WebrtcHandler extends BaseVideoCallHandler {
12
12
  pauseTrack(track: Track): void;
13
13
  resumeTrack(track: Track): void;
14
14
  sendTrack(track: Track): void;
15
+ createDataChannel(): Promise<void>;
15
16
  }
@@ -91,6 +91,13 @@ var WebrtcHandler = /** @class */ (function (_super) {
91
91
  WebrtcHandler.prototype.sendTrack = function (track) {
92
92
  throw new Error("Method not implemented.");
93
93
  };
94
+ WebrtcHandler.prototype.createDataChannel = function () {
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ return __generator(this, function (_a) {
97
+ return [2 /*return*/];
98
+ });
99
+ });
100
+ };
94
101
  return WebrtcHandler;
95
102
  }(BaseVideoCallHandler));
96
103
  export { WebrtcHandler };
@@ -134,7 +134,7 @@ var WebsocketHandler = /** @class */ (function (_super) {
134
134
  this.loadBalancerIpAddressForWebSocket = undefined;
135
135
  this.isEnded = true;
136
136
  if (this.wss) {
137
- this.wss.close(1005);
137
+ this.wss.close();
138
138
  this.wss = undefined;
139
139
  }
140
140
  if (this.socketCheckTimeout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "0.3.2",
3
+ "version": "0.3.5",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",