@videosdk.live/react-sdk 0.1.61 → 0.1.62
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 +480 -265
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +480 -265
- package/dist/index.modern.js.map +1 -1
- package/dist/types/participant/useParticipant.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -42,69 +42,69 @@ var eventEmitter = new EventEmitter();
|
|
|
42
42
|
eventEmitter.setMaxListeners(9999);
|
|
43
43
|
|
|
44
44
|
var MeetingProviderContex = React.createContext();
|
|
45
|
-
|
|
46
45
|
var useMeeting = function useMeeting(_temp) {
|
|
47
46
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
47
|
+
_ref$onParticipantJoi = _ref.onParticipantJoined,
|
|
48
|
+
onParticipantJoined = _ref$onParticipantJoi === void 0 ? function () {} : _ref$onParticipantJoi,
|
|
49
|
+
_ref$onParticipantLef = _ref.onParticipantLeft,
|
|
50
|
+
onParticipantLeft = _ref$onParticipantLef === void 0 ? function () {} : _ref$onParticipantLef,
|
|
51
|
+
_ref$onSpeakerChanged = _ref.onSpeakerChanged,
|
|
52
|
+
onSpeakerChanged = _ref$onSpeakerChanged === void 0 ? function () {} : _ref$onSpeakerChanged,
|
|
53
|
+
_ref$onPresenterChang = _ref.onPresenterChanged,
|
|
54
|
+
onPresenterChanged = _ref$onPresenterChang === void 0 ? function () {} : _ref$onPresenterChang,
|
|
55
|
+
_ref$onMainParticipan = _ref.onMainParticipantChanged,
|
|
56
|
+
onMainParticipantChanged = _ref$onMainParticipan === void 0 ? function () {} : _ref$onMainParticipan,
|
|
57
|
+
_ref$onEntryRequested = _ref.onEntryRequested,
|
|
58
|
+
onEntryRequested = _ref$onEntryRequested === void 0 ? function () {} : _ref$onEntryRequested,
|
|
59
|
+
_ref$onEntryResponded = _ref.onEntryResponded,
|
|
60
|
+
onEntryResponded = _ref$onEntryResponded === void 0 ? function () {} : _ref$onEntryResponded,
|
|
61
|
+
_ref$onRecordingStart = _ref.onRecordingStarted,
|
|
62
|
+
onRecordingStarted = _ref$onRecordingStart === void 0 ? function () {} : _ref$onRecordingStart,
|
|
63
|
+
_ref$onRecordingStopp = _ref.onRecordingStopped,
|
|
64
|
+
onRecordingStopped = _ref$onRecordingStopp === void 0 ? function () {} : _ref$onRecordingStopp,
|
|
65
|
+
_ref$onChatMessage = _ref.onChatMessage,
|
|
66
|
+
onChatMessage = _ref$onChatMessage === void 0 ? function () {} : _ref$onChatMessage,
|
|
67
|
+
_ref$onMeetingJoined = _ref.onMeetingJoined,
|
|
68
|
+
onMeetingJoined = _ref$onMeetingJoined === void 0 ? function () {} : _ref$onMeetingJoined,
|
|
69
|
+
_ref$onMeetingLeft = _ref.onMeetingLeft,
|
|
70
|
+
onMeetingLeft = _ref$onMeetingLeft === void 0 ? function () {} : _ref$onMeetingLeft,
|
|
71
|
+
_ref$onLiveStreamStar = _ref.onLiveStreamStarted,
|
|
72
|
+
onLiveStreamStarted = _ref$onLiveStreamStar === void 0 ? function () {} : _ref$onLiveStreamStar,
|
|
73
|
+
_ref$onLiveStreamStop = _ref.onLiveStreamStopped,
|
|
74
|
+
onLiveStreamStopped = _ref$onLiveStreamStop === void 0 ? function () {} : _ref$onLiveStreamStop,
|
|
75
|
+
_ref$onVideoStateChan = _ref.onVideoStateChanged,
|
|
76
|
+
onVideoStateChanged = _ref$onVideoStateChan === void 0 ? function () {} : _ref$onVideoStateChan,
|
|
77
|
+
_ref$onVideoSeeked = _ref.onVideoSeeked,
|
|
78
|
+
onVideoSeeked = _ref$onVideoSeeked === void 0 ? function () {} : _ref$onVideoSeeked,
|
|
79
|
+
_ref$onWebcamRequeste = _ref.onWebcamRequested,
|
|
80
|
+
onWebcamRequested = _ref$onWebcamRequeste === void 0 ? function () {} : _ref$onWebcamRequeste,
|
|
81
|
+
_ref$onMicRequested = _ref.onMicRequested,
|
|
82
|
+
onMicRequested = _ref$onMicRequested === void 0 ? function () {} : _ref$onMicRequested,
|
|
83
|
+
_ref$onPinStateChange = _ref.onPinStateChanged,
|
|
84
|
+
onPinStateChanged = _ref$onPinStateChange === void 0 ? function () {} : _ref$onPinStateChange,
|
|
85
|
+
_ref$onConnectionOpen = _ref.onConnectionOpen,
|
|
86
|
+
onConnectionOpen = _ref$onConnectionOpen === void 0 ? function () {} : _ref$onConnectionOpen,
|
|
87
|
+
_ref$onConnetionClose = _ref.onConnetionClose,
|
|
88
|
+
onConnetionClose = _ref$onConnetionClose === void 0 ? function () {} : _ref$onConnetionClose,
|
|
89
|
+
_ref$onSwitchMeeting = _ref.onSwitchMeeting,
|
|
90
|
+
onSwitchMeeting = _ref$onSwitchMeeting === void 0 ? function () {} : _ref$onSwitchMeeting,
|
|
91
|
+
_ref$onError = _ref.onError,
|
|
92
|
+
onError = _ref$onError === void 0 ? function () {} : _ref$onError,
|
|
93
|
+
_ref$onHlsStarted = _ref.onHlsStarted,
|
|
94
|
+
onHlsStarted = _ref$onHlsStarted === void 0 ? function () {} : _ref$onHlsStarted,
|
|
95
|
+
_ref$onHlsStopped = _ref.onHlsStopped,
|
|
96
|
+
onHlsStopped = _ref$onHlsStopped === void 0 ? function () {} : _ref$onHlsStopped,
|
|
97
|
+
_ref$onHlsStateChange = _ref.onHlsStateChanged,
|
|
98
|
+
onHlsStateChanged = _ref$onHlsStateChange === void 0 ? function () {} : _ref$onHlsStateChange,
|
|
99
|
+
_ref$onRecordingState = _ref.onRecordingStateChanged,
|
|
100
|
+
onRecordingStateChanged = _ref$onRecordingState === void 0 ? function () {} : _ref$onRecordingState,
|
|
101
|
+
_ref$onLivestreamStat = _ref.onLivestreamStateChanged,
|
|
102
|
+
onLivestreamStateChanged = _ref$onLivestreamStat === void 0 ? function () {} : _ref$onLivestreamStat,
|
|
103
|
+
_ref$onMeetingStateCh = _ref.onMeetingStateChanged,
|
|
104
|
+
onMeetingStateChanged = _ref$onMeetingStateCh === void 0 ? function () {} : _ref$onMeetingStateCh,
|
|
105
|
+
_ref$onParticipantMod = _ref.onParticipantModeChanged,
|
|
106
|
+
onParticipantModeChanged = _ref$onParticipantMod === void 0 ? function () {} : _ref$onParticipantMod;
|
|
107
|
+
|
|
108
108
|
React.useEffect(function () {
|
|
109
109
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
110
110
|
eventEmitter.on(events['participant-left'], onParticipantLeft);
|
|
@@ -173,66 +173,66 @@ var useMeeting = function useMeeting(_temp) {
|
|
|
173
173
|
};
|
|
174
174
|
var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
175
175
|
var children = _ref2.children,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
176
|
+
_ref2$onParticipantJo = _ref2.onParticipantJoined,
|
|
177
|
+
onParticipantJoined = _ref2$onParticipantJo === void 0 ? function () {} : _ref2$onParticipantJo,
|
|
178
|
+
_ref2$onParticipantLe = _ref2.onParticipantLeft,
|
|
179
|
+
onParticipantLeft = _ref2$onParticipantLe === void 0 ? function () {} : _ref2$onParticipantLe,
|
|
180
|
+
_ref2$onSpeakerChange = _ref2.onSpeakerChanged,
|
|
181
|
+
onSpeakerChanged = _ref2$onSpeakerChange === void 0 ? function () {} : _ref2$onSpeakerChange,
|
|
182
|
+
_ref2$onPresenterChan = _ref2.onPresenterChanged,
|
|
183
|
+
onPresenterChanged = _ref2$onPresenterChan === void 0 ? function () {} : _ref2$onPresenterChan,
|
|
184
|
+
_ref2$onMainParticipa = _ref2.onMainParticipantChanged,
|
|
185
|
+
onMainParticipantChanged = _ref2$onMainParticipa === void 0 ? function () {} : _ref2$onMainParticipa,
|
|
186
|
+
_ref2$onEntryRequeste = _ref2.onEntryRequested,
|
|
187
|
+
onEntryRequested = _ref2$onEntryRequeste === void 0 ? function () {} : _ref2$onEntryRequeste,
|
|
188
|
+
_ref2$onEntryResponde = _ref2.onEntryResponded,
|
|
189
|
+
onEntryResponded = _ref2$onEntryResponde === void 0 ? function () {} : _ref2$onEntryResponde,
|
|
190
|
+
_ref2$onRecordingStar = _ref2.onRecordingStarted,
|
|
191
|
+
onRecordingStarted = _ref2$onRecordingStar === void 0 ? function () {} : _ref2$onRecordingStar,
|
|
192
|
+
_ref2$onRecordingStop = _ref2.onRecordingStopped,
|
|
193
|
+
onRecordingStopped = _ref2$onRecordingStop === void 0 ? function () {} : _ref2$onRecordingStop,
|
|
194
|
+
_ref2$onChatMessage = _ref2.onChatMessage,
|
|
195
|
+
onChatMessage = _ref2$onChatMessage === void 0 ? function () {} : _ref2$onChatMessage,
|
|
196
|
+
_ref2$onMeetingJoined = _ref2.onMeetingJoined,
|
|
197
|
+
onMeetingJoined = _ref2$onMeetingJoined === void 0 ? function () {} : _ref2$onMeetingJoined,
|
|
198
|
+
_ref2$onMeetingLeft = _ref2.onMeetingLeft,
|
|
199
|
+
onMeetingLeft = _ref2$onMeetingLeft === void 0 ? function () {} : _ref2$onMeetingLeft,
|
|
200
|
+
_ref2$onLiveStreamSta = _ref2.onLiveStreamStarted,
|
|
201
|
+
onLiveStreamStarted = _ref2$onLiveStreamSta === void 0 ? function () {} : _ref2$onLiveStreamSta,
|
|
202
|
+
_ref2$onLiveStreamSto = _ref2.onLiveStreamStopped,
|
|
203
|
+
onLiveStreamStopped = _ref2$onLiveStreamSto === void 0 ? function () {} : _ref2$onLiveStreamSto,
|
|
204
|
+
_ref2$onVideoStateCha = _ref2.onVideoStateChanged,
|
|
205
|
+
onVideoStateChanged = _ref2$onVideoStateCha === void 0 ? function () {} : _ref2$onVideoStateCha,
|
|
206
|
+
_ref2$onVideoSeeked = _ref2.onVideoSeeked,
|
|
207
|
+
onVideoSeeked = _ref2$onVideoSeeked === void 0 ? function () {} : _ref2$onVideoSeeked,
|
|
208
|
+
_ref2$onWebcamRequest = _ref2.onWebcamRequested,
|
|
209
|
+
onWebcamRequested = _ref2$onWebcamRequest === void 0 ? function () {} : _ref2$onWebcamRequest,
|
|
210
|
+
_ref2$onMicRequested = _ref2.onMicRequested,
|
|
211
|
+
onMicRequested = _ref2$onMicRequested === void 0 ? function () {} : _ref2$onMicRequested,
|
|
212
|
+
_ref2$onPinStateChang = _ref2.onPinStateChanged,
|
|
213
|
+
onPinStateChanged = _ref2$onPinStateChang === void 0 ? function () {} : _ref2$onPinStateChang,
|
|
214
|
+
_ref2$onConnectionOpe = _ref2.onConnectionOpen,
|
|
215
|
+
onConnectionOpen = _ref2$onConnectionOpe === void 0 ? function () {} : _ref2$onConnectionOpe,
|
|
216
|
+
_ref2$onConnetionClos = _ref2.onConnetionClose,
|
|
217
|
+
onConnetionClose = _ref2$onConnetionClos === void 0 ? function () {} : _ref2$onConnetionClos,
|
|
218
|
+
_ref2$onSwitchMeeting = _ref2.onSwitchMeeting,
|
|
219
|
+
onSwitchMeeting = _ref2$onSwitchMeeting === void 0 ? function () {} : _ref2$onSwitchMeeting,
|
|
220
|
+
_ref2$onError = _ref2.onError,
|
|
221
|
+
onError = _ref2$onError === void 0 ? function () {} : _ref2$onError,
|
|
222
|
+
_ref2$onHlsStarted = _ref2.onHlsStarted,
|
|
223
|
+
onHlsStarted = _ref2$onHlsStarted === void 0 ? function () {} : _ref2$onHlsStarted,
|
|
224
|
+
_ref2$onHlsStopped = _ref2.onHlsStopped,
|
|
225
|
+
onHlsStopped = _ref2$onHlsStopped === void 0 ? function () {} : _ref2$onHlsStopped,
|
|
226
|
+
_ref2$onHlsStateChang = _ref2.onHlsStateChanged,
|
|
227
|
+
onHlsStateChanged = _ref2$onHlsStateChang === void 0 ? function () {} : _ref2$onHlsStateChang,
|
|
228
|
+
_ref2$onRecordingStat = _ref2.onRecordingStateChanged,
|
|
229
|
+
onRecordingStateChanged = _ref2$onRecordingStat === void 0 ? function () {} : _ref2$onRecordingStat,
|
|
230
|
+
_ref2$onLivestreamSta = _ref2.onLivestreamStateChanged,
|
|
231
|
+
onLivestreamStateChanged = _ref2$onLivestreamSta === void 0 ? function () {} : _ref2$onLivestreamSta,
|
|
232
|
+
_ref2$onMeetingStateC = _ref2.onMeetingStateChanged,
|
|
233
|
+
onMeetingStateChanged = _ref2$onMeetingStateC === void 0 ? function () {} : _ref2$onMeetingStateC,
|
|
234
|
+
_ref2$onParticipantMo = _ref2.onParticipantModeChanged,
|
|
235
|
+
onParticipantModeChanged = _ref2$onParticipantMo === void 0 ? function () {} : _ref2$onParticipantMo;
|
|
236
236
|
React.useEffect(function () {
|
|
237
237
|
eventEmitter.on(events['meeting-state-changed'], onMeetingStateChanged);
|
|
238
238
|
eventEmitter.on(events['participant-joined'], onParticipantJoined);
|
|
@@ -300,72 +300,92 @@ var MeetingConsumer = function MeetingConsumer(_ref2) {
|
|
|
300
300
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MeetingProviderContex.Consumer, null, children));
|
|
301
301
|
};
|
|
302
302
|
|
|
303
|
-
var version = "0.1.
|
|
303
|
+
var version = "0.1.62";
|
|
304
304
|
|
|
305
305
|
var MeetingProvider = function MeetingProvider(_ref) {
|
|
306
306
|
var children = _ref.children,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
config = _ref.config,
|
|
308
|
+
token = _ref.token,
|
|
309
|
+
joinWithoutUserInteraction = _ref.joinWithoutUserInteraction,
|
|
310
|
+
_reinitialiseMeetingOnConfigChange = _ref.reinitialiseMeetingOnConfigChange,
|
|
311
|
+
deviceInfo = _ref.deviceInfo;
|
|
312
|
+
|
|
312
313
|
var _useState = React.useState(null),
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
meeting = _useState[0],
|
|
315
|
+
setMeeting = _useState[1];
|
|
316
|
+
|
|
315
317
|
var _useState2 = React.useState(null),
|
|
316
|
-
|
|
317
|
-
|
|
318
|
+
localParticipant = _useState2[0],
|
|
319
|
+
setLocalParticipant = _useState2[1];
|
|
320
|
+
|
|
318
321
|
var _useState3 = React.useState(null),
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
mainParticipant = _useState3[0],
|
|
323
|
+
setMainParticipant = _useState3[1];
|
|
324
|
+
|
|
321
325
|
var _useState4 = React.useState(null),
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
activeSpeakerId = _useState4[0],
|
|
327
|
+
setActiveSpeakerId = _useState4[1];
|
|
328
|
+
|
|
324
329
|
var _useState5 = React.useState(null),
|
|
325
|
-
|
|
326
|
-
|
|
330
|
+
presenterId = _useState5[0],
|
|
331
|
+
setPresenterId = _useState5[1];
|
|
332
|
+
|
|
327
333
|
var _useState6 = React.useState(false),
|
|
328
|
-
|
|
329
|
-
|
|
334
|
+
localMicOn = _useState6[0],
|
|
335
|
+
setLocalMicOn = _useState6[1];
|
|
336
|
+
|
|
330
337
|
var _useState7 = React.useState(false),
|
|
331
|
-
|
|
332
|
-
|
|
338
|
+
localWebcamOn = _useState7[0],
|
|
339
|
+
setLocalWebcamOn = _useState7[1];
|
|
340
|
+
|
|
333
341
|
var _useState8 = React.useState(false),
|
|
334
|
-
|
|
335
|
-
|
|
342
|
+
localScreenShareOn = _useState8[0],
|
|
343
|
+
setLocalScreenShareOn = _useState8[1];
|
|
344
|
+
|
|
336
345
|
var _useState9 = React.useState(false),
|
|
337
|
-
|
|
338
|
-
|
|
346
|
+
isRecording = _useState9[0],
|
|
347
|
+
setIsRecording = _useState9[1];
|
|
348
|
+
|
|
339
349
|
var _useState10 = React.useState([]),
|
|
340
|
-
|
|
341
|
-
|
|
350
|
+
messages = _useState10[0],
|
|
351
|
+
setMessages = _useState10[1];
|
|
352
|
+
|
|
342
353
|
var _useState11 = React.useState(new Map()),
|
|
343
|
-
|
|
344
|
-
|
|
354
|
+
participants = _useState11[0],
|
|
355
|
+
setParticipants = _useState11[1];
|
|
356
|
+
|
|
345
357
|
var _useState12 = React.useState(new Map()),
|
|
346
|
-
|
|
347
|
-
|
|
358
|
+
pinnedParticipants = _useState12[0],
|
|
359
|
+
setPinnedParticipants = _useState12[1];
|
|
360
|
+
|
|
348
361
|
var _useState13 = React.useState(false),
|
|
349
|
-
|
|
350
|
-
|
|
362
|
+
isLiveStreaming = _useState13[0],
|
|
363
|
+
setIsLiveStreaming = _useState13[1];
|
|
364
|
+
|
|
351
365
|
var _useState14 = React.useState(new Map()),
|
|
352
|
-
|
|
353
|
-
|
|
366
|
+
connections = _useState14[0],
|
|
367
|
+
setConnections = _useState14[1];
|
|
368
|
+
|
|
354
369
|
var _useState15 = React.useState(false),
|
|
355
|
-
|
|
356
|
-
|
|
370
|
+
isMeetingJoined = _useState15[0],
|
|
371
|
+
setIsMeetingJoined = _useState15[1];
|
|
372
|
+
|
|
357
373
|
var _useState16 = React.useState(false),
|
|
358
|
-
|
|
359
|
-
|
|
374
|
+
isHls = _useState16[0],
|
|
375
|
+
setIsHls = _useState16[1];
|
|
376
|
+
|
|
360
377
|
var _useState17 = React.useState(null),
|
|
361
|
-
|
|
362
|
-
|
|
378
|
+
recordingState = _useState17[0],
|
|
379
|
+
setRecordingState = _useState17[1];
|
|
380
|
+
|
|
363
381
|
var _useState18 = React.useState(null),
|
|
364
|
-
|
|
365
|
-
|
|
382
|
+
livestreamState = _useState18[0],
|
|
383
|
+
setLivestreamState = _useState18[1];
|
|
384
|
+
|
|
366
385
|
var _useState19 = React.useState(null),
|
|
367
|
-
|
|
368
|
-
|
|
386
|
+
hlsState = _useState19[0],
|
|
387
|
+
setHlsState = _useState19[1];
|
|
388
|
+
|
|
369
389
|
var meetingRef = React.useRef();
|
|
370
390
|
var localMicOnRef = React.useRef();
|
|
371
391
|
var localWebcamOnRef = React.useRef();
|
|
@@ -402,6 +422,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
402
422
|
React.useEffect(function () {
|
|
403
423
|
isHlsRef.current = isHls;
|
|
404
424
|
}, [isHls]);
|
|
425
|
+
|
|
405
426
|
var resetStates = function resetStates() {
|
|
406
427
|
setMeeting(null);
|
|
407
428
|
setLocalParticipant(null);
|
|
@@ -423,6 +444,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
423
444
|
setLivestreamState(null);
|
|
424
445
|
setHlsState(null);
|
|
425
446
|
};
|
|
447
|
+
|
|
426
448
|
var _handle_participant_joined = function _handle_participant_joined(participant) {
|
|
427
449
|
setParticipants(function (participants) {
|
|
428
450
|
participants.set(participant.id, participant);
|
|
@@ -431,6 +453,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
431
453
|
});
|
|
432
454
|
eventEmitter.emit(events['participant-joined'], participant);
|
|
433
455
|
};
|
|
456
|
+
|
|
434
457
|
var _handle_participant_left = function _handle_participant_left(participant) {
|
|
435
458
|
setParticipants(function (participants) {
|
|
436
459
|
participants["delete"](participant.id);
|
|
@@ -439,40 +462,50 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
439
462
|
});
|
|
440
463
|
eventEmitter.emit(events['participant-left'], participant);
|
|
441
464
|
};
|
|
465
|
+
|
|
442
466
|
var _handle_presenter_changed = function _handle_presenter_changed(presenterId) {
|
|
443
467
|
var _meetingRef$current, _meetingRef$current$l;
|
|
468
|
+
|
|
444
469
|
setPresenterId(presenterId);
|
|
445
470
|
setLocalScreenShareOn(presenterId === (meetingRef === null || meetingRef === void 0 ? void 0 : (_meetingRef$current = meetingRef.current) === null || _meetingRef$current === void 0 ? void 0 : (_meetingRef$current$l = _meetingRef$current.localParticipant) === null || _meetingRef$current$l === void 0 ? void 0 : _meetingRef$current$l.id));
|
|
446
471
|
eventEmitter.emit(events['presenter-changed'], presenterId);
|
|
447
472
|
};
|
|
473
|
+
|
|
448
474
|
var _handle_main_participant_changed = function _handle_main_participant_changed(participant) {
|
|
449
475
|
setMainParticipant(participant);
|
|
450
476
|
eventEmitter.emit(events['main-participant-changed'], participant);
|
|
451
477
|
};
|
|
478
|
+
|
|
452
479
|
var _handle_speaker_changed = function _handle_speaker_changed(activeSpeakerId) {
|
|
453
480
|
setActiveSpeakerId(activeSpeakerId);
|
|
454
481
|
eventEmitter.emit(events['speaker-changed'], activeSpeakerId);
|
|
455
482
|
};
|
|
483
|
+
|
|
456
484
|
var _handle_chat_message = function _handle_chat_message(data) {
|
|
457
485
|
setMessages(function (s) {
|
|
458
486
|
return [].concat(s, [data]);
|
|
459
487
|
});
|
|
460
488
|
eventEmitter.emit(events['chat-message'], data);
|
|
461
489
|
};
|
|
490
|
+
|
|
462
491
|
var _handle_entry_requested = function _handle_entry_requested(data) {
|
|
463
492
|
eventEmitter.emit(events['entry-requested'], data);
|
|
464
493
|
};
|
|
494
|
+
|
|
465
495
|
var _handle_entry_responded = function _handle_entry_responded(participantId, decision) {
|
|
466
496
|
eventEmitter.emit(events['entry-responded'], participantId, decision);
|
|
467
497
|
};
|
|
498
|
+
|
|
468
499
|
var _handle_recording_started = function _handle_recording_started() {
|
|
469
500
|
setIsRecording(true);
|
|
470
501
|
eventEmitter.emit(events['recording-started']);
|
|
471
502
|
};
|
|
503
|
+
|
|
472
504
|
var _handle_recording_stopped = function _handle_recording_stopped() {
|
|
473
505
|
setIsRecording(false);
|
|
474
506
|
eventEmitter.emit(events['recording-stopped']);
|
|
475
507
|
};
|
|
508
|
+
|
|
476
509
|
var _handle_localParticipant_stream_enabled = function _handle_localParticipant_stream_enabled(stream) {
|
|
477
510
|
if (stream.track.readyState === 'live') {
|
|
478
511
|
if (stream.kind === 'video') {
|
|
@@ -482,6 +515,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
482
515
|
}
|
|
483
516
|
}
|
|
484
517
|
};
|
|
518
|
+
|
|
485
519
|
var _handle_localParticipant_stream_disabled = function _handle_localParticipant_stream_disabled(stream) {
|
|
486
520
|
if (stream.track.readyState === 'ended') {
|
|
487
521
|
if (stream.kind === 'video') {
|
|
@@ -491,34 +525,43 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
491
525
|
}
|
|
492
526
|
}
|
|
493
527
|
};
|
|
528
|
+
|
|
494
529
|
var _handle_live_stream_started = function _handle_live_stream_started(data) {
|
|
495
530
|
setIsLiveStreaming(true);
|
|
496
531
|
eventEmitter.emit(events['live-stream-started'], data);
|
|
497
532
|
};
|
|
533
|
+
|
|
498
534
|
var _handle_live_stream_stopped = function _handle_live_stream_stopped() {
|
|
499
535
|
setIsLiveStreaming(false);
|
|
500
536
|
eventEmitter.emit(events['live-stream-stopped']);
|
|
501
537
|
};
|
|
538
|
+
|
|
502
539
|
var _handle_hls_started = function _handle_hls_started(data) {
|
|
503
540
|
setIsHls(true);
|
|
504
541
|
eventEmitter.emit(events['hls-started'], data);
|
|
505
542
|
};
|
|
543
|
+
|
|
506
544
|
var _handle_hls_stopped = function _handle_hls_stopped() {
|
|
507
545
|
setIsHls(false);
|
|
508
546
|
eventEmitter.emit(events['hls-stopped']);
|
|
509
547
|
};
|
|
548
|
+
|
|
510
549
|
var _handle_video_state_changed = function _handle_video_state_changed(data) {
|
|
511
550
|
eventEmitter.emit(events['video-state-changed'], data);
|
|
512
551
|
};
|
|
552
|
+
|
|
513
553
|
var _handle_video_seeked = function _handle_video_seeked(data) {
|
|
514
554
|
eventEmitter.emit(events['video-seeked'], data);
|
|
515
555
|
};
|
|
556
|
+
|
|
516
557
|
var _handle_webcam_requested = function _handle_webcam_requested(data) {
|
|
517
558
|
eventEmitter.emit(events['webcam-requested'], data);
|
|
518
559
|
};
|
|
560
|
+
|
|
519
561
|
var _handle_mic_requested = function _handle_mic_requested(data) {
|
|
520
562
|
eventEmitter.emit(events['mic-requested'], data);
|
|
521
563
|
};
|
|
564
|
+
|
|
522
565
|
var _handle_meeting_joined = function _handle_meeting_joined(data) {
|
|
523
566
|
joinedOnFirstRender.current = true;
|
|
524
567
|
setMessages(function (s) {
|
|
@@ -527,11 +570,14 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
527
570
|
eventEmitter.emit(events['meeting-joined'], data);
|
|
528
571
|
setIsMeetingJoined(true);
|
|
529
572
|
};
|
|
573
|
+
|
|
530
574
|
var _handle_meeting_left = function _handle_meeting_left() {
|
|
531
575
|
eventEmitter.emit(events['meeting-left']);
|
|
532
576
|
var meeting = meetingRef.current;
|
|
577
|
+
|
|
533
578
|
if (meeting) {
|
|
534
579
|
var _meeting$localPartici;
|
|
580
|
+
|
|
535
581
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : meeting.off) === 'function') {
|
|
536
582
|
meeting.off('meeting-state-changed', _handle_meeting_state_changed);
|
|
537
583
|
meeting.off('participant-joined', _handle_participant_joined);
|
|
@@ -564,23 +610,27 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
564
610
|
meeting.off('hls-state-changed', _handle_hls_state_changed);
|
|
565
611
|
meeting.off('participant-mode-changed', _handel_participant_mode_changed);
|
|
566
612
|
}
|
|
613
|
+
|
|
567
614
|
if (typeof (meeting === null || meeting === void 0 ? void 0 : (_meeting$localPartici = meeting.localParticipant) === null || _meeting$localPartici === void 0 ? void 0 : _meeting$localPartici.off) === 'function') {
|
|
568
615
|
meeting.localParticipant.off('stream-enabled', _handle_localParticipant_stream_enabled);
|
|
569
616
|
meeting.localParticipant.off('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
570
617
|
}
|
|
618
|
+
|
|
571
619
|
resetStates();
|
|
572
620
|
}
|
|
573
621
|
};
|
|
622
|
+
|
|
574
623
|
var _handle_pin_state_changed = function _handle_pin_state_changed(_ref2) {
|
|
575
624
|
var participantId = _ref2.participantId,
|
|
576
|
-
|
|
577
|
-
|
|
625
|
+
state = _ref2.state,
|
|
626
|
+
pinnedBy = _ref2.pinnedBy;
|
|
578
627
|
setPinnedParticipants(function (pinnedParticipants) {
|
|
579
628
|
if (!state.cam && !state.share) {
|
|
580
629
|
pinnedParticipants["delete"](participantId);
|
|
581
630
|
} else {
|
|
582
631
|
pinnedParticipants.set(participantId, state);
|
|
583
632
|
}
|
|
633
|
+
|
|
584
634
|
var pinnedParticipantsToSet = new Map(pinnedParticipants);
|
|
585
635
|
return pinnedParticipantsToSet;
|
|
586
636
|
});
|
|
@@ -590,6 +640,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
590
640
|
pinnedBy: pinnedBy
|
|
591
641
|
});
|
|
592
642
|
};
|
|
643
|
+
|
|
593
644
|
var _handle_connection_open = function _handle_connection_open(connection) {
|
|
594
645
|
setConnections(function (s) {
|
|
595
646
|
s.set(connection.id, connection);
|
|
@@ -598,6 +649,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
598
649
|
});
|
|
599
650
|
eventEmitter.emit(events['connection-open'], connection);
|
|
600
651
|
};
|
|
652
|
+
|
|
601
653
|
var _handle_connection_close = function _handle_connection_close(connectionId) {
|
|
602
654
|
setConnections(function (s) {
|
|
603
655
|
s["delete"](connectionId);
|
|
@@ -606,29 +658,37 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
606
658
|
});
|
|
607
659
|
eventEmitter.emit(events['connection-close'], connectionId);
|
|
608
660
|
};
|
|
661
|
+
|
|
609
662
|
var _handle_switch_meeting = function _handle_switch_meeting(d) {
|
|
610
663
|
eventEmitter.emit(events['switch-meeting'], d);
|
|
611
664
|
};
|
|
665
|
+
|
|
612
666
|
var _handle_error = function _handle_error(data) {
|
|
613
667
|
eventEmitter.emit(events['error'], data);
|
|
614
668
|
};
|
|
669
|
+
|
|
615
670
|
var _handle_recording_state_changed = function _handle_recording_state_changed(data) {
|
|
616
671
|
setRecordingState(data === null || data === void 0 ? void 0 : data.status);
|
|
617
672
|
eventEmitter.emit(events['recording-state-changed'], data);
|
|
618
673
|
};
|
|
674
|
+
|
|
619
675
|
var _handle_livestream_state_changed = function _handle_livestream_state_changed(data) {
|
|
620
676
|
setLivestreamState(data === null || data === void 0 ? void 0 : data.status);
|
|
621
677
|
eventEmitter.emit(events['livestream-state-changed'], data);
|
|
622
678
|
};
|
|
679
|
+
|
|
623
680
|
var _handle_hls_state_changed = function _handle_hls_state_changed(data) {
|
|
624
681
|
setHlsState(data === null || data === void 0 ? void 0 : data.status);
|
|
625
682
|
eventEmitter.emit(events['hls-state-changed'], data);
|
|
626
683
|
};
|
|
684
|
+
|
|
627
685
|
var _handle_meeting_state_changed = function _handle_meeting_state_changed(data) {
|
|
628
686
|
eventEmitter.emit(events['meeting-state-changed'], data);
|
|
629
687
|
};
|
|
688
|
+
|
|
630
689
|
var _handel_participant_mode_changed = function _handel_participant_mode_changed(data) {
|
|
631
690
|
var _meetingRef$current2, _meetingRef$current2$;
|
|
691
|
+
|
|
632
692
|
setParticipants(function (participants) {
|
|
633
693
|
var part = participants.get(data.participantId);
|
|
634
694
|
part.mode = data.mode;
|
|
@@ -642,13 +702,15 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
642
702
|
return participant;
|
|
643
703
|
});
|
|
644
704
|
}
|
|
705
|
+
|
|
645
706
|
eventEmitter.emit(events['participant-mode-changed'], data);
|
|
646
707
|
};
|
|
708
|
+
|
|
647
709
|
var join = function join() {
|
|
648
710
|
var meeting = jsSdk.VideoSDK && jsSdk.VideoSDK.initMeeting(configRef.current);
|
|
649
711
|
setMeeting(meeting);
|
|
650
712
|
var localParticipant = meeting.localParticipant,
|
|
651
|
-
|
|
713
|
+
participants = meeting.participants;
|
|
652
714
|
participants.set(localParticipant.id, localParticipant);
|
|
653
715
|
setParticipants(participants);
|
|
654
716
|
setLocalParticipant(localParticipant);
|
|
@@ -686,129 +748,169 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
686
748
|
meeting.localParticipant.on('stream-disabled', _handle_localParticipant_stream_disabled);
|
|
687
749
|
meeting.join();
|
|
688
750
|
};
|
|
751
|
+
|
|
689
752
|
var leave = function leave() {
|
|
690
753
|
var meeting = meetingRef.current;
|
|
754
|
+
|
|
691
755
|
if (meeting) {
|
|
692
756
|
meeting.leave();
|
|
693
757
|
}
|
|
694
758
|
};
|
|
759
|
+
|
|
695
760
|
var end = function end() {
|
|
696
761
|
var meeting = meetingRef.current;
|
|
762
|
+
|
|
697
763
|
if (meeting) {
|
|
698
764
|
meeting.end();
|
|
699
765
|
}
|
|
700
766
|
};
|
|
767
|
+
|
|
701
768
|
var startRecording = function startRecording(webhookUrl, awsDirPath, config) {
|
|
702
769
|
var meeting = meetingRef.current;
|
|
770
|
+
|
|
703
771
|
if (meeting) {
|
|
704
772
|
meeting.startRecording(webhookUrl, awsDirPath, config);
|
|
705
773
|
}
|
|
706
774
|
};
|
|
775
|
+
|
|
707
776
|
var stopRecording = function stopRecording() {
|
|
708
777
|
var meeting = meetingRef.current;
|
|
778
|
+
|
|
709
779
|
if (meeting) {
|
|
710
780
|
var _isRecording = isRecordingRef.current;
|
|
781
|
+
|
|
711
782
|
if (_isRecording) {
|
|
712
783
|
meeting.stopRecording();
|
|
713
784
|
}
|
|
714
785
|
}
|
|
715
786
|
};
|
|
787
|
+
|
|
716
788
|
var unmuteMic = function unmuteMic(customAudioTrack) {
|
|
717
789
|
if (customAudioTrack === void 0) {
|
|
718
790
|
customAudioTrack = undefined;
|
|
719
791
|
}
|
|
792
|
+
|
|
720
793
|
var meeting = meetingRef.current;
|
|
794
|
+
|
|
721
795
|
if (meeting) {
|
|
722
796
|
meeting.unmuteMic(customAudioTrack);
|
|
723
797
|
}
|
|
724
798
|
};
|
|
799
|
+
|
|
725
800
|
var muteMic = function muteMic() {
|
|
726
801
|
var meeting = meetingRef.current;
|
|
802
|
+
|
|
727
803
|
if (meeting) {
|
|
728
804
|
meeting.muteMic();
|
|
729
805
|
}
|
|
730
806
|
};
|
|
807
|
+
|
|
731
808
|
var toggleMic = function toggleMic(customAudioTrack) {
|
|
732
809
|
if (customAudioTrack === void 0) {
|
|
733
810
|
customAudioTrack = undefined;
|
|
734
811
|
}
|
|
812
|
+
|
|
735
813
|
var localMicOn = localMicOnRef.current;
|
|
814
|
+
|
|
736
815
|
if (localMicOn) {
|
|
737
816
|
muteMic();
|
|
738
817
|
} else {
|
|
739
818
|
unmuteMic(customAudioTrack);
|
|
740
819
|
}
|
|
741
820
|
};
|
|
821
|
+
|
|
742
822
|
var disableWebcam = function disableWebcam() {
|
|
743
823
|
var meeting = meetingRef.current;
|
|
824
|
+
|
|
744
825
|
if (meeting) {
|
|
745
826
|
meeting.disableWebcam();
|
|
746
827
|
}
|
|
747
828
|
};
|
|
829
|
+
|
|
748
830
|
var enableWebcam = function enableWebcam(customVideoTrack) {
|
|
749
831
|
if (customVideoTrack === void 0) {
|
|
750
832
|
customVideoTrack = undefined;
|
|
751
833
|
}
|
|
834
|
+
|
|
752
835
|
var meeting = meetingRef.current;
|
|
836
|
+
|
|
753
837
|
if (meeting) {
|
|
754
838
|
meeting.enableWebcam(customVideoTrack);
|
|
755
839
|
}
|
|
756
840
|
};
|
|
841
|
+
|
|
757
842
|
var toggleWebcam = function toggleWebcam(customVideoTrack) {
|
|
758
843
|
if (customVideoTrack === void 0) {
|
|
759
844
|
customVideoTrack = undefined;
|
|
760
845
|
}
|
|
846
|
+
|
|
761
847
|
var localWebcamOn = localWebcamOnRef.current;
|
|
848
|
+
|
|
762
849
|
if (localWebcamOn) {
|
|
763
850
|
disableWebcam();
|
|
764
851
|
} else {
|
|
765
852
|
enableWebcam(customVideoTrack);
|
|
766
853
|
}
|
|
767
854
|
};
|
|
855
|
+
|
|
768
856
|
var disableScreenShare = function disableScreenShare() {
|
|
769
857
|
var meeting = meetingRef.current;
|
|
858
|
+
|
|
770
859
|
if (meeting) {
|
|
771
860
|
meeting.disableScreenShare();
|
|
772
861
|
}
|
|
773
862
|
};
|
|
863
|
+
|
|
774
864
|
var enableScreenShare = function enableScreenShare(customScreenShareTrack) {
|
|
775
865
|
if (customScreenShareTrack === void 0) {
|
|
776
866
|
customScreenShareTrack = undefined;
|
|
777
867
|
}
|
|
868
|
+
|
|
778
869
|
var meeting = meetingRef.current;
|
|
870
|
+
|
|
779
871
|
if (meeting) {
|
|
780
872
|
meeting.enableScreenShare(customScreenShareTrack);
|
|
781
873
|
}
|
|
782
874
|
};
|
|
875
|
+
|
|
783
876
|
var toggleScreenShare = function toggleScreenShare(customScreenShareTrack) {
|
|
784
877
|
if (customScreenShareTrack === void 0) {
|
|
785
878
|
customScreenShareTrack = undefined;
|
|
786
879
|
}
|
|
880
|
+
|
|
787
881
|
var localScreenShareOn = localScreenShareOnRef.current;
|
|
882
|
+
|
|
788
883
|
if (localScreenShareOn) {
|
|
789
884
|
disableScreenShare();
|
|
790
885
|
} else {
|
|
791
886
|
enableScreenShare(customScreenShareTrack);
|
|
792
887
|
}
|
|
793
888
|
};
|
|
889
|
+
|
|
794
890
|
var changeMode = function changeMode(mode) {
|
|
795
891
|
var meeting = meetingRef.current;
|
|
892
|
+
|
|
796
893
|
if (meeting) {
|
|
797
894
|
meeting.changeMode(mode);
|
|
798
895
|
}
|
|
799
896
|
};
|
|
897
|
+
|
|
800
898
|
var sendChatMessage = function sendChatMessage(text) {
|
|
801
899
|
var meeting = meetingRef.current;
|
|
900
|
+
|
|
802
901
|
if (meeting) {
|
|
803
902
|
meeting.sendChatMessage(text);
|
|
804
903
|
}
|
|
805
904
|
};
|
|
905
|
+
|
|
806
906
|
var respondEntry = function respondEntry(participantId, decision) {
|
|
807
907
|
var meeting = meetingRef.current;
|
|
908
|
+
|
|
808
909
|
if (meeting) {
|
|
809
910
|
meeting.respondEntry(participantId, decision);
|
|
810
911
|
}
|
|
811
912
|
};
|
|
913
|
+
|
|
812
914
|
var getMics = function getMics() {
|
|
813
915
|
try {
|
|
814
916
|
var _meeting = meetingRef.current;
|
|
@@ -821,6 +923,7 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
821
923
|
return Promise.reject(e);
|
|
822
924
|
}
|
|
823
925
|
};
|
|
926
|
+
|
|
824
927
|
var getWebcams = function getWebcams() {
|
|
825
928
|
try {
|
|
826
929
|
var _meeting2 = meetingRef.current;
|
|
@@ -833,74 +936,95 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
833
936
|
return Promise.reject(e);
|
|
834
937
|
}
|
|
835
938
|
};
|
|
939
|
+
|
|
836
940
|
var changeWebcam = function changeWebcam(obj) {
|
|
837
941
|
var meeting = meetingRef.current;
|
|
942
|
+
|
|
838
943
|
if (meeting) {
|
|
839
944
|
meeting.changeWebcam(obj);
|
|
840
945
|
}
|
|
841
946
|
};
|
|
947
|
+
|
|
842
948
|
var changeMic = function changeMic(obj) {
|
|
843
949
|
var meeting = meetingRef.current;
|
|
950
|
+
|
|
844
951
|
if (meeting) {
|
|
845
952
|
meeting.changeMic(obj);
|
|
846
953
|
}
|
|
847
954
|
};
|
|
955
|
+
|
|
848
956
|
var startVideo = function startVideo(_ref3) {
|
|
849
957
|
var link = _ref3.link;
|
|
850
958
|
var meeting = meetingRef.current;
|
|
959
|
+
|
|
851
960
|
if (meeting) {
|
|
852
961
|
meeting.startVideo({
|
|
853
962
|
link: link
|
|
854
963
|
});
|
|
855
964
|
}
|
|
856
965
|
};
|
|
966
|
+
|
|
857
967
|
var stopVideo = function stopVideo() {
|
|
858
968
|
var meeting = meetingRef.current;
|
|
969
|
+
|
|
859
970
|
if (meeting) {
|
|
860
971
|
meeting.stopVideo();
|
|
861
972
|
}
|
|
862
973
|
};
|
|
974
|
+
|
|
863
975
|
var resumeVideo = function resumeVideo() {
|
|
864
976
|
var meeting = meetingRef.current;
|
|
977
|
+
|
|
865
978
|
if (meeting) {
|
|
866
979
|
meeting.resumeVideo();
|
|
867
980
|
}
|
|
868
981
|
};
|
|
982
|
+
|
|
869
983
|
var pauseVideo = function pauseVideo(_ref4) {
|
|
870
984
|
var currentTime = _ref4.currentTime;
|
|
871
985
|
var meeting = meetingRef.current;
|
|
986
|
+
|
|
872
987
|
if (meeting) {
|
|
873
988
|
meeting.pauseVideo({
|
|
874
989
|
currentTime: currentTime
|
|
875
990
|
});
|
|
876
991
|
}
|
|
877
992
|
};
|
|
993
|
+
|
|
878
994
|
var seekVideo = function seekVideo(_ref5) {
|
|
879
995
|
var currentTime = _ref5.currentTime;
|
|
880
996
|
var meeting = meetingRef.current;
|
|
997
|
+
|
|
881
998
|
if (meeting) {
|
|
882
999
|
meeting.seekVideo({
|
|
883
1000
|
currentTime: currentTime
|
|
884
1001
|
});
|
|
885
1002
|
}
|
|
886
1003
|
};
|
|
1004
|
+
|
|
887
1005
|
var startLivestream = function startLivestream(streamInfo, config) {
|
|
888
1006
|
var meeting = meetingRef.current;
|
|
1007
|
+
|
|
889
1008
|
if (meeting) {
|
|
890
1009
|
meeting.startLivestream(streamInfo, config);
|
|
891
1010
|
}
|
|
892
1011
|
};
|
|
1012
|
+
|
|
893
1013
|
var stopLivestream = function stopLivestream() {
|
|
894
1014
|
var meeting = meetingRef.current;
|
|
1015
|
+
|
|
895
1016
|
if (meeting) {
|
|
896
1017
|
meeting.stopLivestream();
|
|
897
1018
|
}
|
|
898
1019
|
};
|
|
1020
|
+
|
|
899
1021
|
var connectTo = function connectTo(_ref6) {
|
|
900
1022
|
var meetingId = _ref6.meetingId,
|
|
901
|
-
|
|
1023
|
+
payload = _ref6.payload;
|
|
1024
|
+
|
|
902
1025
|
try {
|
|
903
1026
|
var _meeting3 = meetingRef.current;
|
|
1027
|
+
|
|
904
1028
|
var _temp2 = function () {
|
|
905
1029
|
if (_meeting3) {
|
|
906
1030
|
return Promise.resolve(_meeting3.connectTo({
|
|
@@ -909,25 +1033,32 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
909
1033
|
})).then(function () {});
|
|
910
1034
|
}
|
|
911
1035
|
}();
|
|
1036
|
+
|
|
912
1037
|
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
913
1038
|
} catch (e) {
|
|
914
1039
|
return Promise.reject(e);
|
|
915
1040
|
}
|
|
916
1041
|
};
|
|
1042
|
+
|
|
917
1043
|
var startHls = function startHls(config) {
|
|
918
1044
|
var meeting = meetingRef.current;
|
|
1045
|
+
|
|
919
1046
|
if (meeting) {
|
|
920
1047
|
meeting.startHls(config);
|
|
921
1048
|
}
|
|
922
1049
|
};
|
|
1050
|
+
|
|
923
1051
|
var stopHls = function stopHls() {
|
|
924
1052
|
var meeting = meetingRef.current;
|
|
1053
|
+
|
|
925
1054
|
if (meeting) {
|
|
926
1055
|
meeting.stopHls();
|
|
927
1056
|
}
|
|
928
1057
|
};
|
|
1058
|
+
|
|
929
1059
|
var initSDK = function initSDK() {
|
|
930
1060
|
jsSdk.VideoSDK.config(tokenRef.current);
|
|
1061
|
+
|
|
931
1062
|
if (deviceInfo) {
|
|
932
1063
|
jsSdk.VideoSDK.analytics(deviceInfo);
|
|
933
1064
|
} else {
|
|
@@ -936,10 +1067,12 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
936
1067
|
sdkVersion: version
|
|
937
1068
|
});
|
|
938
1069
|
}
|
|
1070
|
+
|
|
939
1071
|
if (joinWithoutUserInteraction) {
|
|
940
1072
|
join();
|
|
941
1073
|
}
|
|
942
1074
|
};
|
|
1075
|
+
|
|
943
1076
|
React.useEffect(function () {
|
|
944
1077
|
initSDK();
|
|
945
1078
|
}, []);
|
|
@@ -1010,198 +1143,260 @@ var MeetingProvider = function MeetingProvider(_ref) {
|
|
|
1010
1143
|
|
|
1011
1144
|
var useParticipant = function useParticipant(participantId, _temp) {
|
|
1012
1145
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1146
|
+
_ref$onStreamEnabled = _ref.onStreamEnabled,
|
|
1147
|
+
onStreamEnabled = _ref$onStreamEnabled === void 0 ? function () {} : _ref$onStreamEnabled,
|
|
1148
|
+
_ref$onStreamDisabled = _ref.onStreamDisabled,
|
|
1149
|
+
onStreamDisabled = _ref$onStreamDisabled === void 0 ? function () {} : _ref$onStreamDisabled,
|
|
1150
|
+
_ref$onMediaStatusCha = _ref.onMediaStatusChanged,
|
|
1151
|
+
onMediaStatusChanged = _ref$onMediaStatusCha === void 0 ? function () {} : _ref$onMediaStatusCha,
|
|
1152
|
+
_ref$onVideoQualityCh = _ref.onVideoQualityChanged,
|
|
1153
|
+
onVideoQualityChanged = _ref$onVideoQualityCh === void 0 ? function () {} : _ref$onVideoQualityCh;
|
|
1154
|
+
|
|
1021
1155
|
var _useState = React.useState(null),
|
|
1022
|
-
|
|
1023
|
-
|
|
1156
|
+
webcamStream = _useState[0],
|
|
1157
|
+
setwebcamStream = _useState[1];
|
|
1158
|
+
|
|
1024
1159
|
var _useState2 = React.useState(null),
|
|
1025
|
-
|
|
1026
|
-
|
|
1160
|
+
micStream = _useState2[0],
|
|
1161
|
+
setMicStream = _useState2[1];
|
|
1162
|
+
|
|
1027
1163
|
var _useState3 = React.useState(null),
|
|
1028
|
-
|
|
1029
|
-
|
|
1164
|
+
screenShareStream = _useState3[0],
|
|
1165
|
+
setScreenShareStream = _useState3[1];
|
|
1166
|
+
|
|
1030
1167
|
var _useState4 = React.useState(null),
|
|
1031
|
-
|
|
1032
|
-
|
|
1168
|
+
screenShareAudioStream = _useState4[0],
|
|
1169
|
+
setScreenShareAudioStream = _useState4[1];
|
|
1170
|
+
|
|
1033
1171
|
var meeting = useMeeting();
|
|
1172
|
+
|
|
1034
1173
|
var _useMemo = React.useMemo(function () {
|
|
1035
|
-
|
|
1036
|
-
var participants = meeting === null || meeting === void 0 ? void 0 : meeting.participants;
|
|
1037
|
-
var localParticipant = meeting === null || meeting === void 0 ? void 0 : meeting.localParticipant;
|
|
1038
|
-
var activeSpeakerId = meeting === null || meeting === void 0 ? void 0 : meeting.activeSpeakerId;
|
|
1039
|
-
var mainParticipant = meeting === null || meeting === void 0 ? void 0 : meeting.mainParticipant;
|
|
1040
|
-
var pinState = (meeting === null || meeting === void 0 ? void 0 : (_meeting$pinnedPartic = meeting.pinnedParticipants) === null || _meeting$pinnedPartic === void 0 ? void 0 : _meeting$pinnedPartic.get(participantId)) || {
|
|
1041
|
-
cam: false,
|
|
1042
|
-
share: false
|
|
1043
|
-
};
|
|
1174
|
+
var _meeting$pinnedPartic;
|
|
1044
1175
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1176
|
+
var participants = meeting === null || meeting === void 0 ? void 0 : meeting.participants;
|
|
1177
|
+
var localParticipant = meeting === null || meeting === void 0 ? void 0 : meeting.localParticipant;
|
|
1178
|
+
var activeSpeakerId = meeting === null || meeting === void 0 ? void 0 : meeting.activeSpeakerId;
|
|
1179
|
+
var mainParticipant = meeting === null || meeting === void 0 ? void 0 : meeting.mainParticipant;
|
|
1180
|
+
var pinState = (meeting === null || meeting === void 0 ? void 0 : (_meeting$pinnedPartic = meeting.pinnedParticipants) === null || _meeting$pinnedPartic === void 0 ? void 0 : _meeting$pinnedPartic.get(participantId)) || {
|
|
1181
|
+
cam: false,
|
|
1182
|
+
share: false
|
|
1183
|
+
};
|
|
1184
|
+
return {
|
|
1185
|
+
participants: participants,
|
|
1186
|
+
localParticipant: localParticipant,
|
|
1187
|
+
activeSpeakerId: activeSpeakerId,
|
|
1188
|
+
mainParticipant: mainParticipant,
|
|
1189
|
+
pinState: pinState
|
|
1190
|
+
};
|
|
1191
|
+
}, [meeting]),
|
|
1192
|
+
participants = _useMemo.participants,
|
|
1193
|
+
localParticipant = _useMemo.localParticipant,
|
|
1194
|
+
activeSpeakerId = _useMemo.activeSpeakerId,
|
|
1195
|
+
mainParticipant = _useMemo.mainParticipant,
|
|
1196
|
+
pinState = _useMemo.pinState;
|
|
1058
1197
|
|
|
1059
1198
|
var participant = participants === null || participants === void 0 ? void 0 : participants.get(participantId);
|
|
1199
|
+
|
|
1060
1200
|
var _useState5 = React.useState(participant === null || participant === void 0 ? void 0 : participant.webcamOn),
|
|
1061
|
-
|
|
1062
|
-
|
|
1201
|
+
webcamOn = _useState5[0],
|
|
1202
|
+
setWebcamOn = _useState5[1];
|
|
1203
|
+
|
|
1063
1204
|
var _useState6 = React.useState(participant === null || participant === void 0 ? void 0 : participant.micOn),
|
|
1064
|
-
|
|
1065
|
-
|
|
1205
|
+
micOn = _useState6[0],
|
|
1206
|
+
setMicOn = _useState6[1];
|
|
1207
|
+
|
|
1066
1208
|
var _useState7 = React.useState(participant === null || participant === void 0 ? void 0 : participant.mode),
|
|
1067
|
-
|
|
1068
|
-
|
|
1209
|
+
mode = _useState7[0],
|
|
1210
|
+
setMode = _useState7[1];
|
|
1211
|
+
|
|
1069
1212
|
var setTrack = function setTrack(stream) {
|
|
1070
1213
|
if (stream.track.readyState === 'live') {
|
|
1071
1214
|
switch (stream.kind) {
|
|
1072
1215
|
case 'video':
|
|
1216
|
+
if (webcamStream != null) {
|
|
1217
|
+
setwebcamStream(null);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1073
1220
|
setwebcamStream(stream);
|
|
1074
1221
|
break;
|
|
1222
|
+
|
|
1075
1223
|
case 'audio':
|
|
1224
|
+
if (micStream != null) {
|
|
1225
|
+
setMicStream(null);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1076
1228
|
setMicStream(stream);
|
|
1077
1229
|
break;
|
|
1230
|
+
|
|
1078
1231
|
case 'share':
|
|
1232
|
+
if (screenShareStream != null) {
|
|
1233
|
+
setScreenShareStream(null);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1079
1236
|
setScreenShareStream(stream);
|
|
1080
1237
|
break;
|
|
1238
|
+
|
|
1081
1239
|
case 'shareAudio':
|
|
1240
|
+
if (screenShareAudioStream != null) {
|
|
1241
|
+
setScreenShareAudioStream(null);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1082
1244
|
setScreenShareAudioStream(stream);
|
|
1083
1245
|
break;
|
|
1084
1246
|
}
|
|
1085
1247
|
}
|
|
1086
1248
|
};
|
|
1249
|
+
|
|
1087
1250
|
var unSetTrack = function unSetTrack(stream) {
|
|
1088
1251
|
if (stream.track.readyState !== 'live') {
|
|
1089
1252
|
switch (stream.kind) {
|
|
1090
1253
|
case 'video':
|
|
1091
1254
|
setwebcamStream(null);
|
|
1092
1255
|
break;
|
|
1256
|
+
|
|
1093
1257
|
case 'audio':
|
|
1094
1258
|
setMicStream(null);
|
|
1095
1259
|
break;
|
|
1260
|
+
|
|
1096
1261
|
case 'share':
|
|
1097
1262
|
setScreenShareStream(null);
|
|
1098
1263
|
break;
|
|
1264
|
+
|
|
1099
1265
|
case 'shareAudio':
|
|
1100
1266
|
setScreenShareAudioStream(null);
|
|
1101
1267
|
break;
|
|
1102
1268
|
}
|
|
1103
1269
|
}
|
|
1104
1270
|
};
|
|
1271
|
+
|
|
1105
1272
|
var _handleStreamEnabled = function _handleStreamEnabled(stream) {
|
|
1106
1273
|
setTrack(stream);
|
|
1107
1274
|
onStreamEnabled(stream);
|
|
1108
1275
|
};
|
|
1276
|
+
|
|
1109
1277
|
var _handleParticipantModeChanged = function _handleParticipantModeChanged(data) {
|
|
1110
1278
|
console.log('## FINAL', data);
|
|
1279
|
+
|
|
1111
1280
|
if (participantId === data.participantId) {
|
|
1112
1281
|
setMode(data.mode);
|
|
1113
1282
|
}
|
|
1114
1283
|
};
|
|
1284
|
+
|
|
1115
1285
|
var _handleStreamDisabled = function _handleStreamDisabled(stream) {
|
|
1116
1286
|
unSetTrack(stream);
|
|
1117
1287
|
onStreamDisabled(stream);
|
|
1118
1288
|
};
|
|
1289
|
+
|
|
1119
1290
|
var _handleVideoQualityChanged = function _handleVideoQualityChanged(data) {
|
|
1120
1291
|
var peerId = data.peerId,
|
|
1121
|
-
|
|
1122
|
-
|
|
1292
|
+
prevQuality = data.prevQuality,
|
|
1293
|
+
currentQuality = data.currentQuality;
|
|
1123
1294
|
onVideoQualityChanged({
|
|
1124
1295
|
peerId: peerId,
|
|
1125
1296
|
prevQuality: prevQuality,
|
|
1126
1297
|
currentQuality: currentQuality
|
|
1127
1298
|
});
|
|
1128
1299
|
};
|
|
1300
|
+
|
|
1129
1301
|
var _handleMediaStatusChanged = function _handleMediaStatusChanged(data) {
|
|
1130
1302
|
var kind = data.kind,
|
|
1131
|
-
|
|
1132
|
-
|
|
1303
|
+
peerId = data.peerId,
|
|
1304
|
+
newStatus = data.newStatus;
|
|
1305
|
+
|
|
1133
1306
|
if (kind == 'audio') {
|
|
1134
1307
|
setMicOn(newStatus);
|
|
1135
1308
|
} else if (kind == 'video') {
|
|
1136
1309
|
setWebcamOn(newStatus);
|
|
1137
1310
|
}
|
|
1311
|
+
|
|
1138
1312
|
onMediaStatusChanged({
|
|
1139
1313
|
kind: kind,
|
|
1140
1314
|
peerId: peerId,
|
|
1141
1315
|
newStatus: newStatus
|
|
1142
1316
|
});
|
|
1143
1317
|
};
|
|
1318
|
+
|
|
1144
1319
|
var setQuality = function setQuality(quality) {
|
|
1145
1320
|
participant === null || participant === void 0 ? void 0 : participant.setQuality(quality);
|
|
1146
1321
|
};
|
|
1322
|
+
|
|
1147
1323
|
var setViewPort = function setViewPort(width, height) {
|
|
1148
1324
|
participant === null || participant === void 0 ? void 0 : participant.setViewPort(width, height);
|
|
1149
1325
|
};
|
|
1326
|
+
|
|
1150
1327
|
var enableMic = function enableMic() {
|
|
1151
1328
|
participant === null || participant === void 0 ? void 0 : participant.enableMic();
|
|
1152
1329
|
};
|
|
1330
|
+
|
|
1153
1331
|
var disableMic = function disableMic() {
|
|
1154
1332
|
participant === null || participant === void 0 ? void 0 : participant.disableMic();
|
|
1155
1333
|
};
|
|
1334
|
+
|
|
1156
1335
|
var enableWebcam = function enableWebcam() {
|
|
1157
1336
|
participant === null || participant === void 0 ? void 0 : participant.enableWebcam();
|
|
1158
1337
|
};
|
|
1338
|
+
|
|
1159
1339
|
var disableWebcam = function disableWebcam() {
|
|
1160
1340
|
participant === null || participant === void 0 ? void 0 : participant.disableWebcam();
|
|
1161
1341
|
};
|
|
1342
|
+
|
|
1162
1343
|
var pin = function pin(data) {
|
|
1163
1344
|
participant === null || participant === void 0 ? void 0 : participant.pin(data);
|
|
1164
1345
|
};
|
|
1346
|
+
|
|
1165
1347
|
var unpin = function unpin(data) {
|
|
1166
1348
|
participant === null || participant === void 0 ? void 0 : participant.unpin(data);
|
|
1167
1349
|
};
|
|
1350
|
+
|
|
1168
1351
|
var getAudioStats = function getAudioStats() {
|
|
1169
1352
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getAudioStats());
|
|
1170
1353
|
};
|
|
1354
|
+
|
|
1171
1355
|
var getVideoStats = function getVideoStats() {
|
|
1172
1356
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getVideoStats());
|
|
1173
1357
|
};
|
|
1358
|
+
|
|
1174
1359
|
var getShareStats = function getShareStats() {
|
|
1175
1360
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.getShareStats());
|
|
1176
1361
|
};
|
|
1362
|
+
|
|
1177
1363
|
var consumeWebcamStreams = function consumeWebcamStreams() {
|
|
1178
1364
|
participant === null || participant === void 0 ? void 0 : participant.consumeWebcamStreams();
|
|
1179
1365
|
};
|
|
1366
|
+
|
|
1180
1367
|
var consumeMicStreams = function consumeMicStreams() {
|
|
1181
1368
|
participant === null || participant === void 0 ? void 0 : participant.consumeMicStreams();
|
|
1182
1369
|
};
|
|
1370
|
+
|
|
1183
1371
|
var stopConsumingWebcamStreams = function stopConsumingWebcamStreams() {
|
|
1184
1372
|
participant === null || participant === void 0 ? void 0 : participant.stopConsumingWebcamStreams();
|
|
1185
1373
|
};
|
|
1374
|
+
|
|
1186
1375
|
var stopConsumingMicStreams = function stopConsumingMicStreams() {
|
|
1187
1376
|
participant === null || participant === void 0 ? void 0 : participant.stopConsumingMicStreams();
|
|
1188
1377
|
};
|
|
1378
|
+
|
|
1189
1379
|
var switchTo = function switchTo(data) {
|
|
1190
1380
|
return Promise.resolve(participant === null || participant === void 0 ? void 0 : participant.switchTo(data)).then(function () {});
|
|
1191
1381
|
};
|
|
1382
|
+
|
|
1192
1383
|
React.useEffect(function () {
|
|
1193
1384
|
var streams = participant === null || participant === void 0 ? void 0 : participant.streams;
|
|
1385
|
+
|
|
1194
1386
|
if (streams) {
|
|
1195
1387
|
streams.forEach(function (stream) {
|
|
1196
1388
|
setTrack(stream);
|
|
1197
1389
|
});
|
|
1198
1390
|
}
|
|
1391
|
+
|
|
1199
1392
|
if (participant !== null && participant !== void 0 && participant.micOn) {
|
|
1200
1393
|
setMicOn(micOn);
|
|
1201
1394
|
}
|
|
1395
|
+
|
|
1202
1396
|
if (participant !== null && participant !== void 0 && participant.webcamOn) {
|
|
1203
1397
|
setWebcamOn(webcamOn);
|
|
1204
1398
|
}
|
|
1399
|
+
|
|
1205
1400
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-enabled', _handleStreamEnabled);
|
|
1206
1401
|
participant === null || participant === void 0 ? void 0 : participant.on('stream-disabled', _handleStreamDisabled);
|
|
1207
1402
|
participant === null || participant === void 0 ? void 0 : participant.on('media-status-changed', _handleMediaStatusChanged);
|
|
@@ -1251,33 +1446,39 @@ var useParticipant = function useParticipant(participantId, _temp) {
|
|
|
1251
1446
|
|
|
1252
1447
|
var useConnection = function useConnection(connectionId, _temp) {
|
|
1253
1448
|
var _ref = _temp === void 0 ? {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1449
|
+
onMeeting: {
|
|
1450
|
+
onParticipantJoined: function onParticipantJoined() {},
|
|
1451
|
+
onParticipantLeft: function onParticipantLeft() {},
|
|
1452
|
+
onChatMessage: function onChatMessage() {}
|
|
1453
|
+
}
|
|
1454
|
+
} : _temp,
|
|
1455
|
+
onMeeting = _ref.onMeeting;
|
|
1456
|
+
|
|
1261
1457
|
var onParticipantJoined = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantJoined;
|
|
1262
1458
|
var onParticipantLeft = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onParticipantLeft;
|
|
1263
1459
|
var onChatMessage = onMeeting === null || onMeeting === void 0 ? void 0 : onMeeting.onChatMessage;
|
|
1264
1460
|
var meeting = useMeeting();
|
|
1461
|
+
|
|
1265
1462
|
var _useMemo = React.useMemo(function () {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1463
|
+
var connection = meeting === null || meeting === void 0 ? void 0 : meeting.connections.get(connectionId);
|
|
1464
|
+
|
|
1465
|
+
if (!connection) {
|
|
1466
|
+
throw new Error('connectionId not found');
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
var connectionParticipants = new Map(connection.meeting.participants);
|
|
1470
|
+
return {
|
|
1471
|
+
connection: connection,
|
|
1472
|
+
connectionParticipants: connectionParticipants
|
|
1473
|
+
};
|
|
1474
|
+
}, [meeting]),
|
|
1475
|
+
connection = _useMemo.connection,
|
|
1476
|
+
connectionParticipants = _useMemo.connectionParticipants;
|
|
1477
|
+
|
|
1278
1478
|
var _useState = React.useState(new Map(connectionParticipants)),
|
|
1279
|
-
|
|
1280
|
-
|
|
1479
|
+
_connectionParticipants = _useState[0],
|
|
1480
|
+
setConnectionParticipants = _useState[1];
|
|
1481
|
+
|
|
1281
1482
|
var _handleParticipantJoined = function _handleParticipantJoined(participant) {
|
|
1282
1483
|
setConnectionParticipants(function (s) {
|
|
1283
1484
|
s.set(participant.id, participant);
|
|
@@ -1286,6 +1487,7 @@ var useConnection = function useConnection(connectionId, _temp) {
|
|
|
1286
1487
|
});
|
|
1287
1488
|
onParticipantJoined(participant);
|
|
1288
1489
|
};
|
|
1490
|
+
|
|
1289
1491
|
var _handleParticipantLeft = function _handleParticipantLeft(participantId) {
|
|
1290
1492
|
setConnectionParticipants(function (s) {
|
|
1291
1493
|
s["delete"](participantId);
|
|
@@ -1294,9 +1496,11 @@ var useConnection = function useConnection(connectionId, _temp) {
|
|
|
1294
1496
|
});
|
|
1295
1497
|
onParticipantLeft(participantId);
|
|
1296
1498
|
};
|
|
1499
|
+
|
|
1297
1500
|
var _handleChatMessage = function _handleChatMessage(data) {
|
|
1298
1501
|
onChatMessage(data);
|
|
1299
1502
|
};
|
|
1503
|
+
|
|
1300
1504
|
React.useEffect(function () {
|
|
1301
1505
|
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-joined', _handleParticipantJoined);
|
|
1302
1506
|
connection === null || connection === void 0 ? void 0 : connection.meeting.on('participant-left', _handleParticipantLeft);
|
|
@@ -1324,16 +1528,19 @@ var useConnection = function useConnection(connectionId, _temp) {
|
|
|
1324
1528
|
|
|
1325
1529
|
var usePubSub = function usePubSub(topic, _temp) {
|
|
1326
1530
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1531
|
+
_ref$onMessageReceive = _ref.onMessageReceived,
|
|
1532
|
+
onMessageReceived = _ref$onMessageReceive === void 0 ? function () {} : _ref$onMessageReceive,
|
|
1533
|
+
_ref$onOldMessagesRec = _ref.onOldMessagesReceived,
|
|
1534
|
+
onOldMessagesReceived = _ref$onOldMessagesRec === void 0 ? function () {} : _ref$onOldMessagesRec;
|
|
1535
|
+
|
|
1331
1536
|
var _useMeeting = useMeeting(),
|
|
1332
|
-
|
|
1333
|
-
|
|
1537
|
+
meeting = _useMeeting.meeting,
|
|
1538
|
+
isMeetingJoined = _useMeeting.isMeetingJoined;
|
|
1539
|
+
|
|
1334
1540
|
var _useState = React.useState([]),
|
|
1335
|
-
|
|
1336
|
-
|
|
1541
|
+
messages = _useState[0],
|
|
1542
|
+
setMessages = _useState[1];
|
|
1543
|
+
|
|
1337
1544
|
var isSubscribed = React.useRef(false);
|
|
1338
1545
|
|
|
1339
1546
|
var publish = function publish(message, options) {
|
|
@@ -1341,15 +1548,18 @@ var usePubSub = function usePubSub(topic, _temp) {
|
|
|
1341
1548
|
meeting.pubSub.publish(topic, message, options);
|
|
1342
1549
|
}
|
|
1343
1550
|
};
|
|
1551
|
+
|
|
1344
1552
|
var _handlePubSub = function _handlePubSub(data) {
|
|
1345
1553
|
setMessages(function (s) {
|
|
1346
1554
|
return [].concat(s, [data]);
|
|
1347
1555
|
});
|
|
1348
1556
|
onMessageReceived(data);
|
|
1349
1557
|
};
|
|
1558
|
+
|
|
1350
1559
|
var subscribeToPubsub = function subscribeToPubsub(meeting) {
|
|
1351
1560
|
try {
|
|
1352
1561
|
var _meeting$pubSub;
|
|
1562
|
+
|
|
1353
1563
|
return Promise.resolve(meeting === null || meeting === void 0 ? void 0 : (_meeting$pubSub = meeting.pubSub) === null || _meeting$pubSub === void 0 ? void 0 : _meeting$pubSub.subscribe(topic, _handlePubSub)).then(function (data) {
|
|
1354
1564
|
if (data) {
|
|
1355
1565
|
onOldMessagesReceived(data.messages);
|
|
@@ -1360,12 +1570,14 @@ var usePubSub = function usePubSub(topic, _temp) {
|
|
|
1360
1570
|
return Promise.reject(e);
|
|
1361
1571
|
}
|
|
1362
1572
|
};
|
|
1573
|
+
|
|
1363
1574
|
React.useEffect(function () {
|
|
1364
1575
|
if (meeting && !isSubscribed.current && isMeetingJoined) {
|
|
1365
1576
|
isSubscribed.current = true;
|
|
1366
1577
|
subscribeToPubsub(meeting);
|
|
1367
1578
|
return function () {
|
|
1368
1579
|
var _meeting$pubSub2;
|
|
1580
|
+
|
|
1369
1581
|
meeting === null || meeting === void 0 ? void 0 : (_meeting$pubSub2 = meeting.pubSub) === null || _meeting$pubSub2 === void 0 ? void 0 : _meeting$pubSub2.unsubscribe(topic, _handlePubSub);
|
|
1370
1582
|
};
|
|
1371
1583
|
}
|
|
@@ -1380,15 +1592,16 @@ var Constants = jsSdk.VideoSDK.Constants;
|
|
|
1380
1592
|
|
|
1381
1593
|
var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
|
|
1382
1594
|
var _ref$cameraId = _ref.cameraId,
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1595
|
+
cameraId = _ref$cameraId === void 0 ? undefined : _ref$cameraId,
|
|
1596
|
+
_ref$encoderConfig = _ref.encoderConfig,
|
|
1597
|
+
encoderConfig = _ref$encoderConfig === void 0 ? undefined : _ref$encoderConfig,
|
|
1598
|
+
_ref$facingMode = _ref.facingMode,
|
|
1599
|
+
facingMode = _ref$facingMode === void 0 ? undefined : _ref$facingMode,
|
|
1600
|
+
_ref$optimizationMode = _ref.optimizationMode,
|
|
1601
|
+
optimizationMode = _ref$optimizationMode === void 0 ? undefined : _ref$optimizationMode,
|
|
1602
|
+
_ref$multiStream = _ref.multiStream,
|
|
1603
|
+
multiStream = _ref$multiStream === void 0 ? true : _ref$multiStream;
|
|
1604
|
+
|
|
1392
1605
|
try {
|
|
1393
1606
|
return Promise.resolve(jsSdk.VideoSDK.createCameraVideoTrack({
|
|
1394
1607
|
cameraId: cameraId,
|
|
@@ -1404,11 +1617,12 @@ var createCameraVideoTrack = function createCameraVideoTrack(_ref) {
|
|
|
1404
1617
|
|
|
1405
1618
|
var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
|
|
1406
1619
|
var _ref2$encoderConfig = _ref2.encoderConfig,
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1620
|
+
encoderConfig = _ref2$encoderConfig === void 0 ? undefined : _ref2$encoderConfig,
|
|
1621
|
+
_ref2$optimizationMod = _ref2.optimizationMode,
|
|
1622
|
+
optimizationMode = _ref2$optimizationMod === void 0 ? undefined : _ref2$optimizationMod,
|
|
1623
|
+
_ref2$withAudio = _ref2.withAudio,
|
|
1624
|
+
withAudio = _ref2$withAudio === void 0 ? 'enable' : _ref2$withAudio;
|
|
1625
|
+
|
|
1412
1626
|
try {
|
|
1413
1627
|
return Promise.resolve(jsSdk.VideoSDK.createScreenShareVideoTrack({
|
|
1414
1628
|
encoderConfig: encoderConfig,
|
|
@@ -1422,11 +1636,12 @@ var createScreenShareVideoTrack = function createScreenShareVideoTrack(_ref2) {
|
|
|
1422
1636
|
|
|
1423
1637
|
var createMicrophoneAudioTrack = function createMicrophoneAudioTrack(_ref3) {
|
|
1424
1638
|
var _ref3$noiseConfig = _ref3.noiseConfig,
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1639
|
+
noiseConfig = _ref3$noiseConfig === void 0 ? undefined : _ref3$noiseConfig,
|
|
1640
|
+
_ref3$encoderConfig = _ref3.encoderConfig,
|
|
1641
|
+
encoderConfig = _ref3$encoderConfig === void 0 ? undefined : _ref3$encoderConfig,
|
|
1642
|
+
_ref3$microphoneId = _ref3.microphoneId,
|
|
1643
|
+
microphoneId = _ref3$microphoneId === void 0 ? undefined : _ref3$microphoneId;
|
|
1644
|
+
|
|
1430
1645
|
try {
|
|
1431
1646
|
return Promise.resolve(jsSdk.VideoSDK.createMicrophoneAudioTrack({
|
|
1432
1647
|
noiseConfig: noiseConfig,
|