vani-meeting-client-native 0.4.1 → 0.4.2
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.
|
@@ -393,13 +393,13 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
393
393
|
}
|
|
394
394
|
permissionApprovedFor = [];
|
|
395
395
|
if (isForAudio && stream.getAudioTracks().length > 0) {
|
|
396
|
-
this.onTrack(stream.getAudioTracks()[0], TrackKind.Audio, shouldAddTrackImmediately);
|
|
397
396
|
// removeAndStreamInLocalStream(stream.getAudioTracks()[0])
|
|
398
397
|
// updateLocalTrackInAllTracks(stream.getAudioTracks()[0]);
|
|
399
398
|
this.communicationHandler.getSelfParticipant().isAudioEnable = true;
|
|
400
399
|
data = { userId: (_a = this.meetingStartRequest) === null || _a === void 0 ? void 0 : _a.userId, type: "audio", status: "resume" };
|
|
401
400
|
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
402
401
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
402
|
+
this.onTrack(stream.getAudioTracks()[0], TrackKind.Audio, shouldAddTrackImmediately);
|
|
403
403
|
if (this.muteUmutePromiseResolver) {
|
|
404
404
|
this.muteUmutePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
405
405
|
this.muteUmutePromiseResolver = undefined;
|
|
@@ -415,13 +415,13 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
415
415
|
permissionApprovedFor.push(TrackKind.Audio);
|
|
416
416
|
}
|
|
417
417
|
if (isForVideo && stream.getVideoTracks().length > 0) {
|
|
418
|
-
this.onTrack(stream.getVideoTracks()[0], TrackKind.Video, shouldAddTrackImmediately);
|
|
419
418
|
// removeAndStreamInLocalStream(stream.getVideoTracks()[0])
|
|
420
419
|
// updateLocalTrackInAllTracks(stream.getVideoTracks()[0])
|
|
421
420
|
this.communicationHandler.getSelfParticipant().isVideoEnable = true;
|
|
422
421
|
data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "resume" };
|
|
423
422
|
audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
424
423
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
424
|
+
this.onTrack(stream.getVideoTracks()[0], TrackKind.Video, shouldAddTrackImmediately);
|
|
425
425
|
if (this.videoPauseResumePromiseResolver) {
|
|
426
426
|
this.videoPauseResumePromiseResolver({ message: "Success", error: 'NoError', isSuccess: true });
|
|
427
427
|
this.videoPauseResumePromiseResolver = undefined;
|
|
@@ -807,11 +807,17 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
807
807
|
if (track && track.track) {
|
|
808
808
|
track.track.enabled = false;
|
|
809
809
|
if (streamKind === TrackKind.Audio) {
|
|
810
|
+
if (this.communicationHandler) {
|
|
811
|
+
this.communicationHandler.getSelfParticipant().isAudioEnable = false;
|
|
812
|
+
}
|
|
810
813
|
var data = { userId: (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.userId, type: "audio", status: "pause" };
|
|
811
814
|
var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
812
815
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
813
816
|
}
|
|
814
817
|
else {
|
|
818
|
+
if (this.communicationHandler) {
|
|
819
|
+
this.communicationHandler.getSelfParticipant().isVideoEnable = false;
|
|
820
|
+
}
|
|
815
821
|
var data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "pause" };
|
|
816
822
|
var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
817
823
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
@@ -828,11 +834,17 @@ var UserMediaHandler = /** @class */ (function (_super) {
|
|
|
828
834
|
if (track && track.track) {
|
|
829
835
|
track.track.enabled = true;
|
|
830
836
|
if (streamKind === TrackKind.Audio) {
|
|
837
|
+
if (this.communicationHandler) {
|
|
838
|
+
this.communicationHandler.getSelfParticipant().isAudioEnable = true;
|
|
839
|
+
}
|
|
831
840
|
var data = { userId: (_b = this.meetingStartRequest) === null || _b === void 0 ? void 0 : _b.userId, type: "audio", status: "resume" };
|
|
832
841
|
var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
833
842
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
834
843
|
}
|
|
835
844
|
else {
|
|
845
|
+
if (this.communicationHandler) {
|
|
846
|
+
this.communicationHandler.getSelfParticipant().isVideoEnable = true;
|
|
847
|
+
}
|
|
836
848
|
var data = { userId: (_c = this.meetingStartRequest) === null || _c === void 0 ? void 0 : _c.userId, type: "video", status: "resume" };
|
|
837
849
|
var audioPause = { message: data, type: WebSocketBasicEvents.AudioVideoPauseResume };
|
|
838
850
|
this.communicationHandler.sendWebSocketMessage(WebSocketBasicEvents.AudioVideoPauseResume, audioPause);
|
|
@@ -85,6 +85,8 @@ export interface WebSocketMessageBody {
|
|
|
85
85
|
data?: any;
|
|
86
86
|
}
|
|
87
87
|
export declare class WebsocketHandler extends Base {
|
|
88
|
+
private sendMessageQueue;
|
|
89
|
+
private isSendQueueInProcess;
|
|
88
90
|
private websocketConnectionUrl?;
|
|
89
91
|
private loadBalancerIpAddressForWebSocket?;
|
|
90
92
|
private isEnded;
|
|
@@ -106,6 +108,7 @@ export declare class WebsocketHandler extends Base {
|
|
|
106
108
|
isWebScoketConnectedWithoutSetup(): boolean;
|
|
107
109
|
isWebScoketConnected(): boolean;
|
|
108
110
|
sendSocketMessage(type: WebSocketEvents, data: any): void;
|
|
111
|
+
private sendMessageInQueue;
|
|
109
112
|
reconnectOnInternetFailur(): void;
|
|
110
113
|
private onWebSocketClosed;
|
|
111
114
|
private tryToReconectSocket;
|
|
@@ -145,6 +145,8 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
145
145
|
__extends(WebsocketHandler, _super);
|
|
146
146
|
function WebsocketHandler() {
|
|
147
147
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
148
|
+
_this.sendMessageQueue = [];
|
|
149
|
+
_this.isSendQueueInProcess = false;
|
|
148
150
|
_this.isEnded = false;
|
|
149
151
|
_this.isWebSocketConnectionInProgress = false;
|
|
150
152
|
_this.connection = ConnectionType.new;
|
|
@@ -153,6 +155,28 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
153
155
|
_this.pongData = undefined;
|
|
154
156
|
_this.lastPingTimeStamp = 0;
|
|
155
157
|
_this.isNormalConnectionCalledWhileInPreconnectProcess = false;
|
|
158
|
+
_this.sendMessageInQueue = function () {
|
|
159
|
+
var _a;
|
|
160
|
+
if (_this.isSendQueueInProcess) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (_this.isWebScoketConnectedWithoutSetup()) {
|
|
164
|
+
if (_this.sendMessageQueue.length > 0) {
|
|
165
|
+
_this.isSendQueueInProcess = true;
|
|
166
|
+
var firstMessgae = _this.sendMessageQueue[0];
|
|
167
|
+
(_a = _this.wss) === null || _a === void 0 ? void 0 : _a.send(firstMessgae);
|
|
168
|
+
_this.sendMessageQueue.shift();
|
|
169
|
+
_this.isSendQueueInProcess = false;
|
|
170
|
+
_this.sendMessageInQueue();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
setTimeout(function () {
|
|
175
|
+
_this.isSendQueueInProcess = false;
|
|
176
|
+
_this.sendMessageInQueue();
|
|
177
|
+
}, 1000);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
156
180
|
_this.onCloseTheRoomForcefully = function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
157
181
|
var _a, _b;
|
|
158
182
|
return __generator(this, function (_c) {
|
|
@@ -369,12 +393,9 @@ var WebsocketHandler = /** @class */ (function (_super) {
|
|
|
369
393
|
return false;
|
|
370
394
|
};
|
|
371
395
|
WebsocketHandler.prototype.sendSocketMessage = function (type, data) {
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
(_a = this.wss) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(paylod));
|
|
376
|
-
console.log("sendSocketMessage", type, data);
|
|
377
|
-
}
|
|
396
|
+
var paylod = { type: type, data: data };
|
|
397
|
+
this.sendMessageQueue.push(JSON.stringify(paylod));
|
|
398
|
+
this.sendMessageInQueue();
|
|
378
399
|
};
|
|
379
400
|
WebsocketHandler.prototype.reconnectOnInternetFailur = function () {
|
|
380
401
|
var _a;
|