@videosdk.live/react-sdk 0.1.9 → 0.1.13
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.
- package/dist/index.js +209 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +210 -14
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var React__default = _interopDefault(React);
|
|
|
5
5
|
var EventEmitter = _interopDefault(require('events'));
|
|
6
6
|
var jsSdk = require('@videosdk.live/js-sdk');
|
|
7
7
|
|
|
8
|
-
var eventPrifix = '
|
|
8
|
+
var eventPrifix = 'videosdk-live-react-sdk';
|
|
9
9
|
var events = {
|
|
10
10
|
'participant-joined': eventPrifix + "-participant-joined",
|
|
11
11
|
'participant-left': eventPrifix + "-participant-left",
|
|
@@ -25,7 +25,10 @@ var events = {
|
|
|
25
25
|
'video-seeked': eventPrifix + "-video-seeked",
|
|
26
26
|
'webcam-requested': eventPrifix + "-webcam-requested",
|
|
27
27
|
'mic-requested': eventPrifix + "-mic-requested",
|
|
28
|
-
'pin-state-changed': eventPrifix + "-pin-state-changed"
|
|
28
|
+
'pin-state-changed': eventPrifix + "-pin-state-changed",
|
|
29
|
+
'connection-open': eventPrifix + "-connection-open",
|
|
30
|
+
'connection-close': eventPrifix + "-connection-close",
|
|
31
|
+
'switch-meeting': eventPrifix + "-switch-meeting"
|
|
29
32
|
};
|
|
30
33
|
var eventEmitter = new EventEmitter();
|
|
31
34
|
eventEmitter.setMaxListeners(9999);
|
|
@@ -70,7 +73,13 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
70
73
|
_ref$onMicRequested = _ref.onMicRequested,
|
|
71
74
|
onMicRequested = _ref$onMicRequested === void 0 ? function () {} : _ref$onMicRequested,
|
|
72
75
|
_ref$onPinStateChange = _ref.onPinStateChanged,
|
|
73
|
-
onPinStateChanged = _ref$onPinStateChange === void 0 ? function () {} : _ref$onPinStateChange
|
|
76
|
+
onPinStateChanged = _ref$onPinStateChange === void 0 ? function () {} : _ref$onPinStateChange,
|
|
77
|
+
_ref$onConnectionOpen = _ref.onConnectionOpen,
|
|
78
|
+
onConnectionOpen = _ref$onConnectionOpen === void 0 ? function () {} : _ref$onConnectionOpen,
|
|
79
|
+
_ref$onConnetionClose = _ref.onConnetionClose,
|
|
80
|
+
onConnetionClose = _ref$onConnetionClose === void 0 ? function () {} : _ref$onConnetionClose,
|
|
81
|
+
_ref$onSwitchMeeting = _ref.onSwitchMeeting,
|
|
82
|
+
onSwitchMeeting = _ref$onSwitchMeeting === void 0 ? function () {} : _ref$onSwitchMeeting;
|
|
74
83
|
|
|
75
84
|
React.useEffect(function () {
|
|
76
85
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
@@ -92,6 +101,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
92
101
|
eventEmitter.on(events['webcam-requested'], onWebcamRequested);
|
|
93
102
|
eventEmitter.on(events['mic-requested'], onMicRequested);
|
|
94
103
|
eventEmitter.on(events['pin-state-changed'], onPinStateChanged);
|
|
104
|
+
eventEmitter.on(events['connection-open'], onConnectionOpen);
|
|
105
|
+
eventEmitter.on(events['connection-close'], onConnetionClose);
|
|
106
|
+
eventEmitter.on(events['switch-meeting'], onSwitchMeeting);
|
|
95
107
|
return function () {
|
|
96
108
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
97
109
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
@@ -112,6 +124,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
112
124
|
eventEmitter.off(events['webcam-requested'], onWebcamRequested);
|
|
113
125
|
eventEmitter.off(events['mic-requested'], onMicRequested);
|
|
114
126
|
eventEmitter.off(events['pin-state-changed'], onPinStateChanged);
|
|
127
|
+
eventEmitter.off(events['connection-open'], onConnectionOpen);
|
|
128
|
+
eventEmitter.off(events['connection-close'], onConnetionClose);
|
|
129
|
+
eventEmitter.off(events['switch-meeting'], onSwitchMeeting);
|
|
115
130
|
};
|
|
116
131
|
}, []);
|
|
117
132
|
return React.useContext(MeetingProviderContex);
|
|
@@ -155,7 +170,13 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
155
170
|
_ref2$onMicRequested = _ref2.onMicRequested,
|
|
156
171
|
onMicRequested = _ref2$onMicRequested === void 0 ? function () {} : _ref2$onMicRequested,
|
|
157
172
|
_ref2$onPinStateChang = _ref2.onPinStateChanged,
|
|
158
|
-
onPinStateChanged = _ref2$onPinStateChang === void 0 ? function () {} : _ref2$onPinStateChang
|
|
173
|
+
onPinStateChanged = _ref2$onPinStateChang === void 0 ? function () {} : _ref2$onPinStateChang,
|
|
174
|
+
_ref2$onConnectionOpe = _ref2.onConnectionOpen,
|
|
175
|
+
onConnectionOpen = _ref2$onConnectionOpe === void 0 ? function () {} : _ref2$onConnectionOpe,
|
|
176
|
+
_ref2$onConnetionClos = _ref2.onConnetionClose,
|
|
177
|
+
onConnetionClose = _ref2$onConnetionClos === void 0 ? function () {} : _ref2$onConnetionClos,
|
|
178
|
+
_ref2$onSwitchMeeting = _ref2.onSwitchMeeting,
|
|
179
|
+
onSwitchMeeting = _ref2$onSwitchMeeting === void 0 ? function () {} : _ref2$onSwitchMeeting;
|
|
159
180
|
React.useEffect(function () {
|
|
160
181
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
161
182
|
eventEmitter.on(events['participant-left'], onParticipantLeft);
|
|
@@ -176,6 +197,9 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
176
197
|
eventEmitter.on(events['webcam-requested'], onWebcamRequested);
|
|
177
198
|
eventEmitter.on(events['mic-requested'], onMicRequested);
|
|
178
199
|
eventEmitter.on(events['pin-state-changed'], onPinStateChanged);
|
|
200
|
+
eventEmitter.on(events['connection-open'], onConnectionOpen);
|
|
201
|
+
eventEmitter.on(events['connection-close'], onConnetionClose);
|
|
202
|
+
eventEmitter.on(events['switch-meeting'], onSwitchMeeting);
|
|
179
203
|
return function () {
|
|
180
204
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
181
205
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
@@ -196,6 +220,9 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
196
220
|
eventEmitter.off(events['webcam-requested'], onWebcamRequested);
|
|
197
221
|
eventEmitter.off(events['mic-requested'], onMicRequested);
|
|
198
222
|
eventEmitter.off(events['pin-state-changed'], onPinStateChanged);
|
|
223
|
+
eventEmitter.off(events['connection-open'], onConnectionOpen);
|
|
224
|
+
eventEmitter.off(events['connection-close'], onConnetionClose);
|
|
225
|
+
eventEmitter.off(events['switch-meeting'], onSwitchMeeting);
|
|
199
226
|
};
|
|
200
227
|
}, []);
|
|
201
228
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
@@ -205,7 +232,8 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
205
232
|
var children = _ref.children,
|
|
206
233
|
config = _ref.config,
|
|
207
234
|
token = _ref.token,
|
|
208
|
-
joinWithoutUserInteraction = _ref.joinWithoutUserInteraction
|
|
235
|
+
joinWithoutUserInteraction = _ref.joinWithoutUserInteraction,
|
|
236
|
+
_reinitialiseMeetingOnConfigChange = _ref.reinitialiseMeetingOnConfigChange;
|
|
209
237
|
|
|
210
238
|
var _useState = React.useState(null),
|
|
211
239
|
meeting = _useState[0],
|
|
@@ -259,11 +287,21 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
259
287
|
isLiveStreaming = _useState13[0],
|
|
260
288
|
setIsLiveStreaming = _useState13[1];
|
|
261
289
|
|
|
290
|
+
var _useState14 = React.useState(new Map()),
|
|
291
|
+
connections = _useState14[0],
|
|
292
|
+
setConnections = _useState14[1];
|
|
293
|
+
|
|
262
294
|
var meetingRef = React.useRef();
|
|
263
295
|
var localMicOnRef = React.useRef();
|
|
264
296
|
var localWebcamOnRef = React.useRef();
|
|
265
297
|
var localScreenShareOnRef = React.useRef();
|
|
266
298
|
var isRecordingRef = React.useRef();
|
|
299
|
+
var configRef = React.useRef(config);
|
|
300
|
+
var tokenRef = React.useRef(token);
|
|
301
|
+
var joinedOnFirstRender = React.useRef(false);
|
|
302
|
+
var reinitialiseMeetingOnConfigChange = React.useMemo(function () {
|
|
303
|
+
return _reinitialiseMeetingOnConfigChange;
|
|
304
|
+
}, []);
|
|
267
305
|
React.useEffect(function () {
|
|
268
306
|
meetingRef.current = meeting;
|
|
269
307
|
}, [meeting]);
|
|
@@ -279,6 +317,12 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
279
317
|
React.useEffect(function () {
|
|
280
318
|
isRecordingRef.current = isRecording;
|
|
281
319
|
}, [isRecording]);
|
|
320
|
+
React.useEffect(function () {
|
|
321
|
+
configRef.current = config;
|
|
322
|
+
}, [config]);
|
|
323
|
+
React.useEffect(function () {
|
|
324
|
+
tokenRef.current = token;
|
|
325
|
+
}, [token]);
|
|
282
326
|
|
|
283
327
|
var resetStates = function resetStates() {
|
|
284
328
|
setMeeting(null);
|
|
@@ -294,6 +338,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
294
338
|
setIsLiveStreaming(false);
|
|
295
339
|
setParticipants(new Map());
|
|
296
340
|
setPinnedParticipants(new Map());
|
|
341
|
+
setConnections(new Map());
|
|
297
342
|
};
|
|
298
343
|
|
|
299
344
|
var _handle_participant_joined = function _handle_participant_joined(participant) {
|
|
@@ -404,6 +449,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
404
449
|
};
|
|
405
450
|
|
|
406
451
|
var _handle_meeting_joined = function _handle_meeting_joined(data) {
|
|
452
|
+
joinedOnFirstRender.current = true;
|
|
453
|
+
setMessages(function (s) {
|
|
454
|
+
return [].concat(s, data.messages);
|
|
455
|
+
});
|
|
407
456
|
eventEmitter.emit(events['meeting-joined'], data);
|
|
408
457
|
};
|
|
409
458
|
|
|
@@ -433,6 +482,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
433
482
|
meeting.off('video-seeked', _handle_video_seeked);
|
|
434
483
|
meeting.off('webcam-requested', _handle_webcam_requested);
|
|
435
484
|
meeting.off('mic-requested', _handle_mic_requested);
|
|
485
|
+
meeting.off('pin-state-changed', _handle_pin_state_changed);
|
|
486
|
+
meeting.off('connection-open', _handle_connection_open);
|
|
487
|
+
meeting.off('connection-close', _handle_connection_close);
|
|
488
|
+
meeting.off('switch-meeting', _handle_switch_meeting);
|
|
436
489
|
}
|
|
437
490
|
|
|
438
491
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : (_meeting$localPartici = meeting.localParticipant) === null || _meeting$localPartici === void 0 ? void 0 : _meeting$localPartici.off) === 'function') {
|
|
@@ -465,8 +518,30 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
465
518
|
});
|
|
466
519
|
};
|
|
467
520
|
|
|
521
|
+
var _handle_connection_open = function _handle_connection_open(connection) {
|
|
522
|
+
setConnections(function (s) {
|
|
523
|
+
s.set(connection.id, connection);
|
|
524
|
+
var connectionsToSet = new Map(s);
|
|
525
|
+
return connectionsToSet;
|
|
526
|
+
});
|
|
527
|
+
eventEmitter.emit(events['connection-open'], connection);
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
var _handle_connection_close = function _handle_connection_close(connectionId) {
|
|
531
|
+
setConnections(function (s) {
|
|
532
|
+
s["delete"](connectionId);
|
|
533
|
+
var newConnections = new Map(s);
|
|
534
|
+
return newConnections;
|
|
535
|
+
});
|
|
536
|
+
eventEmitter.emit(events['connection-close'], connectionId);
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
var _handle_switch_meeting = function _handle_switch_meeting(d) {
|
|
540
|
+
eventEmitter.emit(events['switch-meeting'], d);
|
|
541
|
+
};
|
|
542
|
+
|
|
468
543
|
var join = function join() {
|
|
469
|
-
var meeting = jsSdk.
|
|
544
|
+
var meeting = jsSdk.VideoSDK && jsSdk.VideoSDK.initMeeting(configRef.current);
|
|
470
545
|
setMeeting(meeting);
|
|
471
546
|
var localParticipant = meeting.localParticipant,
|
|
472
547
|
participants = meeting.participants;
|
|
@@ -492,6 +567,9 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
492
567
|
meeting.on('webcam-requested', _handle_webcam_requested);
|
|
493
568
|
meeting.on('mic-requested', _handle_mic_requested);
|
|
494
569
|
meeting.on('pin-state-changed', _handle_pin_state_changed);
|
|
570
|
+
meeting.on('connection-open', _handle_connection_open);
|
|
571
|
+
meeting.on('connection-close', _handle_connection_close);
|
|
572
|
+
meeting.on('switch-meeting', _handle_switch_meeting);
|
|
495
573
|
meeting.localParticipant.on('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
496
574
|
meeting.localParticipant.on('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
497
575
|
meeting.join();
|
|
@@ -513,11 +591,11 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
513
591
|
}
|
|
514
592
|
};
|
|
515
593
|
|
|
516
|
-
var startRecording = function startRecording(webhookUrl) {
|
|
594
|
+
var startRecording = function startRecording(webhookUrl, awsDirPath) {
|
|
517
595
|
var meeting = meetingRef.current;
|
|
518
596
|
|
|
519
597
|
if (meeting) {
|
|
520
|
-
meeting.startRecording(webhookUrl);
|
|
598
|
+
meeting.startRecording(webhookUrl, awsDirPath);
|
|
521
599
|
}
|
|
522
600
|
};
|
|
523
601
|
|
|
@@ -734,8 +812,30 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
734
812
|
}
|
|
735
813
|
};
|
|
736
814
|
|
|
815
|
+
var connectTo = function connectTo(_ref6) {
|
|
816
|
+
var meetingId = _ref6.meetingId,
|
|
817
|
+
payload = _ref6.payload;
|
|
818
|
+
|
|
819
|
+
try {
|
|
820
|
+
var _meeting3 = meetingRef.current;
|
|
821
|
+
|
|
822
|
+
var _temp2 = function () {
|
|
823
|
+
if (_meeting3) {
|
|
824
|
+
return Promise.resolve(_meeting3.connectTo({
|
|
825
|
+
meetingId: meetingId,
|
|
826
|
+
payload: payload
|
|
827
|
+
})).then(function () {});
|
|
828
|
+
}
|
|
829
|
+
}();
|
|
830
|
+
|
|
831
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
832
|
+
} catch (e) {
|
|
833
|
+
return Promise.reject(e);
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
|
|
737
837
|
var initSDK = function initSDK() {
|
|
738
|
-
jsSdk.
|
|
838
|
+
jsSdk.VideoSDK.config(tokenRef.current);
|
|
739
839
|
|
|
740
840
|
if (joinWithoutUserInteraction) {
|
|
741
841
|
join();
|
|
@@ -745,9 +845,16 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
745
845
|
React.useEffect(function () {
|
|
746
846
|
initSDK();
|
|
747
847
|
}, []);
|
|
848
|
+
React.useEffect(function () {
|
|
849
|
+
if (reinitialiseMeetingOnConfigChange && joinedOnFirstRender.current) {
|
|
850
|
+
leave();
|
|
851
|
+
initSDK();
|
|
852
|
+
!joinWithoutUserInteraction && join();
|
|
853
|
+
}
|
|
854
|
+
}, [config.meetingId, token, reinitialiseMeetingOnConfigChange]);
|
|
748
855
|
return /*#__PURE__*/React__default.createElement(MeetingProviderContex.Provider, {
|
|
749
856
|
value: {
|
|
750
|
-
meetingId:
|
|
857
|
+
meetingId: meeting === null || meeting === void 0 ? void 0 : meeting.id,
|
|
751
858
|
meeting: meeting,
|
|
752
859
|
localParticipant: localParticipant,
|
|
753
860
|
mainParticipant: mainParticipant,
|
|
@@ -761,6 +868,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
761
868
|
isRecording: isRecording,
|
|
762
869
|
isLiveStreaming: isLiveStreaming,
|
|
763
870
|
pinnedParticipants: pinnedParticipants,
|
|
871
|
+
connections: connections,
|
|
764
872
|
join: join,
|
|
765
873
|
leave: leave,
|
|
766
874
|
end: end,
|
|
@@ -787,7 +895,8 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
787
895
|
pauseVideo: pauseVideo,
|
|
788
896
|
seekVideo: seekVideo,
|
|
789
897
|
startLivestream: startLivestream,
|
|
790
|
-
stopLivestream: stopLivestream
|
|
898
|
+
stopLivestream: stopLivestream,
|
|
899
|
+
connectTo: connectTo
|
|
791
900
|
}
|
|
792
901
|
}, children);
|
|
793
902
|
};
|
|
@@ -914,6 +1023,10 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
914
1023
|
participant === null || participant === void 0 ? void 0 : participant.unpin(data);
|
|
915
1024
|
};
|
|
916
1025
|
|
|
1026
|
+
var switchTo = function switchTo(data) {
|
|
1027
|
+
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.switchTo(data)).then(function () {});
|
|
1028
|
+
};
|
|
1029
|
+
|
|
917
1030
|
React.useEffect(function () {
|
|
918
1031
|
var streams = participant === null || participant === void 0 ? void 0 : participant.streams;
|
|
919
1032
|
|
|
@@ -949,12 +1062,96 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
949
1062
|
enableWebcam: enableWebcam,
|
|
950
1063
|
disableWebcam: disableWebcam,
|
|
951
1064
|
pin: pin,
|
|
952
|
-
unpin: unpin
|
|
1065
|
+
unpin: unpin,
|
|
1066
|
+
switchTo: switchTo
|
|
1067
|
+
};
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
var useConnection = function useConnection(connectionId, _temp) {
|
|
1071
|
+
var _ref = _temp === void 0 ? {
|
|
1072
|
+
onMeeting: {
|
|
1073
|
+
onParticipantJoined: function onParticipantJoined() {},
|
|
1074
|
+
onParticipantLeft: function onParticipantLeft() {},
|
|
1075
|
+
onChatMessage: function onChatMessage() {}
|
|
1076
|
+
}
|
|
1077
|
+
} : _temp,
|
|
1078
|
+
onMeeting = _ref.onMeeting;
|
|
1079
|
+
|
|
1080
|
+
var onParticipantJoined = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantJoined;
|
|
1081
|
+
var onParticipantLeft = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantLeft;
|
|
1082
|
+
var onChatMessage = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onChatMessage;
|
|
1083
|
+
var meeting = useMeeting();
|
|
1084
|
+
|
|
1085
|
+
var _useMemo = React.useMemo(function () {
|
|
1086
|
+
var connection = meeting === null || meeting === void 0 ? void 0 : meeting.connections.get(connectionId);
|
|
1087
|
+
|
|
1088
|
+
if (!connection) {
|
|
1089
|
+
throw new Error('connectionId not found');
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
var connectionParticipants = new Map(connection.meeting.participants);
|
|
1093
|
+
return {
|
|
1094
|
+
connection: connection,
|
|
1095
|
+
connectionParticipants: connectionParticipants
|
|
1096
|
+
};
|
|
1097
|
+
}, [meeting]),
|
|
1098
|
+
connection = _useMemo.connection,
|
|
1099
|
+
connectionParticipants = _useMemo.connectionParticipants;
|
|
1100
|
+
|
|
1101
|
+
var _useState = React.useState(new Map(connectionParticipants)),
|
|
1102
|
+
_connectionParticipants = _useState[0],
|
|
1103
|
+
setConnectionParticipants = _useState[1];
|
|
1104
|
+
|
|
1105
|
+
var _handleParticipantJoined = function _handleParticipantJoined(participant) {
|
|
1106
|
+
setConnectionParticipants(function (s) {
|
|
1107
|
+
s.set(participant.id, participant);
|
|
1108
|
+
var participantsToSet = new Map(s);
|
|
1109
|
+
return participantsToSet;
|
|
1110
|
+
});
|
|
1111
|
+
onParticipantJoined(participant);
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
var _handleParticipantLeft = function _handleParticipantLeft(participantId) {
|
|
1115
|
+
setConnectionParticipants(function (s) {
|
|
1116
|
+
s["delete"](participantId);
|
|
1117
|
+
var newParticipants = new Map(s);
|
|
1118
|
+
return newParticipants;
|
|
1119
|
+
});
|
|
1120
|
+
onParticipantLeft(participantId);
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
var _handleChatMessage = function _handleChatMessage(data) {
|
|
1124
|
+
onChatMessage(data);
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
React.useEffect(function () {
|
|
1128
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-joined', _handleParticipantJoined);
|
|
1129
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-left', _handleParticipantLeft);
|
|
1130
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.on('chat-message', _handleChatMessage);
|
|
1131
|
+
return function () {
|
|
1132
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.off('participant-joined', _handleParticipantJoined);
|
|
1133
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.off('participant-left', _handleParticipantLeft);
|
|
1134
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.off('chat-message', _handleChatMessage);
|
|
1135
|
+
};
|
|
1136
|
+
}, [connection]);
|
|
1137
|
+
return {
|
|
1138
|
+
connection: {
|
|
1139
|
+
id: connection.id,
|
|
1140
|
+
close: connection.close,
|
|
1141
|
+
payload: connection.payload,
|
|
1142
|
+
meeting: {
|
|
1143
|
+
id: connection.meeting.id,
|
|
1144
|
+
sendChatMessage: connection.meeting.sendChatMessage,
|
|
1145
|
+
end: connection.meeting.end,
|
|
1146
|
+
participants: _connectionParticipants
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
953
1149
|
};
|
|
954
1150
|
};
|
|
955
1151
|
|
|
956
1152
|
exports.MeetingConsumer = MeetingConsumer;
|
|
957
1153
|
exports.MeetingProvider = MeetingProvider;
|
|
1154
|
+
exports.useConnection = useConnection;
|
|
958
1155
|
exports.useMeeting = useMeeting;
|
|
959
1156
|
exports.useParticipant = useParticipant;
|
|
960
1157
|
//# sourceMappingURL=index.js.map
|