vani-meeting-client 2.2.5 → 2.2.6

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.
@@ -1,3 +1,4 @@
1
+ import { MeetingStartRequest } from "./MeetingStartRequest";
1
2
  import { PeerConnection } from "./PeerConnection";
2
3
  export declare class Participant {
3
4
  userId: string;
@@ -15,6 +16,6 @@ export declare class Participant {
15
16
  isRecordingUser: boolean;
16
17
  private peerConnections;
17
18
  getPeerConnections: () => Map<string, PeerConnection>;
18
- getPeerConnectionsViaUserId: (userId: string) => PeerConnection;
19
+ getPeerConnectionsViaUserId: (userId: string, meetingStartRequest: MeetingStartRequest) => PeerConnection;
19
20
  constructor(_userId: string, _roomId: string, _userData?: any, _isAdmin?: boolean);
20
21
  }
@@ -22,11 +22,11 @@ var Participant = /** @class */ (function () {
22
22
  }
23
23
  return _this.peerConnections;
24
24
  };
25
- this.getPeerConnectionsViaUserId = function (userId) {
25
+ this.getPeerConnectionsViaUserId = function (userId, meetingStartRequest) {
26
26
  if (!_this.getPeerConnections().has(userId)) {
27
27
  var peerConnection = new PeerConnection();
28
28
  if (!peerConnection.rtcPeerConnection) {
29
- peerConnection.rtcPeerConnection = new DynamicLibHelper().getRTCPeerConnection();
29
+ peerConnection.rtcPeerConnection = new DynamicLibHelper().getRTCPeerConnection(meetingStartRequest);
30
30
  }
31
31
  _this.getPeerConnections().set(userId, peerConnection);
32
32
  }
@@ -1,7 +1,5 @@
1
- import { DynamicLibHelper } from "../utility/DynamicLibHelper";
2
1
  var PeerConnection = /** @class */ (function () {
3
2
  function PeerConnection() {
4
- this.rtcPeerConnection = new DynamicLibHelper().getRTCPeerConnection();
5
3
  }
6
4
  return PeerConnection;
7
5
  }());
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
5
5
  getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
6
6
  getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
7
7
  getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
8
- getRTCPeerConnection(): any;
8
+ getRTCPeerConnection(meetingStartRequest: MeetingStartRequest): any;
9
9
  }
@@ -103,8 +103,13 @@ var DynamicLibHelper = /** @class */ (function () {
103
103
  }
104
104
  return MediaStream;
105
105
  };
106
- DynamicLibHelper.prototype.getRTCPeerConnection = function () {
107
- return new RTCPeerConnection();
106
+ DynamicLibHelper.prototype.getRTCPeerConnection = function (meetingStartRequest) {
107
+ if (meetingStartRequest && meetingStartRequest.iceServers) {
108
+ return new RTCPeerConnection({ iceServers: meetingStartRequest.iceServers });
109
+ }
110
+ else {
111
+ return new RTCPeerConnection();
112
+ }
108
113
  };
109
114
  return DynamicLibHelper;
110
115
  }());
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
5
5
  getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
6
6
  getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
7
7
  getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
8
- getRTCPeerConnection(): any;
8
+ getRTCPeerConnection(meetingStartRequest: MeetingStartRequest): any;
9
9
  }
@@ -102,9 +102,14 @@ var DynamicLibHelper = /** @class */ (function () {
102
102
  }
103
103
  return MediaStream;
104
104
  };
