@videosdk.live/react-sdk 0.4.1 → 0.4.3
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 +119 -90
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +119 -90
- package/dist/index.modern.js.map +1 -1
- package/dist/types/connectionMeeting.d.ts +2 -2
- package/dist/types/index.d.ts +15 -12
- package/dist/types/meeting.d.ts +20 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var events = {
|
|
|
64
64
|
'entry-responded': eventPrifix + "-entry-responded",
|
|
65
65
|
'recording-started': eventPrifix + "-recording-started",
|
|
66
66
|
'recording-stopped': eventPrifix + "-recording-stopped",
|
|
67
|
-
|
|
67
|
+
data: eventPrifix + "-data",
|
|
68
68
|
'meeting-joined': eventPrifix + "-meeting-joined",
|
|
69
69
|
'meeting-left': eventPrifix + "-meeting-left",
|
|
70
70
|
'live-stream-started': eventPrifix + "-live-stream-started",
|
|
@@ -141,8 +141,8 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
141
141
|
onRecordingStarted = _ref$onRecordingStart === void 0 ? function () {} : _ref$onRecordingStart,
|
|
142
142
|
_ref$onRecordingStopp = _ref.onRecordingStopped,
|
|
143
143
|
onRecordingStopped = _ref$onRecordingStopp === void 0 ? function () {} : _ref$onRecordingStopp,
|
|
144
|
-
_ref$
|
|
145
|
-
|
|
144
|
+
_ref$onData = _ref.onData,
|
|
145
|
+
onData = _ref$onData === void 0 ? function () {} : _ref$onData,
|
|
146
146
|
_ref$onMeetingJoined = _ref.onMeetingJoined,
|
|
147
147
|
onMeetingJoined = _ref$onMeetingJoined === void 0 ? function () {} : _ref$onMeetingJoined,
|
|
148
148
|
_ref$onMeetingLeft = _ref.onMeetingLeft,
|
|
@@ -209,7 +209,7 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
209
209
|
eventEmitter.on(events['resumed-all-streams'], onResumedAllStreams);
|
|
210
210
|
eventEmitter.on(events['recording-started'], onRecordingStarted);
|
|
211
211
|
eventEmitter.on(events['recording-stopped'], onRecordingStopped);
|
|
212
|
-
eventEmitter.on(events['
|
|
212
|
+
eventEmitter.on(events['data'], onData);
|
|
213
213
|
eventEmitter.on(events['meeting-joined'], onMeetingJoined);
|
|
214
214
|
eventEmitter.on(events['meeting-left'], onMeetingLeft);
|
|
215
215
|
eventEmitter.on(events['live-stream-started'], onLiveStreamStarted);
|
|
@@ -250,7 +250,7 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
250
250
|
eventEmitter.off(events['resumed-all-streams'], onResumedAllStreams);
|
|
251
251
|
eventEmitter.off(events['recording-started'], onRecordingStarted);
|
|
252
252
|
eventEmitter.off(events['recording-stopped'], onRecordingStopped);
|
|
253
|
-
eventEmitter.off(events['
|
|
253
|
+
eventEmitter.off(events['data'], onData);
|
|
254
254
|
eventEmitter.off(events['meeting-joined'], onMeetingJoined);
|
|
255
255
|
eventEmitter.off(events['meeting-left'], onMeetingLeft);
|
|
256
256
|
eventEmitter.off(events['live-stream-started'], onLiveStreamStarted);
|
|
@@ -305,8 +305,8 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
305
305
|
onRecordingStarted = _ref2$onRecordingStar === void 0 ? function () {} : _ref2$onRecordingStar,
|
|
306
306
|
_ref2$onRecordingStop = _ref2.onRecordingStopped,
|
|
307
307
|
onRecordingStopped = _ref2$onRecordingStop === void 0 ? function () {} : _ref2$onRecordingStop,
|
|
308
|
-
_ref2$
|
|
309
|
-
|
|
308
|
+
_ref2$onData = _ref2.onData,
|
|
309
|
+
onData = _ref2$onData === void 0 ? function () {} : _ref2$onData,
|
|
310
310
|
_ref2$onMeetingJoined = _ref2.onMeetingJoined,
|
|
311
311
|
onMeetingJoined = _ref2$onMeetingJoined === void 0 ? function () {} : _ref2$onMeetingJoined,
|
|
312
312
|
_ref2$onMeetingLeft = _ref2.onMeetingLeft,
|
|
@@ -374,7 +374,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
374
374
|
eventEmitter.on(events['resumed-all-streams'], onResumedAllStreams);
|
|
375
375
|
eventEmitter.on(events['recording-started'], onRecordingStarted);
|
|
376
376
|
eventEmitter.on(events['recording-stopped'], onRecordingStopped);
|
|
377
|
-
eventEmitter.on(events['
|
|
377
|
+
eventEmitter.on(events['data'], onData);
|
|
378
378
|
eventEmitter.on(events['meeting-joined'], onMeetingJoined);
|
|
379
379
|
eventEmitter.on(events['meeting-left'], onMeetingLeft);
|
|
380
380
|
eventEmitter.on(events['live-stream-enabled'], onLiveStreamStarted);
|
|
@@ -414,7 +414,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
414
414
|
eventEmitter.off(events['resumed-all-streams'], onResumedAllStreams);
|
|
415
415
|
eventEmitter.off(events['recording-started'], onRecordingStarted);
|
|
416
416
|
eventEmitter.off(events['recording-stopped'], onRecordingStopped);
|
|
417
|
-
eventEmitter.off(events['
|
|
417
|
+
eventEmitter.off(events['data'], onData);
|
|
418
418
|
eventEmitter.off(events['meeting-joined'], onMeetingJoined);
|
|
419
419
|
eventEmitter.off(events['meeting-left'], onMeetingLeft);
|
|
420
420
|
eventEmitter.off(events['live-stream-enabled'], onLiveStreamStarted);
|
|
@@ -446,7 +446,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
446
446
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
-
var version = "0.4.
|
|
449
|
+
var version = "0.4.3";
|
|
450
450
|
|
|
451
451
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
452
452
|
var children = _ref.children,
|
|
@@ -483,49 +483,49 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
483
483
|
var _useState9 = React.useState(false),
|
|
484
484
|
isRecording = _useState9[0],
|
|
485
485
|
setIsRecording = _useState9[1];
|
|
486
|
-
var
|
|
487
|
-
messages =
|
|
488
|
-
setMessages =
|
|
486
|
+
var _useState0 = React.useState([]),
|
|
487
|
+
messages = _useState0[0],
|
|
488
|
+
setMessages = _useState0[1];
|
|
489
|
+
var _useState1 = React.useState(new Map()),
|
|
490
|
+
participants = _useState1[0],
|
|
491
|
+
setParticipants = _useState1[1];
|
|
492
|
+
var _useState10 = React.useState(new Map()),
|
|
493
|
+
characters = _useState10[0],
|
|
494
|
+
setCharacters = _useState10[1];
|
|
489
495
|
var _useState11 = React.useState(new Map()),
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
var _useState12 = React.useState(
|
|
493
|
-
|
|
494
|
-
|
|
496
|
+
pinnedParticipants = _useState11[0],
|
|
497
|
+
setPinnedParticipants = _useState11[1];
|
|
498
|
+
var _useState12 = React.useState(false),
|
|
499
|
+
isLiveStreaming = _useState12[0],
|
|
500
|
+
setIsLiveStreaming = _useState12[1];
|
|
495
501
|
var _useState13 = React.useState(new Map()),
|
|
496
|
-
|
|
497
|
-
|
|
502
|
+
connections = _useState13[0],
|
|
503
|
+
setConnections = _useState13[1];
|
|
498
504
|
var _useState14 = React.useState(false),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
var _useState15 = React.useState(
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
var _useState16 = React.useState(
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
var _useState17 = React.useState(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
var _useState18 = React.useState('
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
var _useState19 = React.useState(
|
|
514
|
-
livestreamState = _useState19[0],
|
|
515
|
-
setLivestreamState = _useState19[1];
|
|
516
|
-
var _useState20 = React.useState('HLS_STOPPED'),
|
|
517
|
-
hlsState = _useState20[0],
|
|
518
|
-
setHlsState = _useState20[1];
|
|
519
|
-
var _useState21 = React.useState({
|
|
505
|
+
isMeetingJoined = _useState14[0],
|
|
506
|
+
setIsMeetingJoined = _useState14[1];
|
|
507
|
+
var _useState15 = React.useState(false),
|
|
508
|
+
isHls = _useState15[0],
|
|
509
|
+
setIsHls = _useState15[1];
|
|
510
|
+
var _useState16 = React.useState('RECORDING_STOPPED'),
|
|
511
|
+
recordingState = _useState16[0],
|
|
512
|
+
setRecordingState = _useState16[1];
|
|
513
|
+
var _useState17 = React.useState('LIVESTREAM_STOPPED'),
|
|
514
|
+
livestreamState = _useState17[0],
|
|
515
|
+
setLivestreamState = _useState17[1];
|
|
516
|
+
var _useState18 = React.useState('HLS_STOPPED'),
|
|
517
|
+
hlsState = _useState18[0],
|
|
518
|
+
setHlsState = _useState18[1];
|
|
519
|
+
var _useState19 = React.useState({
|
|
520
520
|
downstreamUrl: null,
|
|
521
521
|
playbackHlsUrl: null,
|
|
522
522
|
livestreamUrl: null
|
|
523
523
|
}),
|
|
524
|
-
hlsUrls =
|
|
525
|
-
setHlsUrls =
|
|
526
|
-
var
|
|
527
|
-
transcriptionState =
|
|
528
|
-
setTranscriptionState =
|
|
524
|
+
hlsUrls = _useState19[0],
|
|
525
|
+
setHlsUrls = _useState19[1];
|
|
526
|
+
var _useState20 = React.useState('TRANSCRIPTION_STOPPED'),
|
|
527
|
+
transcriptionState = _useState20[0],
|
|
528
|
+
setTranscriptionState = _useState20[1];
|
|
529
529
|
var meetingRef = React.useRef();
|
|
530
530
|
var localMicOnRef = React.useRef();
|
|
531
531
|
var localWebcamOnRef = React.useRef();
|
|
@@ -625,7 +625,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
625
625
|
setMessages(function (s) {
|
|
626
626
|
return [].concat(s, [data]);
|
|
627
627
|
});
|
|
628
|
-
eventEmitter.emit(events['
|
|
628
|
+
eventEmitter.emit(events['data'], data);
|
|
629
629
|
};
|
|
630
630
|
var _handle_entry_requested = function _handle_entry_requested(data) {
|
|
631
631
|
eventEmitter.emit(events['entry-requested'], data);
|
|
@@ -714,7 +714,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
714
714
|
meeting.off('speaker-changed', _handle_speaker_changed);
|
|
715
715
|
meeting.off('entry-requested', _handle_entry_requested);
|
|
716
716
|
meeting.off('entry-responded', _handle_entry_responded);
|
|
717
|
-
meeting.off('
|
|
717
|
+
meeting.off('data', _handle_chat_message);
|
|
718
718
|
meeting.off('recording-started', _handle_recording_started);
|
|
719
719
|
meeting.off('recording-stopped', _handle_recording_stopped);
|
|
720
720
|
meeting.off('meeting-joined', _handle_meeting_joined);
|
|
@@ -741,8 +741,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
741
741
|
meeting.off('whiteboard-stopped', _handle_whiteboard_stopped);
|
|
742
742
|
meeting.off('whiteboard-started', _handle_whiteboard_started);
|
|
743
743
|
meeting.off('transcription-state-changed', _handle_transcription_state_changed);
|
|
744
|
+
meeting.off('transcription-text', _handle_transcription_text);
|
|
744
745
|
meeting.off('character-joined', _handle_character_joined);
|
|
745
746
|
meeting.off('character-left', _handle_character_left);
|
|
747
|
+
meeting.off('media-relay-started', _handle_media_relay_started);
|
|
748
|
+
meeting.off('media-relay-stopped', _handle_media_relay_stopped);
|
|
749
|
+
meeting.off('media-relay-error', _handle_media_relay_error);
|
|
750
|
+
meeting.off('media-relay-request-response', _handle_media_relay_request_response);
|
|
751
|
+
meeting.off('media-relay-request-received', _handle_media_relay_request_received);
|
|
746
752
|
}
|
|
747
753
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : (_meeting$localPartici = meeting.localParticipant) === null || _meeting$localPartici === void 0 ? void 0 : _meeting$localPartici.off) === 'function') {
|
|
748
754
|
meeting.localParticipant.off('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
@@ -911,7 +917,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
911
917
|
meeting.on('speaker-changed', _handle_speaker_changed);
|
|
912
918
|
meeting.on('entry-requested', _handle_entry_requested);
|
|
913
919
|
meeting.on('entry-responded', _handle_entry_responded);
|
|
914
|
-
meeting.on('
|
|
920
|
+
meeting.on('data', _handle_chat_message);
|
|
915
921
|
meeting.on('recording-started', _handle_recording_started);
|
|
916
922
|
meeting.on('recording-stopped', _handle_recording_stopped);
|
|
917
923
|
meeting.on('meeting-joined', _handle_meeting_joined);
|
|
@@ -1084,10 +1090,21 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1084
1090
|
meeting.changeMode(mode);
|
|
1085
1091
|
}
|
|
1086
1092
|
};
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1093
|
+
var send = function send(payload, options) {
|
|
1094
|
+
if (options === void 0) {
|
|
1095
|
+
options = {
|
|
1096
|
+
reliability: 'RELIABLE'
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
try {
|
|
1100
|
+
var _meeting = meetingRef.current;
|
|
1101
|
+
return Promise.resolve(function () {
|
|
1102
|
+
if (_meeting) {
|
|
1103
|
+
return Promise.resolve(_meeting.send(payload, options));
|
|
1104
|
+
}
|
|
1105
|
+
}());
|
|
1106
|
+
} catch (e) {
|
|
1107
|
+
return Promise.reject(e);
|
|
1091
1108
|
}
|
|
1092
1109
|
};
|
|
1093
1110
|
var respondEntry = function respondEntry(participantId, decision) {
|
|
@@ -1098,10 +1115,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1098
1115
|
};
|
|
1099
1116
|
var getMics = function getMics() {
|
|
1100
1117
|
try {
|
|
1101
|
-
var
|
|
1118
|
+
var _meeting2 = meetingRef.current;
|
|
1102
1119
|
return Promise.resolve(function () {
|
|
1103
|
-
if (
|
|
1104
|
-
return Promise.resolve(
|
|
1120
|
+
if (_meeting2) {
|
|
1121
|
+
return Promise.resolve(_meeting2.getMics());
|
|
1105
1122
|
}
|
|
1106
1123
|
}());
|
|
1107
1124
|
} catch (e) {
|
|
@@ -1110,10 +1127,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1110
1127
|
};
|
|
1111
1128
|
var getWebcams = function getWebcams() {
|
|
1112
1129
|
try {
|
|
1113
|
-
var
|
|
1130
|
+
var _meeting3 = meetingRef.current;
|
|
1114
1131
|
return Promise.resolve(function () {
|
|
1115
|
-
if (
|
|
1116
|
-
return Promise.resolve(
|
|
1132
|
+
if (_meeting3) {
|
|
1133
|
+
return Promise.resolve(_meeting3.getWebcams());
|
|
1117
1134
|
}
|
|
1118
1135
|
}());
|
|
1119
1136
|
} catch (e) {
|
|
@@ -1220,14 +1237,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1220
1237
|
meeting.stopLivestream();
|
|
1221
1238
|
}
|
|
1222
1239
|
};
|
|
1223
|
-
var connectTo = function connectTo(
|
|
1224
|
-
var meetingId =
|
|
1225
|
-
payload =
|
|
1240
|
+
var connectTo = function connectTo(_ref0) {
|
|
1241
|
+
var meetingId = _ref0.meetingId,
|
|
1242
|
+
payload = _ref0.payload;
|
|
1226
1243
|
try {
|
|
1227
|
-
var
|
|
1244
|
+
var _meeting4 = meetingRef.current;
|
|
1228
1245
|
var _temp = function () {
|
|
1229
|
-
if (
|
|
1230
|
-
return Promise.resolve(
|
|
1246
|
+
if (_meeting4) {
|
|
1247
|
+
return Promise.resolve(_meeting4.connectTo({
|
|
1231
1248
|
meetingId: meetingId,
|
|
1232
1249
|
payload: payload
|
|
1233
1250
|
})).then(function () {});
|
|
@@ -1310,7 +1327,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1310
1327
|
resumeAllStreams: resumeAllStreams,
|
|
1311
1328
|
startRecording: startRecording,
|
|
1312
1329
|
stopRecording: stopRecording,
|
|
1313
|
-
|
|
1330
|
+
send: send,
|
|
1314
1331
|
respondEntry: respondEntry,
|
|
1315
1332
|
muteMic: muteMic,
|
|
1316
1333
|
unmuteMic: unmuteMic,
|
|
@@ -1464,6 +1481,12 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1464
1481
|
setTrack(stream);
|
|
1465
1482
|
onStreamEnabled(stream);
|
|
1466
1483
|
};
|
|
1484
|
+
var _handleStreamPaused = function _handleStreamPaused(data) {
|
|
1485
|
+
onStreamPaused(data);
|
|
1486
|
+
};
|
|
1487
|
+
var _handleStreamResumed = function _handleStreamResumed(data) {
|
|
1488
|
+
onStreamResumed(data);
|
|
1489
|
+
};
|
|
1467
1490
|
var _handleParticipantModeChanged = function _handleParticipantModeChanged(data) {
|
|
1468
1491
|
if (participantId === data.participantId) {
|
|
1469
1492
|
setMode(data.mode);
|
|
@@ -1498,6 +1521,18 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1498
1521
|
newStatus: newStatus
|
|
1499
1522
|
});
|
|
1500
1523
|
};
|
|
1524
|
+
var _handleProducerAdded = function _handleProducerAdded(data) {
|
|
1525
|
+
onProducerAdded(data);
|
|
1526
|
+
};
|
|
1527
|
+
var _handleProducerRemoved = function _handleProducerRemoved(data) {
|
|
1528
|
+
onProducerRemoved(data);
|
|
1529
|
+
};
|
|
1530
|
+
var _handleConsumerAdded = function _handleConsumerAdded(data) {
|
|
1531
|
+
onConsumerAdded(data);
|
|
1532
|
+
};
|
|
1533
|
+
var _handleConsumerRemoved = function _handleConsumerRemoved(data) {
|
|
1534
|
+
onConsumerRemoved(data);
|
|
1535
|
+
};
|
|
1501
1536
|
var setQuality = function setQuality(quality) {
|
|
1502
1537
|
participant === null || participant === void 0 ? void 0 : participant.setQuality(quality);
|
|
1503
1538
|
};
|
|
@@ -1576,32 +1611,26 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1576
1611
|
}
|
|
1577
1612
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled);
|
|
1578
1613
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled);
|
|
1579
|
-
participant === null || participant === void 0 ? void 0 : participant.on('stream-paused',
|
|
1580
|
-
|
|
1581
|
-
});
|
|
1582
|
-
participant === null || participant === void 0 ? void 0 : participant.on('stream-resumed', function (data) {
|
|
1583
|
-
onStreamResumed(data);
|
|
1584
|
-
});
|
|
1614
|
+
participant === null || participant === void 0 ? void 0 : participant.on('stream-paused', _handleStreamPaused);
|
|
1615
|
+
participant === null || participant === void 0 ? void 0 : participant.on('stream-resumed', _handleStreamResumed);
|
|
1585
1616
|
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
|
|
1586
1617
|
participant === null || participant === void 0 ? void 0 : participant.on('video-quality-changed', _handleVideoQualityChanged);
|
|
1587
|
-
participant === null || participant === void 0 ? void 0 : participant.on('producer-added',
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
participant === null || participant === void 0 ? void 0 : participant.on('
|
|
1591
|
-
onProducerRemoved(data);
|
|
1592
|
-
});
|
|
1593
|
-
participant === null || participant === void 0 ? void 0 : participant.on('consumer-added', function (data) {
|
|
1594
|
-
onConsumerAdded(data);
|
|
1595
|
-
});
|
|
1596
|
-
participant === null || participant === void 0 ? void 0 : participant.on('consumer-removed', function (data) {
|
|
1597
|
-
onConsumerRemoved(data);
|
|
1598
|
-
});
|
|
1618
|
+
participant === null || participant === void 0 ? void 0 : participant.on('producer-added', _handleProducerAdded);
|
|
1619
|
+
participant === null || participant === void 0 ? void 0 : participant.on('producer-removed', _handleProducerRemoved);
|
|
1620
|
+
participant === null || participant === void 0 ? void 0 : participant.on('consumer-added', _handleConsumerAdded);
|
|
1621
|
+
participant === null || participant === void 0 ? void 0 : participant.on('consumer-removed', _handleConsumerRemoved);
|
|
1599
1622
|
eventEmitter.on(events['participant-mode-changed'], _handleParticipantModeChanged);
|
|
1600
1623
|
return function () {
|
|
1601
1624
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled);
|
|
1602
1625
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-disabled', _handleStreamDisabled);
|
|
1626
|
+
participant === null || participant === void 0 ? void 0 : participant.off('stream-paused', _handleStreamPaused);
|
|
1627
|
+
participant === null || participant === void 0 ? void 0 : participant.off('stream-resumed', _handleStreamResumed);
|
|
1603
1628
|
participant === null || participant === void 0 ? void 0 : participant.off('media-status-changed', _handleMediaStatusChanged);
|
|
1604
1629
|
participant === null || participant === void 0 ? void 0 : participant.off('video-quality-changed', _handleVideoQualityChanged);
|
|
1630
|
+
participant === null || participant === void 0 ? void 0 : participant.off('producer-added', _handleProducerAdded);
|
|
1631
|
+
participant === null || participant === void 0 ? void 0 : participant.off('producer-removed', _handleProducerRemoved);
|
|
1632
|
+
participant === null || participant === void 0 ? void 0 : participant.off('consumer-added', _handleConsumerAdded);
|
|
1633
|
+
participant === null || participant === void 0 ? void 0 : participant.off('consumer-removed', _handleConsumerRemoved);
|
|
1605
1634
|
eventEmitter.off(events['participant-mode-changed'], _handleParticipantModeChanged);
|
|
1606
1635
|
};
|
|
1607
1636
|
}, [participant]);
|
|
@@ -1648,13 +1677,13 @@ var useConnection = function useConnection(connectionId, _temp) {
|
|
|
1648
1677
|
onMeeting: {
|
|
1649
1678
|
onParticipantJoined: function onParticipantJoined() {},
|
|
1650
1679
|
onParticipantLeft: function onParticipantLeft() {},
|
|
1651
|
-
|
|
1680
|
+
onData: function onData() {}
|
|
1652
1681
|
}
|
|
1653
1682
|
} : _temp,
|
|
1654
1683
|
onMeeting = _ref.onMeeting;
|
|
1655
1684
|
var onParticipantJoined = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantJoined;
|
|
1656
1685
|
var onParticipantLeft = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantLeft;
|
|
1657
|
-
var
|
|
1686
|
+
var onData = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onData;
|
|
1658
1687
|
var meeting = useMeeting();
|
|
1659
1688
|
var _useMemo = React.useMemo(function () {
|
|
1660
1689
|
var connection = meeting === null || meeting === void 0 ? void 0 : meeting.connections.get(connectionId);
|
|
@@ -1689,16 +1718,16 @@ var useConnection = function useConnection(connectionId, _temp) {
|
|
|
1689
1718
|
onParticipantLeft(participantId);
|
|
1690
1719
|
};
|
|
1691
1720
|
var _handleChatMessage = function _handleChatMessage(data) {
|
|
1692
|
-
|
|
1721
|
+
onData(data);
|
|
1693
1722
|
};
|
|
1694
1723
|
React.useEffect(function () {
|
|
1695
1724
|
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-joined', _handleParticipantJoined);
|
|
1696
1725
|
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-left', _handleParticipantLeft);
|
|
1697
|
-
connection === null || connection === void 0 ? void 0 : connection.meeting.on('
|
|
1726
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.on('data', _handleChatMessage);
|
|
1698
1727
|
return function () {
|
|
1699
1728
|
connection === null || connection === void 0 ? void 0 : connection.meeting.off('participant-joined', _handleParticipantJoined);
|
|
1700
1729
|
connection === null || connection === void 0 ? void 0 : connection.meeting.off('participant-left', _handleParticipantLeft);
|
|
1701
|
-
connection === null || connection === void 0 ? void 0 : connection.meeting.off('
|
|
1730
|
+
connection === null || connection === void 0 ? void 0 : connection.meeting.off('data', _handleChatMessage);
|
|
1702
1731
|
};
|
|
1703
1732
|
}, [connection]);
|
|
1704
1733
|
return {
|
|
@@ -1731,7 +1760,7 @@ var usePubSub = function usePubSub(topic, _temp) {
|
|
|
1731
1760
|
var isSubscribed = React.useRef(false);
|
|
1732
1761
|
var publish = function publish(message, options, payload) {
|
|
1733
1762
|
if (meeting) {
|
|
1734
|
-
meeting.pubSub.publish(topic, message, options, payload);
|
|
1763
|
+
return meeting.pubSub.publish(topic, message, options, payload);
|
|
1735
1764
|
}
|
|
1736
1765
|
};
|
|
1737
1766
|
var _handlePubSub = function _handlePubSub(data) {
|