@videosdk.live/react-sdk 0.1.40 → 0.1.43
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 +91 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +91 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -30,7 +30,8 @@ var events = {
|
|
|
30
30
|
'hls-started': eventPrifix + "-hls-started",
|
|
31
31
|
'hls-stopped': eventPrifix + "-hls-stopped",
|
|
32
32
|
'recording-state-changed': eventPrifix + "-recording-state-changed",
|
|
33
|
-
'livestream-state-changed': eventPrifix + "-livestream-state-changed"
|
|
33
|
+
'livestream-state-changed': eventPrifix + "-livestream-state-changed",
|
|
34
|
+
'meeting-state-changed': eventPrifix + "-meeting-state-changed"
|
|
34
35
|
};
|
|
35
36
|
var eventEmitter = new EventEmitter();
|
|
36
37
|
eventEmitter.setMaxListeners(9999);
|
|
@@ -91,7 +92,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
91
92
|
_ref$onRecordingState = _ref.onRecordingStateChanged,
|
|
92
93
|
onRecordingStateChanged = _ref$onRecordingState === void 0 ? function () {} : _ref$onRecordingState,
|
|
93
94
|
_ref$onLivestreamStat = _ref.onLivestreamStateChanged,
|
|
94
|
-
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat
|
|
95
|
+
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat,
|
|
96
|
+
_ref$onMeetingStateCh = _ref.onMeetingStateChanged,
|
|
97
|
+
onMeetingStateChanged = _ref$onMeetingStateCh === void 0 ? function () {} : _ref$onMeetingStateCh;
|
|
95
98
|
|
|
96
99
|
useEffect(function () {
|
|
97
100
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
@@ -121,7 +124,9 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
121
124
|
eventEmitter.on(events['hls-stopped'], onHlsStopped);
|
|
122
125
|
eventEmitter.on(events['recording-state-changed'], onRecordingStateChanged);
|
|
123
126
|
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged);
|
|
127
|
+
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged);
|
|
124
128
|
return function () {
|
|
129
|
+
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged);
|
|
125
130
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
126
131
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
127
132
|
eventEmitter.off(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -208,8 +213,11 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
208
213
|
_ref2$onRecordingStat = _ref2.onRecordingStateChanged,
|
|
209
214
|
onRecordingStateChanged = _ref2$onRecordingStat === void 0 ? function () {} : _ref2$onRecordingStat,
|
|
210
215
|
_ref2$onLivestreamSta = _ref2.onLivestreamStateChanged,
|
|
211
|
-
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta
|
|
216
|
+
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta,
|
|
217
|
+
_ref2$onMeetingStateC = _ref2.onMeetingStateChanged,
|
|
218
|
+
onMeetingStateChanged = _ref2$onMeetingStateC === void 0 ? function () {} : _ref2$onMeetingStateC;
|
|
212
219
|
useEffect(function () {
|
|
220
|
+
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged);
|
|
213
221
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
214
222
|
eventEmitter.on(events['participant-left'], onParticipantLeft);
|
|
215
223
|
eventEmitter.on(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -238,6 +246,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
238
246
|
eventEmitter.on(events['recording-state-changed'], onRecordingStateChanged);
|
|
239
247
|
eventEmitter.on(events['livestream-state-changed'], onLivestreamStateChanged);
|
|
240
248
|
return function () {
|
|
249
|
+
eventEmitter.off(events['meeting-state-changed'], onMeetingStateChanged);
|
|
241
250
|
eventEmitter.off(events['participant-joined'], onParticipantJoined);
|
|
242
251
|
eventEmitter.off(events['participant-left'], onParticipantLeft);
|
|
243
252
|
eventEmitter.off(events['speaker-changed'], onSpeakerChanged);
|
|
@@ -270,7 +279,7 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
270
279
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MeetingProviderContex.Consumer, null, children));
|
|
271
280
|
};
|
|
272
281
|
|
|
273
|
-
var version = "0.1.
|
|
282
|
+
var version = "0.1.43";
|
|
274
283
|
|
|
275
284
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
276
285
|
var children = _ref.children,
|
|
@@ -544,6 +553,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
544
553
|
var _meeting$localPartici;
|
|
545
554
|
|
|
546
555
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') {
|
|
556
|
+
meeting.off('meeting-state-changed', _handle_meeting_state_changed);
|
|
547
557
|
meeting.off('participant-joined', _handle_participant_joined);
|
|
548
558
|
meeting.off('participant-left', _handle_participant_left);
|
|
549
559
|
meeting.off('presenter-changed', _handle_presenter_changed);
|
|
@@ -639,6 +649,10 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
639
649
|
eventEmitter.emit(events['livestream-state-changed'], data);
|
|
640
650
|
};
|
|
641
651
|
|
|
652
|
+
var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) {
|
|
653
|
+
eventEmitter.emit(events['meeting-state-changed'], data);
|
|
654
|
+
};
|
|
655
|
+
|
|
642
656
|
var join = function join() {
|
|
643
657
|
var meeting = VideoSDK && VideoSDK.initMeeting(configRef.current);
|
|
644
658
|
setMeeting(meeting);
|
|
@@ -647,6 +661,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
647
661
|
participants.set(localParticipant.id, localParticipant);
|
|
648
662
|
setParticipants(participants);
|
|
649
663
|
setLocalParticipant(localParticipant);
|
|
664
|
+
meeting.on('meeting-state-changed', _handle_meeting_state_changed);
|
|
650
665
|
meeting.on('participant-joined', _handle_participant_joined);
|
|
651
666
|
meeting.on('participant-left', _handle_participant_left);
|
|
652
667
|
meeting.on('presenter-changed', _handle_presenter_changed);
|
|
@@ -1066,7 +1081,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1066
1081
|
_ref$onStreamEnabled = _ref.onStreamEnabled,
|
|
1067
1082
|
onStreamEnabled = _ref$onStreamEnabled === void 0 ? function () {} : _ref$onStreamEnabled,
|
|
1068
1083
|
_ref$onStreamDisabled = _ref.onStreamDisabled,
|
|
1069
|
-
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled
|
|
1084
|
+
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled,
|
|
1085
|
+
_ref$onMediaStatusCha = _ref.onMediaStatusChanged,
|
|
1086
|
+
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha;
|
|
1070
1087
|
|
|
1071
1088
|
var _useState = useState(null),
|
|
1072
1089
|
webcamStream = _useState[0],
|
|
@@ -1109,6 +1126,14 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1109
1126
|
|
|
1110
1127
|
var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
|
|
1111
1128
|
|
|
1129
|
+
var _useState4 = useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
|
|
1130
|
+
webcamOn = _useState4[0],
|
|
1131
|
+
setWebcamOn = _useState4[1];
|
|
1132
|
+
|
|
1133
|
+
var _useState5 = useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
|
|
1134
|
+
micOn = _useState5[0],
|
|
1135
|
+
setMicOn = _useState5[1];
|
|
1136
|
+
|
|
1112
1137
|
var setTrack = function setTrack(stream) {
|
|
1113
1138
|
if (stream.track.readyState === 'live') {
|
|
1114
1139
|
switch (stream.kind) {
|
|
@@ -1155,6 +1180,24 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1155
1180
|
onStreamDisabled(stream);
|
|
1156
1181
|
};
|
|
1157
1182
|
|
|
1183
|
+
var _handleMediaStatusChanged = function _handleMediaStatusChanged(data) {
|
|
1184
|
+
var kind = data.kind,
|
|
1185
|
+
peerId = data.peerId,
|
|
1186
|
+
newStatus = data.newStatus;
|
|
1187
|
+
|
|
1188
|
+
if (kind == 'audio') {
|
|
1189
|
+
setMicOn(newStatus);
|
|
1190
|
+
} else if (kind == 'video') {
|
|
1191
|
+
setWebcamOn(newStatus);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
onMediaStatusChanged({
|
|
1195
|
+
kind: kind,
|
|
1196
|
+
peerId: peerId,
|
|
1197
|
+
newStatus: newStatus
|
|
1198
|
+
});
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1158
1201
|
var setQuality = function setQuality(quality) {
|
|
1159
1202
|
participant === null || participant === void 0 ? void 0 : participant.setQuality(quality);
|
|
1160
1203
|
};
|
|
@@ -1187,6 +1230,30 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1187
1230
|
participant === null || participant === void 0 ? void 0 : participant.unpin(data);
|
|
1188
1231
|
};
|
|
1189
1232
|
|
|
1233
|
+
var getAudioStats = function getAudioStats() {
|
|
1234
|
+
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats());
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1237
|
+
var getVideoStats = function getVideoStats() {
|
|
1238
|
+
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getVideoStats());
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
var consumeWebcamStreams = function consumeWebcamStreams() {
|
|
1242
|
+
participant === null || participant === void 0 ? void 0 : participant.consumeWebcamStreams();
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
var consumeMicStreams = function consumeMicStreams() {
|
|
1246
|
+
participant === null || participant === void 0 ? void 0 : participant.consumeMicStreams();
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
var stopConsumingWebcamStreams = function stopConsumingWebcamStreams() {
|
|
1250
|
+
participant === null || participant === void 0 ? void 0 : participant.stopConsumingWebcamStreams();
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
var stopConsumingMicStreams = function stopConsumingMicStreams() {
|
|
1254
|
+
participant === null || participant === void 0 ? void 0 : participant.stopConsumingMicStreams();
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1190
1257
|
var switchTo = function switchTo(data) {
|
|
1191
1258
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.switchTo(data)).then(function () {});
|
|
1192
1259
|
};
|
|
@@ -1200,11 +1267,21 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1200
1267
|
});
|
|
1201
1268
|
}
|
|
1202
1269
|
|
|
1270
|
+
if (participant !== null && participant !== void 0 && participant.micOn) {
|
|
1271
|
+
setMicOn(micOn);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
if (participant !== null && participant !== void 0 && participant.webcamOn) {
|
|
1275
|
+
setWebcamOn(webcamOn);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1203
1278
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled);
|
|
1204
1279
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled);
|
|
1280
|
+
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
|
|
1205
1281
|
return function () {
|
|
1206
1282
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-enabled', _handleStreamEnabled);
|
|
1207
1283
|
participant === null || participant === void 0 ? void 0 : participant.off('stream-disabled', _handleStreamDisabled);
|
|
1284
|
+
participant === null || participant === void 0 ? void 0 : participant.off('media-status-changed', _handleMediaStatusChanged);
|
|
1208
1285
|
};
|
|
1209
1286
|
}, [participant]);
|
|
1210
1287
|
return {
|
|
@@ -1213,13 +1290,17 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1213
1290
|
webcamStream: webcamStream,
|
|
1214
1291
|
micStream: micStream,
|
|
1215
1292
|
screenShareStream: screenShareStream,
|
|
1216
|
-
webcamOn:
|
|
1217
|
-
micOn:
|
|
1293
|
+
webcamOn: webcamOn,
|
|
1294
|
+
micOn: micOn,
|
|
1218
1295
|
screenShareOn: !!screenShareStream,
|
|
1219
1296
|
isLocal: (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.id) === participantId,
|
|
1220
1297
|
isActiveSpeaker: activeSpeakerId === participantId,
|
|
1221
1298
|
isMainParticipant: (mainParticipant === null || mainParticipant === void 0 ? void 0 : mainParticipant.id) === participantId,
|
|
1222
1299
|
pinState: pinState,
|
|
1300
|
+
consumeMicStreams: consumeMicStreams,
|
|
1301
|
+
consumeWebcamStreams: consumeWebcamStreams,
|
|
1302
|
+
stopConsumingMicStreams: stopConsumingMicStreams,
|
|
1303
|
+
stopConsumingWebcamStreams: stopConsumingWebcamStreams,
|
|
1223
1304
|
setQuality: setQuality,
|
|
1224
1305
|
setViewPort: setViewPort,
|
|
1225
1306
|
enableMic: enableMic,
|
|
@@ -1228,7 +1309,9 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1228
1309
|
disableWebcam: disableWebcam,
|
|
1229
1310
|
pin: pin,
|
|
1230
1311
|
unpin: unpin,
|
|
1231
|
-
switchTo: switchTo
|
|
1312
|
+
switchTo: switchTo,
|
|
1313
|
+
getAudioStats: getAudioStats,
|
|
1314
|
+
getVideoStats: getVideoStats
|
|
1232
1315
|
};
|
|
1233
1316
|
};
|
|
1234
1317
|
|