105
- DynamicLibHelper.prototype.getRTCPeerConnection = function () {
105
+ DynamicLibHelper.prototype.getRTCPeerConnection = function (meetingStartRequest) {
106
106
  try {
107
- return new (require("react-native-webrtc").RTCPeerConnection)();
107
+ if (meetingStartRequest && meetingStartRequest.iceServers) {
108
+ return new (require("react-native-webrtc").RTCPeerConnection)({ iceServers: meetingStartRequest.iceServers });
109
+ }
110
+ else {
111
+ return new (require("react-native-webrtc").RTCPeerConnection)();
112
+ }
108
113
  }
109
114
  catch (err) {
110
115
  log.error("react-native-webrtc not found. Please do npm install ");
@@ -5,5 +5,5 @@ export declare class DynamicLibHelper {
5
5
  getVideoCallClassHandler(meetingType: MeetingType, meetingStartRequest: MeetingStartRequest, _communicationHandler: CommunicationHandler): Promise<import("../video-call-handler/SFUHandler").SFUHandler | import("../video-call-handler/WebrtcHandler").WebrtcHandler>;
6
6
  getMediaDevicesVariable(meetingStartRequest: MeetingStartRequest): any;
7
7
  getMediaStreamVariable(meetingStartRequest: MeetingStartRequest): any;
8
- getRTCPeerConnection(): any;
8
+ getRTCPeerConnection(meetingStartRequest: MeetingStartRequest): any;
9
9
  }
@@ -103,8 +103,13 @@ var DynamicLibHelper = /** @class */ (function () {
103
103
  }
104
104
  return MediaStream;
105
105
  };
106
- DynamicLibHelper.prototype.getRTCPeerConnection = function () {
107
- return new RTCPeerConnection();
106
+ DynamicLibHelper.prototype.getRTCPeerConnection = function (meetingStartRequest) {
107
+ if (meetingStartRequest && meetingStartRequest.iceServers) {
108
+ return new RTCPeerConnection({ iceServers: meetingStartRequest.iceServers });
109
+ }
110
+ else {
111
+ return new RTCPeerConnection();
112
+ }
108
113
  };
109
114
  return DynamicLibHelper;
110
115
  }());
@@ -70,8 +70,8 @@ var WebrtcHandler = /** @class */ (function (_super) {
70
70
  if (!(selfParticpant.userId !== participant.userId && !selfParticpant.getPeerConnections().has(participant.userId))) return [3 /*break*/, 2];
71
71
  isOfferInitParticipant = this.isOfferInitParticipant(participant);
72
72
  if (!!isOfferInitParticipant) return [3 /*break*/, 2];
73
- peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
74
- peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
73
+ peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
74
+ peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
75
75
  if (!peerConnection) return [3 /*break*/, 2];
76
76
  this.subToConnectionState(participant);
77
77
  peerConnection.addTransceiver("audio", { direction: "sendrecv" });
@@ -98,11 +98,11 @@ var WebrtcHandler = /** @class */ (function (_super) {
98
98
  case 0:
99
99
  selfParticpant = this.communicationHandler.getSelfParticipant();
100
100
  participant = data.sender;
101
- peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
101
+ peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
102
102
  if (peerConnectionObject) {
103
103
  peerConnectionObject.remoteOffer = data.sdp;
104
104
  }
105
- peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
105
+ peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
106
106
  if (!peerConnection) return [3 /*break*/, 2];
107
107
  this.subToConnectionState(participant);
108
108
  peerConnection.addTransceiver("audio", { direction: "sendrecv" });
@@ -127,11 +127,11 @@ var WebrtcHandler = /** @class */ (function (_super) {
127
127
  return __generator(this, function (_a) {
128
128
  selfParticpant = this.communicationHandler.getSelfParticipant();
129
129
  participant = data.sender;
130
- peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
130
+ peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
131
131
  if (peerConnectionObject) {
132
132
  peerConnectionObject.remoteAnswer = data.sdp;
133
133
  }
134
- peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection();
134
+ peerConnection = peerConnectionObject.rtcPeerConnection ? peerConnectionObject.rtcPeerConnection : this.dynamicLibHelper.getRTCPeerConnection(this.meetingStartRequest);
135
135
  if (peerConnection) {
136
136
  peerConnection.setRemoteDescription({ type: 'answer', sdp: peerConnectionObject.remoteAnswer });
137
137
  }
@@ -143,7 +143,7 @@ var WebrtcHandler = /** @class */ (function (_super) {
143
143
  return __generator(this, function (_a) {
144
144
  selfParticpant = this.communicationHandler.getSelfParticipant();
145
145
  participant = data.sender;
146
- peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
146
+ peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
147
147
  rtcConnection = peerConnectionObject.rtcPeerConnection;
148
148
  if (rtcConnection) {
149
149
  this.printLogIfRequired("on ice candidate", data.candidate);
@@ -162,7 +162,7 @@ var WebrtcHandler = /** @class */ (function (_super) {
162
162
  var _this = this;
163
163
  return __generator(this, function (_a) {
164
164
  selfParticpant = this.communicationHandler.getSelfParticipant();
165
- peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(remoteParticipant.userId);
165
+ peerConnectionObject = selfParticpant.getPeerConnectionsViaUserId(remoteParticipant.userId, this.meetingStartRequest);
166
166
  rtcConnection = peerConnectionObject.rtcPeerConnection;
167
167
  rtcConnection.addEventListener('icecandidate', function (event) {
168
168
  if (event.candidate && event.candidate !== null) {
@@ -218,7 +218,7 @@ var WebrtcHandler = /** @class */ (function (_super) {
218
218
  return __generator(this, function (_a) {
219
219
  selfParticpant = this.communicationHandler.getSelfParticipant();
220
220
  if (selfParticpant) {
221
- peerConnection = selfParticpant.getPeerConnectionsViaUserId(participant.userId);
221
+ peerConnection = selfParticpant.getPeerConnectionsViaUserId(participant.userId, this.meetingStartRequest);
222
222
  if (peerConnection && peerConnection.rtcPeerConnection) {
223
223
  this.printLogIfRequired("Send Track");
224
224
  peerConnection.rtcPeerConnection.addTrack(track.track);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-client",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "Vani Meeting Clinet SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",