@signalwire/js 3.28.0 → 3.28.1
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/core/src/BaseSession.d.ts +1 -1
- package/dist/core/src/RPCMessages/VertoMessages.d.ts +7 -0
- package/dist/core/src/RPCMessages/VertoMessages.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +2 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/redux/features/component/componentSlice.d.ts +96 -0
- package/dist/core/src/redux/features/component/componentSlice.d.ts.map +1 -1
- package/dist/core/src/redux/rootReducer.d.ts +16 -0
- package/dist/core/src/redux/rootReducer.d.ts.map +1 -1
- package/dist/core/src/types/common.d.ts +16 -10
- package/dist/core/src/types/common.d.ts.map +1 -1
- package/dist/core/src/types/fabric.d.ts +0 -27
- package/dist/core/src/types/fabric.d.ts.map +1 -1
- package/dist/core/src/types/index.d.ts +67 -1
- package/dist/core/src/types/index.d.ts.map +1 -1
- package/dist/core/src/types/videoPlayback.d.ts +1 -7
- package/dist/core/src/types/videoPlayback.d.ts.map +1 -1
- package/dist/core/src/types/videoRecording.d.ts +1 -7
- package/dist/core/src/types/videoRecording.d.ts.map +1 -1
- package/dist/core/src/types/voice.d.ts +13 -2
- package/dist/core/src/types/voice.d.ts.map +1 -1
- package/dist/core/src/types/voiceCall.d.ts +96 -964
- package/dist/core/src/types/voiceCall.d.ts.map +1 -1
- package/dist/core/src/types/voiceCollect.d.ts +166 -0
- package/dist/core/src/types/voiceCollect.d.ts.map +1 -0
- package/dist/core/src/types/voiceConnect.d.ts +77 -0
- package/dist/core/src/types/voiceConnect.d.ts.map +1 -0
- package/dist/core/src/types/voiceDetect.d.ts +127 -0
- package/dist/core/src/types/voiceDetect.d.ts.map +1 -0
- package/dist/core/src/types/voicePlayback.d.ts +141 -0
- package/dist/core/src/types/voicePlayback.d.ts.map +1 -0
- package/dist/core/src/types/voicePrompt.d.ts +105 -0
- package/dist/core/src/types/voicePrompt.d.ts.map +1 -0
- package/dist/core/src/types/voiceRecording.d.ts +107 -0
- package/dist/core/src/types/voiceRecording.d.ts.map +1 -0
- package/dist/core/src/types/voiceSendDigits.d.ts +21 -0
- package/dist/core/src/types/voiceSendDigits.d.ts.map +1 -0
- package/dist/core/src/types/voiceTap.d.ts +116 -0
- package/dist/core/src/types/voiceTap.d.ts.map +1 -0
- package/dist/core/src/utils/constants.d.ts.map +1 -1
- package/dist/core/src/utils/eventUtils.d.ts +0 -2
- package/dist/core/src/utils/eventUtils.d.ts.map +1 -1
- package/dist/core/src/utils/interfaces.d.ts +19 -2
- package/dist/core/src/utils/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +636 -223
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +655 -233
- package/dist/index.js.map +4 -4
- package/dist/index.umd.js +26 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/js/src/fabric/Conversation.d.ts +2 -2
- package/dist/js/src/fabric/Conversation.d.ts.map +1 -1
- package/dist/js/src/fabric/FabricRoomSession.d.ts +5 -4
- package/dist/js/src/fabric/FabricRoomSession.d.ts.map +1 -1
- package/dist/js/src/fabric/SignalWire.d.ts.map +1 -1
- package/dist/js/src/fabric/WSClient.d.ts +2 -2
- package/dist/js/src/fabric/WSClient.d.ts.map +1 -1
- package/dist/js/src/fabric/createWSClient.d.ts +1 -1
- package/dist/js/src/fabric/createWSClient.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/capabilities.d.ts +28 -0
- package/dist/js/src/fabric/interfaces/capabilities.d.ts.map +1 -0
- package/dist/js/src/fabric/interfaces/conversation.d.ts +4 -4
- package/dist/js/src/fabric/interfaces/conversation.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/index.d.ts +1 -0
- package/dist/js/src/fabric/interfaces/index.d.ts.map +1 -1
- package/dist/js/src/fabric/interfaces/wsClient.d.ts +2 -2
- package/dist/js/src/fabric/interfaces/wsClient.d.ts.map +1 -1
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts +28 -0
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts.map +1 -0
- package/dist/js/src/fabric/workers/callJoinWorker.d.ts.map +1 -1
- package/dist/js/src/fabric/workers/wsClientWorker.d.ts.map +1 -1
- package/dist/js/src/index.d.ts +2 -2
- package/dist/js/src/index.d.ts.map +1 -1
- package/dist/js/src/utils/interfaces/fabric.d.ts +6 -3
- package/dist/js/src/utils/interfaces/fabric.d.ts.map +1 -1
- package/dist/js/src/utils/paginatedResult.d.ts +4 -4
- package/dist/js/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webrtc/src/BaseConnection.d.ts +78 -19
- package/dist/webrtc/src/BaseConnection.d.ts.map +1 -1
- package/dist/webrtc/src/RTCPeer.d.ts +11 -0
- package/dist/webrtc/src/RTCPeer.d.ts.map +1 -1
- package/dist/webrtc/src/utils/helpers.d.ts.map +1 -1
- package/dist/webrtc/src/utils/interfaces.d.ts +6 -0
- package/dist/webrtc/src/utils/interfaces.d.ts.map +1 -1
- package/dist/webrtc/src/utils/sdpHelpers.d.ts +27 -2
- package/dist/webrtc/src/utils/sdpHelpers.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/fabric/Conversation.ts +9 -7
- package/src/fabric/FabricRoomSession.ts +32 -32
- package/src/fabric/SignalWire.test.ts +2 -0
- package/src/fabric/SignalWire.ts +2 -0
- package/src/fabric/WSClient.ts +6 -10
- package/src/fabric/interfaces/capabilities.ts +30 -0
- package/src/fabric/interfaces/conversation.ts +5 -4
- package/src/fabric/interfaces/index.ts +2 -1
- package/src/fabric/interfaces/wsClient.ts +2 -2
- package/src/fabric/utils/capabilitiesHelpers.test.ts +201 -0
- package/src/fabric/utils/capabilitiesHelpers.ts +190 -0
- package/src/fabric/workers/callJoinWorker.ts +7 -6
- package/src/fabric/workers/wsClientWorker.ts +35 -12
- package/src/index.ts +1 -1
- package/src/utils/interfaces/fabric.ts +10 -3
- package/dist/core/src/utils/eventUtils.test.d.ts +0 -2
- package/dist/core/src/utils/eventUtils.test.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -33,10 +33,7 @@ var __export = (target, all) => {
|
|
|
33
33
|
for (var name in all)
|
|
34
34
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
35
|
};
|
|
36
|
-
var __publicField = (obj, key, value) =>
|
|
37
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
-
return value;
|
|
39
|
-
};
|
|
36
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
37
|
|
|
41
38
|
// src/chat/index.ts
|
|
42
39
|
var chat_exports = {};
|
|
@@ -87,7 +84,9 @@ var setAudioMediaTrack = ({
|
|
|
87
84
|
|
|
88
85
|
// src/features/actions.ts
|
|
89
86
|
import { actions } from "@signalwire/core";
|
|
90
|
-
var audioSetSpeakerAction = actions.createAction(
|
|
87
|
+
var audioSetSpeakerAction = actions.createAction(
|
|
88
|
+
"swJs/audioSetSpeakerAction"
|
|
89
|
+
);
|
|
91
90
|
|
|
92
91
|
// src/features/mediaElements/mediaElementsSagas.ts
|
|
93
92
|
var makeAudioElementSaga = ({ speakerId }) => {
|
|
@@ -128,14 +127,25 @@ function* audioElementActionsWatcher({
|
|
|
128
127
|
element,
|
|
129
128
|
room
|
|
130
129
|
}) {
|
|
131
|
-
const setSpeakerActionType = actions2.getCustomSagaActionType(
|
|
130
|
+
const setSpeakerActionType = actions2.getCustomSagaActionType(
|
|
131
|
+
room.__uuid,
|
|
132
|
+
audioSetSpeakerAction
|
|
133
|
+
);
|
|
132
134
|
while (true) {
|
|
133
135
|
const action = yield sagaEffects.take([setSpeakerActionType]);
|
|
134
136
|
try {
|
|
135
137
|
switch (action.type) {
|
|
136
138
|
case setSpeakerActionType:
|
|
137
|
-
const response = yield sagaEffects.call(
|
|
138
|
-
|
|
139
|
+
const response = yield sagaEffects.call(
|
|
140
|
+
setMediaElementSinkId,
|
|
141
|
+
element,
|
|
142
|
+
action.payload
|
|
143
|
+
);
|
|
144
|
+
room.emit(
|
|
145
|
+
// @ts-expect-error
|
|
146
|
+
`${LOCAL_EVENT_PREFIX}.speaker.updated`,
|
|
147
|
+
action.payload
|
|
148
|
+
);
|
|
139
149
|
room.settleCustomSagaTrigger({
|
|
140
150
|
dispatchId: action.dispatchId,
|
|
141
151
|
payload: response,
|
|
@@ -195,7 +205,11 @@ var videoManagerRoomsWorker = function* (options) {
|
|
|
195
205
|
const modPayload = {
|
|
196
206
|
rooms: payload.rooms.map((row) => toExternalJSON(row))
|
|
197
207
|
};
|
|
198
|
-
client.emit(
|
|
208
|
+
client.emit(
|
|
209
|
+
stripNamespacePrefix(type),
|
|
210
|
+
// @ts-expect-error
|
|
211
|
+
modPayload
|
|
212
|
+
);
|
|
199
213
|
getLogger2().trace("videoManagerRoomsWorker ended");
|
|
200
214
|
};
|
|
201
215
|
|
|
@@ -211,7 +225,10 @@ var videoManagerRoomWorker = function* (options) {
|
|
|
211
225
|
instance: client,
|
|
212
226
|
action: { type, payload }
|
|
213
227
|
} = options;
|
|
214
|
-
client.emit(
|
|
228
|
+
client.emit(
|
|
229
|
+
stripNamespacePrefix2(type),
|
|
230
|
+
toExternalJSON2(payload)
|
|
231
|
+
);
|
|
215
232
|
getLogger3().trace("videoManagerRoomWorker ended");
|
|
216
233
|
};
|
|
217
234
|
|
|
@@ -244,9 +261,12 @@ var videoManagerWorker = function* (options) {
|
|
|
244
261
|
}
|
|
245
262
|
}
|
|
246
263
|
while (true) {
|
|
247
|
-
const action = yield sagaEffects2.take(
|
|
248
|
-
|
|
249
|
-
|
|
264
|
+
const action = yield sagaEffects2.take(
|
|
265
|
+
swEventChannel,
|
|
266
|
+
(action2) => {
|
|
267
|
+
return action2.type.startsWith("video-manager.");
|
|
268
|
+
}
|
|
269
|
+
);
|
|
250
270
|
yield sagaEffects2.fork(worker, action);
|
|
251
271
|
}
|
|
252
272
|
getLogger4().trace("videoManagerWorker ended");
|
|
@@ -260,8 +280,11 @@ var VideoManagerAPI = class extends BaseConsumer {
|
|
|
260
280
|
worker: videoManagerWorker
|
|
261
281
|
});
|
|
262
282
|
}
|
|
283
|
+
/** @internal */
|
|
263
284
|
getSubscriptions() {
|
|
264
|
-
const eventNamesWithPrefix = this.eventNames().map(
|
|
285
|
+
const eventNamesWithPrefix = this.eventNames().map(
|
|
286
|
+
(event) => `video-manager.${event}`
|
|
287
|
+
);
|
|
265
288
|
return validateEventsToSubscribe(eventNamesWithPrefix);
|
|
266
289
|
}
|
|
267
290
|
};
|
|
@@ -325,6 +348,7 @@ var SCREENSHARE_AUDIO_CONSTRAINTS = {
|
|
|
325
348
|
echoCancellation: true,
|
|
326
349
|
noiseSuppression: false,
|
|
327
350
|
autoGainControl: false,
|
|
351
|
+
// @ts-expect-error
|
|
328
352
|
googAutoGainControl: false
|
|
329
353
|
};
|
|
330
354
|
|
|
@@ -353,16 +377,24 @@ var getJoinMediaParams = (options) => {
|
|
|
353
377
|
const reqToReceiveAudio = Boolean(receiveAudio != null ? receiveAudio : audio);
|
|
354
378
|
const reqToReceiveVideo = Boolean(receiveVideo != null ? receiveVideo : video);
|
|
355
379
|
if (!canSendAudio && reqToSendAudio) {
|
|
356
|
-
getLogger5().info(
|
|
380
|
+
getLogger5().info(
|
|
381
|
+
"Not allowed to send audio on this room. Default values will be used."
|
|
382
|
+
);
|
|
357
383
|
}
|
|
358
384
|
if (!canSendVideo && reqToSendVideo) {
|
|
359
|
-
getLogger5().info(
|
|
385
|
+
getLogger5().info(
|
|
386
|
+
"Not allowed to send video on this room. Default values will be used."
|
|
387
|
+
);
|
|
360
388
|
}
|
|
361
389
|
if (!canReceiveAudio && reqToReceiveAudio) {
|
|
362
|
-
getLogger5().info(
|
|
390
|
+
getLogger5().info(
|
|
391
|
+
"Not allowed to receive video from the room. Default values will be used."
|
|
392
|
+
);
|
|
363
393
|
}
|
|
364
394
|
if (!canReceiveVideo && reqToReceiveVideo) {
|
|
365
|
-
getLogger5().info(
|
|
395
|
+
getLogger5().info(
|
|
396
|
+
"Not allowed to receive video from the room. Default values will be used."
|
|
397
|
+
);
|
|
366
398
|
}
|
|
367
399
|
return {
|
|
368
400
|
mustSendAudio: canSendAudio && reqToSendAudio,
|
|
@@ -420,8 +452,11 @@ var EXTERNAL_MEMBER_LIST_UPDATED_EVENT = "memberList.updated";
|
|
|
420
452
|
var INTERNAL_MEMBER_LIST_UPDATED_EVENT = toInternalEventName({
|
|
421
453
|
event: EXTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
422
454
|
});
|
|
423
|
-
var SYNTHETIC_MEMBER_LIST_UPDATED_EVENT = toSyntheticEvent(
|
|
455
|
+
var SYNTHETIC_MEMBER_LIST_UPDATED_EVENT = toSyntheticEvent(
|
|
456
|
+
INTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
457
|
+
);
|
|
424
458
|
var MEMBER_LIST_EVENTS = [
|
|
459
|
+
/** Alias to `video.room.subscribed` */
|
|
425
460
|
"video.room.joined",
|
|
426
461
|
"video.member.joined",
|
|
427
462
|
"video.member.left",
|
|
@@ -436,7 +471,9 @@ var getMemberListEventsToSubscribe = (subscriptions) => {
|
|
|
436
471
|
});
|
|
437
472
|
};
|
|
438
473
|
var shouldHandleMemberList = (subscriptions) => {
|
|
439
|
-
return subscriptions.some(
|
|
474
|
+
return subscriptions.some(
|
|
475
|
+
(event) => event.includes(EXTERNAL_MEMBER_LIST_UPDATED_EVENT)
|
|
476
|
+
);
|
|
440
477
|
};
|
|
441
478
|
var getMembersFromAction = (action) => {
|
|
442
479
|
if (action.type === "video.room.joined") {
|
|
@@ -487,15 +524,24 @@ function* membersListUpdatedWatcher({
|
|
|
487
524
|
const roomSessionId = pubSubAction.type === "video.room.joined" ? pubSubAction.payload.room_session.id : pubSubAction.payload.room_session_id;
|
|
488
525
|
const members = getUpdatedMembers({ action: pubSubAction, memberList });
|
|
489
526
|
const memberListPayload = {
|
|
527
|
+
/**
|
|
528
|
+
* At this point it's needed to send the
|
|
529
|
+
* `room_session_id` so the pubSubSaga can properly
|
|
530
|
+
* infer the namespace for emitting the events to the
|
|
531
|
+
* appropiate room.
|
|
532
|
+
*/
|
|
490
533
|
room_session_id: roomSessionId,
|
|
491
534
|
members
|
|
492
535
|
};
|
|
493
536
|
instance.emit(SYNTHETIC_MEMBER_LIST_UPDATED_EVENT, memberListPayload);
|
|
494
537
|
}
|
|
495
538
|
while (true) {
|
|
496
|
-
const pubSubAction = yield sagaEffects3.take(
|
|
497
|
-
|
|
498
|
-
|
|
539
|
+
const pubSubAction = yield sagaEffects3.take(
|
|
540
|
+
swEventChannel,
|
|
541
|
+
({ type }) => {
|
|
542
|
+
return isMemberListEvent(type);
|
|
543
|
+
}
|
|
544
|
+
);
|
|
499
545
|
yield sagaEffects3.fork(worker, pubSubAction);
|
|
500
546
|
}
|
|
501
547
|
}
|
|
@@ -540,17 +586,21 @@ var childMemberJoinedWorker = function* (options) {
|
|
|
540
586
|
});
|
|
541
587
|
const { member } = action.payload;
|
|
542
588
|
if (member == null ? void 0 : member.parent_id) {
|
|
543
|
-
const byId = yield sagaEffects4.select(
|
|
589
|
+
const byId = yield sagaEffects4.select(
|
|
590
|
+
componentSelectors.getComponentsById
|
|
591
|
+
);
|
|
544
592
|
const parent = Object.values(byId).find((row) => {
|
|
545
593
|
return "memberId" in row && row.memberId === member.parent_id;
|
|
546
594
|
});
|
|
547
595
|
if (parent) {
|
|
548
|
-
yield sagaEffects4.put(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
596
|
+
yield sagaEffects4.put(
|
|
597
|
+
componentActions.upsert({
|
|
598
|
+
id: instance.callId,
|
|
599
|
+
roomId: action.payload.room_id,
|
|
600
|
+
roomSessionId: action.payload.room_session_id,
|
|
601
|
+
memberId: member.id
|
|
602
|
+
})
|
|
603
|
+
);
|
|
554
604
|
onDone == null ? void 0 : onDone();
|
|
555
605
|
} else {
|
|
556
606
|
onFail == null ? void 0 : onFail({ error: new Error("Unknown parent_id") });
|
|
@@ -707,6 +757,7 @@ var videoWorker = function* (options) {
|
|
|
707
757
|
action
|
|
708
758
|
}, options));
|
|
709
759
|
return;
|
|
760
|
+
// Return since we don't need to handle the raw event for this
|
|
710
761
|
case "video.recording.started":
|
|
711
762
|
case "video.recording.updated":
|
|
712
763
|
case "video.recording.ended":
|
|
@@ -748,7 +799,10 @@ var videoWorker = function* (options) {
|
|
|
748
799
|
return action.type.startsWith("video.");
|
|
749
800
|
};
|
|
750
801
|
while (true) {
|
|
751
|
-
const action = yield sagaEffects5.take(
|
|
802
|
+
const action = yield sagaEffects5.take(
|
|
803
|
+
swEventChannel,
|
|
804
|
+
isVideoEvent
|
|
805
|
+
);
|
|
752
806
|
yield sagaEffects5.fork(worker, action);
|
|
753
807
|
}
|
|
754
808
|
getLogger10().trace("videoWorker ended");
|
|
@@ -782,8 +836,7 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
782
836
|
return Array.from(this._screenShareList);
|
|
783
837
|
}
|
|
784
838
|
_attachSpeakerTrackListener() {
|
|
785
|
-
if (!supportsMediaOutput())
|
|
786
|
-
return;
|
|
839
|
+
if (!supportsMediaOutput()) return;
|
|
787
840
|
createSpeakerDeviceWatcher().then((deviceWatcher) => {
|
|
788
841
|
deviceWatcher.on("removed", async (data) => {
|
|
789
842
|
var _a, _b;
|
|
@@ -799,8 +852,7 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
799
852
|
});
|
|
800
853
|
await ((_b = (_a = this._audioEl).setSinkId) == null ? void 0 : _b.call(_a, ""));
|
|
801
854
|
const defaultSpeakers = await getSpeakerById("default");
|
|
802
|
-
if (!(defaultSpeakers == null ? void 0 : defaultSpeakers.deviceId))
|
|
803
|
-
return;
|
|
855
|
+
if (!(defaultSpeakers == null ? void 0 : defaultSpeakers.deviceId)) return;
|
|
804
856
|
this.emit("speaker.updated", {
|
|
805
857
|
previous: {
|
|
806
858
|
deviceId: disconnectedSpeaker.payload.deviceId,
|
|
@@ -815,10 +867,12 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
815
867
|
});
|
|
816
868
|
});
|
|
817
869
|
}
|
|
870
|
+
/** @internal */
|
|
818
871
|
_finalize() {
|
|
819
872
|
this._screenShareList.clear();
|
|
820
873
|
super._finalize();
|
|
821
874
|
}
|
|
875
|
+
/** @internal */
|
|
822
876
|
async hangup(id) {
|
|
823
877
|
this._screenShareList.forEach((screenShare) => {
|
|
824
878
|
screenShare.leave();
|
|
@@ -828,14 +882,20 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
828
882
|
leave() {
|
|
829
883
|
return this.hangup();
|
|
830
884
|
}
|
|
885
|
+
/**
|
|
886
|
+
* This method will be called by `join()` right before the
|
|
887
|
+
* `connect()` happens and it's a way for us to control
|
|
888
|
+
* exactly when the workers are attached.
|
|
889
|
+
* @internal
|
|
890
|
+
*/
|
|
831
891
|
attachPreConnectWorkers() {
|
|
832
892
|
this.runWorker("memberListUpdated", {
|
|
833
893
|
worker: memberListUpdatedWorker
|
|
834
894
|
});
|
|
835
895
|
}
|
|
896
|
+
/** @internal */
|
|
836
897
|
getAudioEl() {
|
|
837
|
-
if (this._audioEl)
|
|
838
|
-
return this._audioEl;
|
|
898
|
+
if (this._audioEl) return this._audioEl;
|
|
839
899
|
this._audioEl = new Audio();
|
|
840
900
|
this._attachSpeakerTrackListener();
|
|
841
901
|
return this._audioEl;
|
|
@@ -843,6 +903,9 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
843
903
|
getMemberOverlay(memberId) {
|
|
844
904
|
return this.overlayMap.get(addOverlayPrefix(memberId));
|
|
845
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* Allow sharing the screen within the room.
|
|
908
|
+
*/
|
|
846
909
|
async startScreenShare(opts = {}) {
|
|
847
910
|
return new Promise(async (resolve, reject) => {
|
|
848
911
|
var _a;
|
|
@@ -906,23 +969,26 @@ var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
|
906
969
|
}
|
|
907
970
|
updateSpeaker({ deviceId }) {
|
|
908
971
|
const prevId = this.audioEl.sinkId;
|
|
909
|
-
this.once(
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
972
|
+
this.once(
|
|
973
|
+
// @ts-expect-error
|
|
974
|
+
`${LOCAL_EVENT_PREFIX2}.speaker.updated`,
|
|
975
|
+
async (newId) => {
|
|
976
|
+
const prevSpeaker = await getSpeakerById(prevId);
|
|
977
|
+
const newSpeaker = await getSpeakerById(newId);
|
|
978
|
+
const isSame = (newSpeaker == null ? void 0 : newSpeaker.deviceId) === (prevSpeaker == null ? void 0 : prevSpeaker.deviceId);
|
|
979
|
+
if (!(newSpeaker == null ? void 0 : newSpeaker.deviceId) || isSame) return;
|
|
980
|
+
this.emit("speaker.updated", {
|
|
981
|
+
previous: {
|
|
982
|
+
deviceId: prevSpeaker == null ? void 0 : prevSpeaker.deviceId,
|
|
983
|
+
label: prevSpeaker == null ? void 0 : prevSpeaker.label
|
|
984
|
+
},
|
|
985
|
+
current: {
|
|
986
|
+
deviceId: newSpeaker.deviceId,
|
|
987
|
+
label: newSpeaker.label
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
);
|
|
926
992
|
return this.triggerCustomSaga(audioSetSpeakerAction(deviceId));
|
|
927
993
|
}
|
|
928
994
|
};
|
|
@@ -971,7 +1037,9 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
971
1037
|
}
|
|
972
1038
|
get currentPosition() {
|
|
973
1039
|
var _a, _b;
|
|
974
|
-
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
1040
|
+
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
1041
|
+
(layer) => layer.member_id === this.memberId
|
|
1042
|
+
)) == null ? void 0 : _b.position;
|
|
975
1043
|
}
|
|
976
1044
|
get deviceList() {
|
|
977
1045
|
return Array.from(this._deviceList);
|
|
@@ -995,16 +1063,21 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
995
1063
|
worker: videoWorker
|
|
996
1064
|
});
|
|
997
1065
|
}
|
|
1066
|
+
/** @internal */
|
|
998
1067
|
getSubscriptions() {
|
|
999
1068
|
const eventNamesWithPrefix = this.eventNames().map((event) => {
|
|
1000
1069
|
return `video.${String(event)}`;
|
|
1001
1070
|
});
|
|
1002
|
-
return validateEventsToSubscribe3(
|
|
1071
|
+
return validateEventsToSubscribe3(
|
|
1072
|
+
eventNamesWithPrefix
|
|
1073
|
+
);
|
|
1003
1074
|
}
|
|
1075
|
+
/** @internal */
|
|
1004
1076
|
_finalize() {
|
|
1005
1077
|
this._deviceList.clear();
|
|
1006
1078
|
super._finalize();
|
|
1007
1079
|
}
|
|
1080
|
+
/** @internal */
|
|
1008
1081
|
async hangup(id) {
|
|
1009
1082
|
this._deviceList.forEach((device) => {
|
|
1010
1083
|
device.leave();
|
|
@@ -1014,15 +1087,27 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1014
1087
|
join() {
|
|
1015
1088
|
return super.invite();
|
|
1016
1089
|
}
|
|
1090
|
+
/**
|
|
1091
|
+
* @deprecated Use {@link getLayouts} instead. `getLayoutList` will
|
|
1092
|
+
* be removed in v3.0.0
|
|
1093
|
+
*/
|
|
1017
1094
|
getLayoutList() {
|
|
1018
1095
|
return this.getLayouts();
|
|
1019
1096
|
}
|
|
1097
|
+
/**
|
|
1098
|
+
* @deprecated Use {@link getMembers} instead. `getMemberList` will
|
|
1099
|
+
* be removed in v3.0.0
|
|
1100
|
+
*/
|
|
1020
1101
|
getMemberList() {
|
|
1021
1102
|
return this.getMembers();
|
|
1022
1103
|
}
|
|
1104
|
+
/** @deprecated Use {@link startScreenShare} instead. */
|
|
1023
1105
|
async createScreenShareObject(opts = {}) {
|
|
1024
1106
|
return this.startScreenShare(opts);
|
|
1025
1107
|
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Allow to add a camera to the room.
|
|
1110
|
+
*/
|
|
1026
1111
|
addCamera(opts = {}) {
|
|
1027
1112
|
const _a = opts, { autoJoin = true } = _a, video = __objRest(_a, ["autoJoin"]);
|
|
1028
1113
|
return this.addDevice({
|
|
@@ -1030,6 +1115,9 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1030
1115
|
video
|
|
1031
1116
|
});
|
|
1032
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Allow to add a microphone to the room.
|
|
1120
|
+
*/
|
|
1033
1121
|
addMicrophone(opts = {}) {
|
|
1034
1122
|
const _a = opts, { autoJoin = true } = _a, audio = __objRest(_a, ["autoJoin"]);
|
|
1035
1123
|
return this.addDevice({
|
|
@@ -1037,12 +1125,17 @@ var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1037
1125
|
audio
|
|
1038
1126
|
});
|
|
1039
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Allow to add additional devices to the room like cameras or microphones.
|
|
1130
|
+
*/
|
|
1040
1131
|
async addDevice(opts = {}) {
|
|
1041
1132
|
return new Promise(async (resolve, reject) => {
|
|
1042
1133
|
var _a;
|
|
1043
1134
|
const { autoJoin = true, audio = false, video = false } = opts;
|
|
1044
1135
|
if (!audio && !video) {
|
|
1045
|
-
throw new TypeError(
|
|
1136
|
+
throw new TypeError(
|
|
1137
|
+
"At least one of `audio` or `video` must be requested."
|
|
1138
|
+
);
|
|
1046
1139
|
}
|
|
1047
1140
|
const options = __spreadProps(__spreadValues({}, this.options), {
|
|
1048
1141
|
localStream: void 0,
|
|
@@ -1189,19 +1282,35 @@ import {
|
|
|
1189
1282
|
} from "@signalwire/core";
|
|
1190
1283
|
var wsClientWorker = function* (options) {
|
|
1191
1284
|
getLogger12().debug("wsClientWorker started");
|
|
1192
|
-
const { channels, initialState } = options;
|
|
1285
|
+
const { channels, initialState, instance: client } = options;
|
|
1193
1286
|
const { swEventChannel } = channels;
|
|
1194
1287
|
const { handleIncomingInvite } = initialState;
|
|
1288
|
+
function* fireHoseWorker(action) {
|
|
1289
|
+
client.emit(action.type, action.payload);
|
|
1290
|
+
}
|
|
1291
|
+
function* vertoInviteWorker(action) {
|
|
1292
|
+
handleIncomingInvite(action.payload.params);
|
|
1293
|
+
}
|
|
1294
|
+
const isVertoInvite = (action) => {
|
|
1295
|
+
if (action.type === "webrtc.message") {
|
|
1296
|
+
return action.payload.method === "verto.invite";
|
|
1297
|
+
}
|
|
1298
|
+
return false;
|
|
1299
|
+
};
|
|
1195
1300
|
try {
|
|
1196
1301
|
while (true) {
|
|
1197
|
-
const action = yield sagaEffects6.take(
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1302
|
+
const action = yield sagaEffects6.take(
|
|
1303
|
+
swEventChannel,
|
|
1304
|
+
() => true
|
|
1305
|
+
);
|
|
1306
|
+
yield sagaEffects6.fork(fireHoseWorker, action);
|
|
1307
|
+
if (isVertoInvite(action)) {
|
|
1308
|
+
getLogger12().debug("Receiving a call over WebSocket", action);
|
|
1309
|
+
yield sagaEffects6.fork(
|
|
1310
|
+
vertoInviteWorker,
|
|
1311
|
+
action
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1205
1314
|
}
|
|
1206
1315
|
} finally {
|
|
1207
1316
|
getLogger12().trace("wsClientWorker ended");
|
|
@@ -1224,7 +1333,10 @@ var conversationWorker = function* (options) {
|
|
|
1224
1333
|
return action.type.startsWith("conversation.");
|
|
1225
1334
|
};
|
|
1226
1335
|
while (true) {
|
|
1227
|
-
const action = yield sagaEffects7.take(
|
|
1336
|
+
const action = yield sagaEffects7.take(
|
|
1337
|
+
swEventChannel,
|
|
1338
|
+
isConversationEvent
|
|
1339
|
+
);
|
|
1228
1340
|
conversation.handleEvent(action.payload);
|
|
1229
1341
|
}
|
|
1230
1342
|
getLogger13().trace("conversationWorker ended");
|
|
@@ -1313,6 +1425,7 @@ var FabricRoomSessionMemberAPI = class extends BaseComponent {
|
|
|
1313
1425
|
get subscriberData() {
|
|
1314
1426
|
return this._payload.member.subscriber_data;
|
|
1315
1427
|
}
|
|
1428
|
+
/** @internal */
|
|
1316
1429
|
setPayload(payload) {
|
|
1317
1430
|
const newPayload = __spreadProps(__spreadValues(__spreadValues({}, this._payload), payload), {
|
|
1318
1431
|
member: __spreadValues(__spreadValues({}, this._payload.member), payload.member)
|
|
@@ -1359,7 +1472,6 @@ import {
|
|
|
1359
1472
|
getLogger as getLogger16,
|
|
1360
1473
|
sagaEffects as sagaEffects8,
|
|
1361
1474
|
MemberPosition as MemberPosition2,
|
|
1362
|
-
mapCapabilityPayload,
|
|
1363
1475
|
stripNamespacePrefix as stripNamespacePrefix6
|
|
1364
1476
|
} from "@signalwire/core";
|
|
1365
1477
|
|
|
@@ -1436,7 +1548,9 @@ var mapInternalFabricMemberToInternalVideoMemberEntity = (params) => {
|
|
|
1436
1548
|
};
|
|
1437
1549
|
var mapInternalFabricMemberToInternalVideoMemberUpdatedEntity = (params) => {
|
|
1438
1550
|
return __spreadProps(__spreadValues({}, mapInternalFabricMemberToInternalVideoMemberEntity(params)), {
|
|
1439
|
-
updated: params.updated.map(
|
|
1551
|
+
updated: params.updated.map(
|
|
1552
|
+
(key) => key === "member_id" ? "id" : key
|
|
1553
|
+
)
|
|
1440
1554
|
});
|
|
1441
1555
|
};
|
|
1442
1556
|
var mapInternalFabricRoomToInternalVideoRoomEntity = (params) => {
|
|
@@ -1470,7 +1584,9 @@ var mapInternalFabricRoomToInternalVideoRoomSessionEntity = (params) => {
|
|
|
1470
1584
|
layout_name: params.layout_name,
|
|
1471
1585
|
locked: params.locked,
|
|
1472
1586
|
meta: params.meta,
|
|
1473
|
-
members: params.members.map(
|
|
1587
|
+
members: params.members.map(
|
|
1588
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1589
|
+
),
|
|
1474
1590
|
streaming: params.streaming,
|
|
1475
1591
|
streams: params.streams,
|
|
1476
1592
|
prioritize_handraise: params.prioritize_handraise,
|
|
@@ -1482,10 +1598,16 @@ var mapCallJoinedToRoomSubscribedEventParams = (params) => {
|
|
|
1482
1598
|
call_id: params.call_id,
|
|
1483
1599
|
member_id: params.member_id,
|
|
1484
1600
|
room: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomEntity(params.room_session)), {
|
|
1485
|
-
members: params.room_session.members.map(
|
|
1601
|
+
members: params.room_session.members.map(
|
|
1602
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1603
|
+
)
|
|
1486
1604
|
}),
|
|
1487
|
-
room_session: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomSessionEntity(
|
|
1488
|
-
|
|
1605
|
+
room_session: __spreadProps(__spreadValues({}, mapInternalFabricRoomToInternalVideoRoomSessionEntity(
|
|
1606
|
+
params.room_session
|
|
1607
|
+
)), {
|
|
1608
|
+
members: params.room_session.members.map(
|
|
1609
|
+
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1610
|
+
)
|
|
1489
1611
|
})
|
|
1490
1612
|
};
|
|
1491
1613
|
};
|
|
@@ -1506,13 +1628,17 @@ var mapFabricMemberEventToVideoMemberUpdatedEventParams = (params) => {
|
|
|
1506
1628
|
return {
|
|
1507
1629
|
room_session_id: params.room_session_id,
|
|
1508
1630
|
room_id: params.room_id,
|
|
1509
|
-
member: mapInternalFabricMemberToInternalVideoMemberUpdatedEntity(
|
|
1631
|
+
member: mapInternalFabricMemberToInternalVideoMemberUpdatedEntity(
|
|
1632
|
+
params.member
|
|
1633
|
+
)
|
|
1510
1634
|
};
|
|
1511
1635
|
};
|
|
1512
1636
|
var mapFabricMemberActionToVideoMemberUpdatedAction = (action) => {
|
|
1513
1637
|
return {
|
|
1514
1638
|
type: `video.${action.type}`,
|
|
1515
|
-
payload: mapFabricMemberEventToVideoMemberUpdatedEventParams(
|
|
1639
|
+
payload: mapFabricMemberEventToVideoMemberUpdatedEventParams(
|
|
1640
|
+
action.payload
|
|
1641
|
+
)
|
|
1516
1642
|
};
|
|
1517
1643
|
};
|
|
1518
1644
|
var mapFabricLayoutActionToVideoLayoutAction = (action) => {
|
|
@@ -1522,6 +1648,146 @@ var mapFabricLayoutActionToVideoLayoutAction = (action) => {
|
|
|
1522
1648
|
};
|
|
1523
1649
|
};
|
|
1524
1650
|
|
|
1651
|
+
// src/fabric/utils/capabilitiesHelpers.ts
|
|
1652
|
+
var CapabilityOnOffState = class {
|
|
1653
|
+
constructor(_flags) {
|
|
1654
|
+
this._flags = _flags;
|
|
1655
|
+
}
|
|
1656
|
+
get on() {
|
|
1657
|
+
return this._flags.some((flag) => !flag.endsWith(".off"));
|
|
1658
|
+
}
|
|
1659
|
+
get off() {
|
|
1660
|
+
return this._flags.some((flag) => !flag.endsWith(".on"));
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
var MemberCapability = class {
|
|
1664
|
+
constructor(_flags, _memberType) {
|
|
1665
|
+
this._flags = _flags;
|
|
1666
|
+
this._memberType = _memberType;
|
|
1667
|
+
__publicField(this, "_muteAudio");
|
|
1668
|
+
__publicField(this, "_muteVideo");
|
|
1669
|
+
__publicField(this, "_deaf");
|
|
1670
|
+
}
|
|
1671
|
+
get muteAudio() {
|
|
1672
|
+
var _a;
|
|
1673
|
+
this._muteAudio = (_a = this._muteAudio) != null ? _a : new CapabilityOnOffState(
|
|
1674
|
+
this._flags.filter(
|
|
1675
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.audio`)
|
|
1676
|
+
)
|
|
1677
|
+
);
|
|
1678
|
+
return this._muteAudio;
|
|
1679
|
+
}
|
|
1680
|
+
get muteVideo() {
|
|
1681
|
+
var _a;
|
|
1682
|
+
this._muteVideo = (_a = this._muteVideo) != null ? _a : new CapabilityOnOffState(
|
|
1683
|
+
this._flags.filter(
|
|
1684
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.video`)
|
|
1685
|
+
)
|
|
1686
|
+
);
|
|
1687
|
+
return this._muteVideo;
|
|
1688
|
+
}
|
|
1689
|
+
get microphoneVolume() {
|
|
1690
|
+
return this._flags.some(
|
|
1691
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.volume`)
|
|
1692
|
+
);
|
|
1693
|
+
}
|
|
1694
|
+
get microphoneSensitivity() {
|
|
1695
|
+
return this._flags.some(
|
|
1696
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.sensitivity`)
|
|
1697
|
+
);
|
|
1698
|
+
}
|
|
1699
|
+
get speakerVolume() {
|
|
1700
|
+
return this._flags.some(
|
|
1701
|
+
(flag) => flag === this._memberType || flag === `${this._memberType}.speaker` || flag.startsWith(`${this._memberType}.speaker.volume`)
|
|
1702
|
+
);
|
|
1703
|
+
}
|
|
1704
|
+
get deaf() {
|
|
1705
|
+
var _a;
|
|
1706
|
+
this._deaf = (_a = this._deaf) != null ? _a : new CapabilityOnOffState(
|
|
1707
|
+
this._flags.filter(
|
|
1708
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.deaf`)
|
|
1709
|
+
)
|
|
1710
|
+
);
|
|
1711
|
+
return this._deaf;
|
|
1712
|
+
}
|
|
1713
|
+
get raisehand() {
|
|
1714
|
+
return {
|
|
1715
|
+
on: true,
|
|
1716
|
+
off: true
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
get position() {
|
|
1720
|
+
return this._flags.some(
|
|
1721
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.position`)
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1724
|
+
get meta() {
|
|
1725
|
+
return this._flags.some(
|
|
1726
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.meta`)
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
get remove() {
|
|
1730
|
+
return this._flags.some(
|
|
1731
|
+
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.remove`)
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1734
|
+
};
|
|
1735
|
+
var CallCapabilities = class {
|
|
1736
|
+
constructor(_flags) {
|
|
1737
|
+
this._flags = _flags;
|
|
1738
|
+
__publicField(this, "_self");
|
|
1739
|
+
__publicField(this, "_member");
|
|
1740
|
+
__publicField(this, "_vmutedHide");
|
|
1741
|
+
__publicField(this, "_lock");
|
|
1742
|
+
}
|
|
1743
|
+
_buildMemberCapability(memberType) {
|
|
1744
|
+
return new MemberCapability(
|
|
1745
|
+
this._flags.filter((flag) => flag.startsWith(memberType)),
|
|
1746
|
+
memberType
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
get self() {
|
|
1750
|
+
var _a;
|
|
1751
|
+
this._self = (_a = this._self) != null ? _a : this._buildMemberCapability("self");
|
|
1752
|
+
return this._self;
|
|
1753
|
+
}
|
|
1754
|
+
get member() {
|
|
1755
|
+
var _a;
|
|
1756
|
+
this._member = (_a = this._member) != null ? _a : this._buildMemberCapability("member");
|
|
1757
|
+
return this._member;
|
|
1758
|
+
}
|
|
1759
|
+
get end() {
|
|
1760
|
+
return this._flags.some((capability) => capability === "end");
|
|
1761
|
+
}
|
|
1762
|
+
get setLayout() {
|
|
1763
|
+
return this._flags.some((capability) => capability.startsWith("layout"));
|
|
1764
|
+
}
|
|
1765
|
+
get sendDigit() {
|
|
1766
|
+
return this._flags.some((capability) => capability.startsWith("digit"));
|
|
1767
|
+
}
|
|
1768
|
+
get vmutedHide() {
|
|
1769
|
+
var _a;
|
|
1770
|
+
this._vmutedHide = (_a = this._vmutedHide) != null ? _a : new CapabilityOnOffState(
|
|
1771
|
+
this._flags.filter((flag) => flag.startsWith("vmuted"))
|
|
1772
|
+
);
|
|
1773
|
+
return this._vmutedHide;
|
|
1774
|
+
}
|
|
1775
|
+
get lock() {
|
|
1776
|
+
var _a;
|
|
1777
|
+
this._lock = (_a = this._lock) != null ? _a : new CapabilityOnOffState(
|
|
1778
|
+
this._flags.filter((flag) => flag.startsWith("lock"))
|
|
1779
|
+
);
|
|
1780
|
+
return this._lock;
|
|
1781
|
+
}
|
|
1782
|
+
get device() {
|
|
1783
|
+
return this._flags.some((capability) => capability === "device");
|
|
1784
|
+
}
|
|
1785
|
+
get screenshare() {
|
|
1786
|
+
return this._flags.some((capability) => capability === "screenshare");
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
var mapCapabilityPayload = (capabilities) => new CallCapabilities(capabilities);
|
|
1790
|
+
|
|
1525
1791
|
// src/fabric/workers/callJoinWorker.ts
|
|
1526
1792
|
var callJoinWorker = function* (options) {
|
|
1527
1793
|
var _a;
|
|
@@ -1530,6 +1796,11 @@ var callJoinWorker = function* (options) {
|
|
|
1530
1796
|
const { payload } = action;
|
|
1531
1797
|
const { get, set } = instanceMap;
|
|
1532
1798
|
yield sagaEffects8.fork(MemberPosition2.memberPositionWorker, __spreadProps(__spreadValues({}, options), {
|
|
1799
|
+
/**
|
|
1800
|
+
* The {@link memberPositionWorker} worker understands only the Video SDK events.
|
|
1801
|
+
* So, we need to map CF SDK event to Video SDK event.
|
|
1802
|
+
* Similar to what we do in the {@link callSegmentWorker}, for member events.
|
|
1803
|
+
*/
|
|
1533
1804
|
initialState: mapCallJoinedToRoomSubscribedEventParams(payload),
|
|
1534
1805
|
dispatcher: function* (subType, subPayload) {
|
|
1535
1806
|
const fabricType = stripNamespacePrefix6(subType, "video");
|
|
@@ -1564,10 +1835,11 @@ var callJoinWorker = function* (options) {
|
|
|
1564
1835
|
set(member.member_id, memberInstance);
|
|
1565
1836
|
});
|
|
1566
1837
|
cfRoomSession.member = get(payload.member_id);
|
|
1567
|
-
cfRoomSession.capabilities = mapCapabilityPayload(payload.capabilities
|
|
1568
|
-
|
|
1838
|
+
cfRoomSession.capabilities = mapCapabilityPayload(payload.capabilities);
|
|
1839
|
+
const fabricEvent = __spreadProps(__spreadValues({}, payload), {
|
|
1569
1840
|
capabilities: cfRoomSession.capabilities
|
|
1570
|
-
})
|
|
1841
|
+
});
|
|
1842
|
+
cfRoomSession.emit("call.joined", fabricEvent);
|
|
1571
1843
|
getLogger16().trace("callJoinWorker ended");
|
|
1572
1844
|
};
|
|
1573
1845
|
|
|
@@ -1580,7 +1852,9 @@ var callSegmentWorker = function* (options) {
|
|
|
1580
1852
|
} = options;
|
|
1581
1853
|
const segmentCallId = action.payload.call_id;
|
|
1582
1854
|
const segmentRooSessionId = action.payload.room_session_id;
|
|
1583
|
-
getLogger17().debug(
|
|
1855
|
+
getLogger17().debug(
|
|
1856
|
+
`callSegmentWorker started for: callId ${segmentCallId}, roomSessionId ${segmentRooSessionId}`
|
|
1857
|
+
);
|
|
1584
1858
|
yield sagaEffects9.fork(callJoinWorker, __spreadProps(__spreadValues({}, options), {
|
|
1585
1859
|
action
|
|
1586
1860
|
}));
|
|
@@ -1607,6 +1881,20 @@ var callSegmentWorker = function* (options) {
|
|
|
1607
1881
|
case "call.room":
|
|
1608
1882
|
cfRoomSession.emit(type, payload);
|
|
1609
1883
|
break;
|
|
1884
|
+
/**
|
|
1885
|
+
* The Core module includes a generic worker, {@link memberPositionWorker},
|
|
1886
|
+
* which listens for member & layout events to add a "current_position" parameter
|
|
1887
|
+
* and handle member "updated" parameter.
|
|
1888
|
+
* This worker in CF SDK is initialized by the {@link callJoinWorker} worker.
|
|
1889
|
+
*
|
|
1890
|
+
* To ensure compatibility, we map these events to Video SDK events and
|
|
1891
|
+
* re-publish them on the channel so that they can be processed by the
|
|
1892
|
+
* generic worker. Note that the generic worker only dispatches "member.updated"
|
|
1893
|
+
* and "member.updated.*" events.
|
|
1894
|
+
*
|
|
1895
|
+
* Additionally, the "member.joined" event is monitored by another worker,
|
|
1896
|
+
* {@link childMemberJoinedWorker}, specifically for the screen share API.
|
|
1897
|
+
*/
|
|
1610
1898
|
case "member.joined":
|
|
1611
1899
|
case "member.left": {
|
|
1612
1900
|
yield sagaEffects9.fork(fabricMemberWorker, __spreadProps(__spreadValues({}, options), {
|
|
@@ -1651,11 +1939,13 @@ var callSegmentWorker = function* (options) {
|
|
|
1651
1939
|
return false;
|
|
1652
1940
|
};
|
|
1653
1941
|
while (true) {
|
|
1654
|
-
const action2 = yield sagaEffects9.take(
|
|
1942
|
+
const action2 = yield sagaEffects9.take(
|
|
1943
|
+
swEventChannel,
|
|
1944
|
+
isSegmentEvent
|
|
1945
|
+
);
|
|
1655
1946
|
const task = yield sagaEffects9.fork(worker, action2);
|
|
1656
1947
|
const shouldStop = yield sagaEffects9.join(task);
|
|
1657
|
-
if (shouldStop)
|
|
1658
|
-
return;
|
|
1948
|
+
if (shouldStop) return;
|
|
1659
1949
|
}
|
|
1660
1950
|
};
|
|
1661
1951
|
|
|
@@ -1674,7 +1964,9 @@ var fabricWorker = function* (options) {
|
|
|
1674
1964
|
const memberInstance = createFabricRoomSessionMemberObject({
|
|
1675
1965
|
store: cfRoomSession.store,
|
|
1676
1966
|
payload: {
|
|
1677
|
-
member: action.payload.room_session.members.find(
|
|
1967
|
+
member: action.payload.room_session.members.find(
|
|
1968
|
+
(m) => m.member_id === action.payload.member_id
|
|
1969
|
+
),
|
|
1678
1970
|
room_id: action.payload.room_id,
|
|
1679
1971
|
room_session_id: action.payload.room_session_id
|
|
1680
1972
|
}
|
|
@@ -1712,7 +2004,10 @@ var fabricWorker = function* (options) {
|
|
|
1712
2004
|
return true;
|
|
1713
2005
|
};
|
|
1714
2006
|
while (true) {
|
|
1715
|
-
const action = yield sagaEffects10.take(
|
|
2007
|
+
const action = yield sagaEffects10.take(
|
|
2008
|
+
swEventChannel,
|
|
2009
|
+
isFirstCallJoinedorCallStateEvent
|
|
2010
|
+
);
|
|
1716
2011
|
yield sagaEffects10.fork(worker, action);
|
|
1717
2012
|
}
|
|
1718
2013
|
getLogger18().trace("fabricWorker ended");
|
|
@@ -1722,10 +2017,13 @@ var fabricWorker = function* (options) {
|
|
|
1722
2017
|
var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
1723
2018
|
constructor(options) {
|
|
1724
2019
|
super(options);
|
|
2020
|
+
// this is "self" parameter required by the RPC, and is always "the member" on the 1st call segment
|
|
1725
2021
|
__publicField(this, "_self");
|
|
2022
|
+
// this is "the member" on the last/active call segment
|
|
1726
2023
|
__publicField(this, "_member");
|
|
1727
2024
|
__publicField(this, "_currentLayoutEvent");
|
|
1728
|
-
|
|
2025
|
+
//describes what are methods are allow for the user in a call segment
|
|
2026
|
+
__publicField(this, "_capabilities");
|
|
1729
2027
|
this.initWorker();
|
|
1730
2028
|
}
|
|
1731
2029
|
get memberId() {
|
|
@@ -1744,7 +2042,9 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1744
2042
|
}
|
|
1745
2043
|
get currentPosition() {
|
|
1746
2044
|
var _a, _b;
|
|
1747
|
-
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
2045
|
+
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
2046
|
+
(layer) => layer.member_id === this.memberId
|
|
2047
|
+
)) == null ? void 0 : _b.position;
|
|
1748
2048
|
}
|
|
1749
2049
|
get capabilities() {
|
|
1750
2050
|
return this._capabilities;
|
|
@@ -1779,37 +2079,44 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1779
2079
|
if (this.options.attach) {
|
|
1780
2080
|
this.options.prevCallId = (_b = (_a = getStorage()) == null ? void 0 : _a.getItem(PREVIOUS_CALLID_STORAGE_KEY)) != null ? _b : void 0;
|
|
1781
2081
|
}
|
|
1782
|
-
this.logger.debug(
|
|
2082
|
+
this.logger.debug(
|
|
2083
|
+
`Tying to reattach to previuos call? ${!!this.options.prevCallId} - prevCallId: ${this.options.prevCallId}`
|
|
2084
|
+
);
|
|
1783
2085
|
return super.invite();
|
|
1784
2086
|
}
|
|
1785
2087
|
executeAction(params, options = {}) {
|
|
1786
2088
|
var _a, _b, _c;
|
|
1787
2089
|
const { method, channel, memberId, extraParams = {} } = params;
|
|
1788
2090
|
const targetMember = memberId ? this.instanceMap.get(memberId) : this.member;
|
|
1789
|
-
if (!targetMember)
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2091
|
+
if (!targetMember) throw new Error("No target param found to execute");
|
|
2092
|
+
return this.execute(
|
|
2093
|
+
{
|
|
2094
|
+
method,
|
|
2095
|
+
params: __spreadValues(__spreadProps(__spreadValues({}, channel && { channels: [channel] }), {
|
|
2096
|
+
self: {
|
|
2097
|
+
member_id: (_a = this.selfMember) == null ? void 0 : _a.id,
|
|
2098
|
+
call_id: (_b = this.selfMember) == null ? void 0 : _b.callId,
|
|
2099
|
+
node_id: (_c = this.selfMember) == null ? void 0 : _c.nodeId
|
|
2100
|
+
},
|
|
2101
|
+
target: {
|
|
2102
|
+
member_id: targetMember.id,
|
|
2103
|
+
call_id: targetMember.callId,
|
|
2104
|
+
node_id: targetMember.nodeId
|
|
2105
|
+
}
|
|
2106
|
+
}), extraParams)
|
|
2107
|
+
},
|
|
2108
|
+
options
|
|
2109
|
+
);
|
|
1806
2110
|
}
|
|
2111
|
+
/** @internal */
|
|
1807
2112
|
async resume() {
|
|
1808
2113
|
var _a;
|
|
1809
2114
|
this.logger.warn(`[resume] Call ${this.id}`);
|
|
1810
2115
|
if ((_a = this.peer) == null ? void 0 : _a.instance) {
|
|
1811
2116
|
const { connectionState } = this.peer.instance;
|
|
1812
|
-
this.logger.debug(
|
|
2117
|
+
this.logger.debug(
|
|
2118
|
+
`[resume] connectionState for ${this.id} is '${connectionState}'`
|
|
2119
|
+
);
|
|
1813
2120
|
if (["closed", "failed", "disconnected"].includes(connectionState)) {
|
|
1814
2121
|
this.resuming = true;
|
|
1815
2122
|
this.peer.restartIce();
|
|
@@ -1836,8 +2143,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1836
2143
|
});
|
|
1837
2144
|
}
|
|
1838
2145
|
async audioMute(params) {
|
|
1839
|
-
var _a, _b
|
|
1840
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2146
|
+
var _a, _b;
|
|
2147
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.off)) {
|
|
1841
2148
|
throw Error("Missing audio mute capability");
|
|
1842
2149
|
}
|
|
1843
2150
|
return this.executeAction({
|
|
@@ -1847,8 +2154,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1847
2154
|
});
|
|
1848
2155
|
}
|
|
1849
2156
|
async audioUnmute(params) {
|
|
1850
|
-
var _a, _b
|
|
1851
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2157
|
+
var _a, _b;
|
|
2158
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.on)) {
|
|
1852
2159
|
throw Error("Missing audio unmute capability");
|
|
1853
2160
|
}
|
|
1854
2161
|
return this.executeAction({
|
|
@@ -1858,8 +2165,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1858
2165
|
});
|
|
1859
2166
|
}
|
|
1860
2167
|
async videoMute(params) {
|
|
1861
|
-
var _a, _b
|
|
1862
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2168
|
+
var _a, _b;
|
|
2169
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.on)) {
|
|
1863
2170
|
throw Error("Missing video mute capability");
|
|
1864
2171
|
}
|
|
1865
2172
|
return this.executeAction({
|
|
@@ -1869,8 +2176,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1869
2176
|
});
|
|
1870
2177
|
}
|
|
1871
2178
|
async videoUnmute(params) {
|
|
1872
|
-
var _a, _b
|
|
1873
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2179
|
+
var _a, _b;
|
|
2180
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.on)) {
|
|
1874
2181
|
throw Error("Missing video unmute capability");
|
|
1875
2182
|
}
|
|
1876
2183
|
return this.executeAction({
|
|
@@ -1880,8 +2187,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1880
2187
|
});
|
|
1881
2188
|
}
|
|
1882
2189
|
async deaf(params) {
|
|
1883
|
-
var _a, _b
|
|
1884
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2190
|
+
var _a, _b;
|
|
2191
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.deaf.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.deaf.on)) {
|
|
1885
2192
|
throw Error("Missing deaf capability");
|
|
1886
2193
|
}
|
|
1887
2194
|
return this.executeAction({
|
|
@@ -1890,8 +2197,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1890
2197
|
});
|
|
1891
2198
|
}
|
|
1892
2199
|
async undeaf(params) {
|
|
1893
|
-
var _a, _b
|
|
1894
|
-
if (!params || params.memberId === this.member.id ? !((
|
|
2200
|
+
var _a, _b;
|
|
2201
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.deaf.off) : !((_b = this.capabilities) == null ? void 0 : _b.member.deaf.off)) {
|
|
1895
2202
|
throw Error("Missing undeaf capability");
|
|
1896
2203
|
}
|
|
1897
2204
|
return this.executeAction({
|
|
@@ -1900,26 +2207,32 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1900
2207
|
});
|
|
1901
2208
|
}
|
|
1902
2209
|
async getLayouts() {
|
|
1903
|
-
return this.executeAction(
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2210
|
+
return this.executeAction(
|
|
2211
|
+
{
|
|
2212
|
+
method: "call.layout.list"
|
|
2213
|
+
},
|
|
2214
|
+
{
|
|
2215
|
+
transformResolve: (payload) => ({
|
|
2216
|
+
layouts: payload.layouts
|
|
2217
|
+
})
|
|
2218
|
+
}
|
|
2219
|
+
);
|
|
1910
2220
|
}
|
|
1911
2221
|
async getMembers() {
|
|
1912
|
-
return this.executeAction(
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2222
|
+
return this.executeAction(
|
|
2223
|
+
{
|
|
2224
|
+
method: "call.member.list"
|
|
2225
|
+
},
|
|
2226
|
+
{
|
|
2227
|
+
transformResolve: (payload) => ({
|
|
2228
|
+
members: payload.members
|
|
2229
|
+
})
|
|
2230
|
+
}
|
|
2231
|
+
);
|
|
1919
2232
|
}
|
|
1920
2233
|
async removeMember(params) {
|
|
1921
2234
|
var _a;
|
|
1922
|
-
if (!((_a = this.capabilities
|
|
2235
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.member.remove)) {
|
|
1923
2236
|
throw Error("Missing setLayout capability");
|
|
1924
2237
|
}
|
|
1925
2238
|
if (!(params == null ? void 0 : params.memberId)) {
|
|
@@ -1931,12 +2244,12 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1931
2244
|
});
|
|
1932
2245
|
}
|
|
1933
2246
|
async setRaisedHand(params) {
|
|
1934
|
-
var _a, _b, _c, _d
|
|
2247
|
+
var _a, _b, _c, _d;
|
|
1935
2248
|
const { raised = true, memberId } = params || {};
|
|
1936
|
-
if (memberId == this.member.id && raised ? !((
|
|
2249
|
+
if (memberId == this.member.id && raised ? !((_a = this.capabilities) == null ? void 0 : _a.self.raisehand.on) : !((_b = this.capabilities) == null ? void 0 : _b.member.raisehand.on)) {
|
|
1937
2250
|
throw Error("Missing raisehand capability");
|
|
1938
2251
|
}
|
|
1939
|
-
if (memberId == this.member.id && !raised ? !((
|
|
2252
|
+
if (memberId == this.member.id && !raised ? !((_c = this.capabilities) == null ? void 0 : _c.self.raisehand.off) : !((_d = this.capabilities) == null ? void 0 : _d.member.raisehand.off)) {
|
|
1940
2253
|
throw Error("Missing lowerhand capability");
|
|
1941
2254
|
}
|
|
1942
2255
|
return this.executeAction({
|
|
@@ -1945,7 +2258,8 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1945
2258
|
});
|
|
1946
2259
|
}
|
|
1947
2260
|
async setLayout(params) {
|
|
1948
|
-
|
|
2261
|
+
var _a;
|
|
2262
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.setLayout)) {
|
|
1949
2263
|
throw Error("Missing setLayout capability");
|
|
1950
2264
|
}
|
|
1951
2265
|
const extraParams = {
|
|
@@ -1959,7 +2273,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1959
2273
|
}
|
|
1960
2274
|
async setInputVolume(params) {
|
|
1961
2275
|
var _a, _b;
|
|
1962
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2276
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.microphoneVolume) : !((_b = this.capabilities) == null ? void 0 : _b.member.microphoneVolume)) {
|
|
1963
2277
|
throw Error("Missing setInputVolume capability");
|
|
1964
2278
|
}
|
|
1965
2279
|
return this.executeAction({
|
|
@@ -1972,7 +2286,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1972
2286
|
}
|
|
1973
2287
|
async setOutputVolume(params) {
|
|
1974
2288
|
var _a, _b;
|
|
1975
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2289
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.speakerVolume) : !((_b = this.capabilities) == null ? void 0 : _b.member.speakerVolume)) {
|
|
1976
2290
|
throw Error("Missing setOutputVolume capability");
|
|
1977
2291
|
}
|
|
1978
2292
|
return this.executeAction({
|
|
@@ -1985,7 +2299,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
1985
2299
|
}
|
|
1986
2300
|
async setInputSensitivity(params) {
|
|
1987
2301
|
var _a, _b;
|
|
1988
|
-
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities
|
|
2302
|
+
if (!params || params.memberId === this.member.id ? !((_a = this.capabilities) == null ? void 0 : _a.self.microphoneSensitivity) : !((_b = this.capabilities) == null ? void 0 : _b.member.microphoneSensitivity)) {
|
|
1989
2303
|
throw Error("Missing setOutputVolume capability");
|
|
1990
2304
|
}
|
|
1991
2305
|
return this.executeAction({
|
|
@@ -2002,7 +2316,9 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
2002
2316
|
if (positions && !Object.keys(positions).length) {
|
|
2003
2317
|
throw new Error("Invalid positions");
|
|
2004
2318
|
}
|
|
2005
|
-
if (Object.keys(positions).some(
|
|
2319
|
+
if (Object.keys(positions).some(
|
|
2320
|
+
(p) => ["self", `${this.memberId}`].includes(p)
|
|
2321
|
+
) ? !((_a = this.capabilities) == null ? void 0 : _a.self.position) : !((_b = this.capabilities) == null ? void 0 : _b.member.position)) {
|
|
2006
2322
|
throw Error("Missing setPositions capability");
|
|
2007
2323
|
}
|
|
2008
2324
|
const targets = [];
|
|
@@ -2036,7 +2352,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
2036
2352
|
}
|
|
2037
2353
|
async lock() {
|
|
2038
2354
|
var _a;
|
|
2039
|
-
if (!((_a = this.capabilities
|
|
2355
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.on)) {
|
|
2040
2356
|
throw Error("Missing lock capability");
|
|
2041
2357
|
}
|
|
2042
2358
|
return this.executeAction({
|
|
@@ -2045,7 +2361,7 @@ var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
|
2045
2361
|
}
|
|
2046
2362
|
async unlock() {
|
|
2047
2363
|
var _a;
|
|
2048
|
-
if (!((_a = this.capabilities
|
|
2364
|
+
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.off)) {
|
|
2049
2365
|
throw Error("Missing unlock capability");
|
|
2050
2366
|
}
|
|
2051
2367
|
return this.executeAction({
|
|
@@ -2123,16 +2439,29 @@ var LocalVideoOverlay = class extends UserOverlay {
|
|
|
2123
2439
|
}
|
|
2124
2440
|
attachListeners() {
|
|
2125
2441
|
if (isFabricRoomSession(this._room)) {
|
|
2126
|
-
this._room.on(
|
|
2442
|
+
this._room.on(
|
|
2443
|
+
"member.updated.videoMuted",
|
|
2444
|
+
this.fabricMemberVideoMutedHandler
|
|
2445
|
+
);
|
|
2127
2446
|
} else if (isVideoRoomSession(this._room)) {
|
|
2128
|
-
this._room.on(
|
|
2447
|
+
this._room.on(
|
|
2448
|
+
"member.updated.videoMuted",
|
|
2449
|
+
this.videoMemberVideoMutedHandler
|
|
2450
|
+
);
|
|
2129
2451
|
}
|
|
2130
2452
|
}
|
|
2453
|
+
/** @internal */
|
|
2131
2454
|
detachListeners() {
|
|
2132
2455
|
if (isFabricRoomSession(this._room)) {
|
|
2133
|
-
this._room.off(
|
|
2456
|
+
this._room.off(
|
|
2457
|
+
"member.updated.videoMuted",
|
|
2458
|
+
this.fabricMemberVideoMutedHandler
|
|
2459
|
+
);
|
|
2134
2460
|
} else if (isVideoRoomSession(this._room)) {
|
|
2135
|
-
this._room.off(
|
|
2461
|
+
this._room.off(
|
|
2462
|
+
"member.updated.videoMuted",
|
|
2463
|
+
this.videoMemberVideoMutedHandler
|
|
2464
|
+
);
|
|
2136
2465
|
}
|
|
2137
2466
|
}
|
|
2138
2467
|
memberVideoMutedHandler(memberId, videoMuted) {
|
|
@@ -2145,7 +2474,10 @@ var LocalVideoOverlay = class extends UserOverlay {
|
|
|
2145
2474
|
}
|
|
2146
2475
|
}
|
|
2147
2476
|
fabricMemberVideoMutedHandler(params) {
|
|
2148
|
-
this.memberVideoMutedHandler(
|
|
2477
|
+
this.memberVideoMutedHandler(
|
|
2478
|
+
params.member.member_id,
|
|
2479
|
+
params.member.video_muted
|
|
2480
|
+
);
|
|
2149
2481
|
}
|
|
2150
2482
|
videoMemberVideoMutedHandler(params) {
|
|
2151
2483
|
this.memberVideoMutedHandler(params.member.id, params.member.video_muted);
|
|
@@ -2292,8 +2624,7 @@ var makeLayoutChangedHandler = (params) => {
|
|
|
2292
2624
|
if (applyMemberOverlay) {
|
|
2293
2625
|
layers.forEach((location) => {
|
|
2294
2626
|
const memberIdInLocation = location.member_id;
|
|
2295
|
-
if (!memberIdInLocation)
|
|
2296
|
-
return;
|
|
2627
|
+
if (!memberIdInLocation) return;
|
|
2297
2628
|
const overlayId = addOverlayPrefix(memberIdInLocation);
|
|
2298
2629
|
currentOverlayIds.add(overlayId);
|
|
2299
2630
|
let overlay = overlayMap.get(overlayId);
|
|
@@ -2362,14 +2693,17 @@ var createRootElementResizeObserver = ({
|
|
|
2362
2693
|
return `${height * nativeVideoRatio}px`;
|
|
2363
2694
|
}
|
|
2364
2695
|
};
|
|
2365
|
-
const update = debounce(
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2696
|
+
const update = debounce(
|
|
2697
|
+
({ width, height }) => {
|
|
2698
|
+
const maxPaddingBottom = video.videoHeight / video.videoWidth * 100;
|
|
2699
|
+
if (paddingWrapper) {
|
|
2700
|
+
const pb = height / width * 100;
|
|
2701
|
+
paddingWrapper.style.paddingBottom = `${pb > maxPaddingBottom ? maxPaddingBottom : pb}%`;
|
|
2702
|
+
paddingWrapper.style.width = computePaddingWrapperWidth(width, height);
|
|
2703
|
+
}
|
|
2704
|
+
},
|
|
2705
|
+
100
|
|
2706
|
+
);
|
|
2373
2707
|
const observer = new ResizeObserver((entries) => {
|
|
2374
2708
|
entries.forEach((entry) => {
|
|
2375
2709
|
if (entry.contentBoxSize) {
|
|
@@ -2607,9 +2941,11 @@ var ClientAPI = class extends BaseClient {
|
|
|
2607
2941
|
"stopMicrophoneWhileMuted"
|
|
2608
2942
|
]);
|
|
2609
2943
|
const customSagas = [];
|
|
2610
|
-
customSagas.push(
|
|
2611
|
-
|
|
2612
|
-
|
|
2944
|
+
customSagas.push(
|
|
2945
|
+
makeAudioElementSaga({
|
|
2946
|
+
speakerId: options.speakerId
|
|
2947
|
+
})
|
|
2948
|
+
);
|
|
2613
2949
|
const room = createVideoRoomSessionObject(__spreadProps(__spreadValues({}, options), {
|
|
2614
2950
|
store: this.store,
|
|
2615
2951
|
customSagas
|
|
@@ -2629,7 +2965,9 @@ var ClientAPI = class extends BaseClient {
|
|
|
2629
2965
|
}
|
|
2630
2966
|
room.on("room.subscribed", (params) => {
|
|
2631
2967
|
var _a2;
|
|
2632
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
2968
|
+
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
2969
|
+
(m) => m.id === room.memberId
|
|
2970
|
+
);
|
|
2633
2971
|
if (member == null ? void 0 : member.audio_muted) {
|
|
2634
2972
|
try {
|
|
2635
2973
|
room.stopOutboundAudio();
|
|
@@ -2687,12 +3025,21 @@ var ClientAPI = class extends BaseClient {
|
|
|
2687
3025
|
}
|
|
2688
3026
|
return this._pubSub;
|
|
2689
3027
|
}
|
|
3028
|
+
/** @internal */
|
|
2690
3029
|
get videoManager() {
|
|
2691
3030
|
if (!this._videoManager) {
|
|
2692
3031
|
this._videoManager = createVideoManagerObject(this.options);
|
|
2693
3032
|
}
|
|
2694
3033
|
return this._videoManager;
|
|
2695
3034
|
}
|
|
3035
|
+
/**
|
|
3036
|
+
* Reauthenticate with the SignalWire network using a new token
|
|
3037
|
+
* For now it returns void since with an invalid token the server
|
|
3038
|
+
* will close the connection right away so we can hook on the session
|
|
3039
|
+
* events in case. Need to improve it.
|
|
3040
|
+
*
|
|
3041
|
+
* @internal
|
|
3042
|
+
*/
|
|
2696
3043
|
reauthenticate(token) {
|
|
2697
3044
|
this.store.dispatch(actions3.reauthAction({ token }));
|
|
2698
3045
|
}
|
|
@@ -2729,7 +3076,7 @@ var JWTSession = class extends BaseJWTSession {
|
|
|
2729
3076
|
this.options = options;
|
|
2730
3077
|
__publicField(this, "WebSocketConstructor", WebSocket);
|
|
2731
3078
|
__publicField(this, "CloseEventConstructor", SwCloseEvent);
|
|
2732
|
-
__publicField(this, "agent", "@signalwire/js/browser/3.28.
|
|
3079
|
+
__publicField(this, "agent", "@signalwire/js/browser/3.28.1");
|
|
2733
3080
|
__publicField(this, "tokenTyp");
|
|
2734
3081
|
this.tokenTyp = (_a = decodedJwt.typ) != null ? _a : "VRT";
|
|
2735
3082
|
}
|
|
@@ -2782,7 +3129,9 @@ var JWTSession = class extends BaseJWTSession {
|
|
|
2782
3129
|
_onSocketClose(event) {
|
|
2783
3130
|
var _a, _b, _c;
|
|
2784
3131
|
if (this.status === "unknown" || this.status === "disconnected") {
|
|
2785
|
-
const { protocolKey, authStateKey, callIdKey } = sessionStorageManager(
|
|
3132
|
+
const { protocolKey, authStateKey, callIdKey } = sessionStorageManager(
|
|
3133
|
+
this.options.token
|
|
3134
|
+
);
|
|
2786
3135
|
this.logger.debug("Cleaning up storage");
|
|
2787
3136
|
if (protocolKey) {
|
|
2788
3137
|
this.logger.debug("Remove protocolKey", protocolKey);
|
|
@@ -2871,7 +3220,9 @@ import { PubSub } from "@signalwire/core";
|
|
|
2871
3220
|
|
|
2872
3221
|
// src/utils/interfaces/video.ts
|
|
2873
3222
|
import { INTERNAL_MEMBER_UPDATABLE_PROPS } from "@signalwire/core";
|
|
2874
|
-
var INTERNAL_MEMBER_UPDATED_EVENTS = Object.keys(
|
|
3223
|
+
var INTERNAL_MEMBER_UPDATED_EVENTS = Object.keys(
|
|
3224
|
+
INTERNAL_MEMBER_UPDATABLE_PROPS
|
|
3225
|
+
).map((key) => {
|
|
2875
3226
|
return `member.updated.${key}`;
|
|
2876
3227
|
});
|
|
2877
3228
|
|
|
@@ -2959,11 +3310,14 @@ var createHttpClient = (_a, fetcher = http) => {
|
|
|
2959
3310
|
}, timeout);
|
|
2960
3311
|
}
|
|
2961
3312
|
try {
|
|
2962
|
-
const response = await fetcher(
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
3313
|
+
const response = await fetcher(
|
|
3314
|
+
getUrl({
|
|
3315
|
+
path,
|
|
3316
|
+
baseUrl,
|
|
3317
|
+
searchParams: options == null ? void 0 : options.searchParams
|
|
3318
|
+
}),
|
|
3319
|
+
reqInit
|
|
3320
|
+
);
|
|
2967
3321
|
return { body: response.parsedBody };
|
|
2968
3322
|
} catch (e) {
|
|
2969
3323
|
throw e;
|
|
@@ -3009,8 +3363,7 @@ var getUrl = ({
|
|
|
3009
3363
|
// src/utils/paginatedResult.ts
|
|
3010
3364
|
function buildPaginatedResult(body, client) {
|
|
3011
3365
|
const anotherPage = async (url) => {
|
|
3012
|
-
if (!url)
|
|
3013
|
-
return Promise.resolve(void 0);
|
|
3366
|
+
if (!url) return Promise.resolve(void 0);
|
|
3014
3367
|
const { body: body2 } = await client(url);
|
|
3015
3368
|
return buildPaginatedResult(body2, client);
|
|
3016
3369
|
};
|
|
@@ -3095,8 +3448,7 @@ var HTTPClient = class {
|
|
|
3095
3448
|
}
|
|
3096
3449
|
const { body } = await this.httpClient(path);
|
|
3097
3450
|
if (isGetAddressesResponse(body)) {
|
|
3098
|
-
if (!body.data[0])
|
|
3099
|
-
throw new HttpError2(404, "Not Found");
|
|
3451
|
+
if (!body.data[0]) throw new HttpError2(404, "Not Found");
|
|
3100
3452
|
return body.data[0];
|
|
3101
3453
|
}
|
|
3102
3454
|
return body;
|
|
@@ -3205,6 +3557,7 @@ var Conversation = class {
|
|
|
3205
3557
|
}
|
|
3206
3558
|
});
|
|
3207
3559
|
}
|
|
3560
|
+
/** @internal */
|
|
3208
3561
|
handleEvent(event) {
|
|
3209
3562
|
if (event.subtype === "chat") {
|
|
3210
3563
|
const chatCallbacks = this.chatSubscriptions[event.conversation_id];
|
|
@@ -3242,9 +3595,13 @@ var Conversation = class {
|
|
|
3242
3595
|
if (pageSize) {
|
|
3243
3596
|
queryParams.append("page_size", pageSize.toString());
|
|
3244
3597
|
}
|
|
3245
|
-
const { body } = await this.httpClient.fetch(
|
|
3598
|
+
const { body } = await this.httpClient.fetch(
|
|
3599
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3600
|
+
);
|
|
3246
3601
|
const self = this;
|
|
3247
|
-
const data = body.data.map(
|
|
3602
|
+
const data = body.data.map(
|
|
3603
|
+
(conversation) => new ConversationAPI(self, conversation)
|
|
3604
|
+
);
|
|
3248
3605
|
return buildPaginatedResult(__spreadProps(__spreadValues({}, body), { data }), this.httpClient.fetch);
|
|
3249
3606
|
} catch (error) {
|
|
3250
3607
|
throw new Error("Error fetching the conversation history!", error);
|
|
@@ -3258,8 +3615,13 @@ var Conversation = class {
|
|
|
3258
3615
|
if (pageSize) {
|
|
3259
3616
|
queryParams.append("page_size", pageSize.toString());
|
|
3260
3617
|
}
|
|
3261
|
-
const { body } = await this.httpClient.fetch(
|
|
3262
|
-
|
|
3618
|
+
const { body } = await this.httpClient.fetch(
|
|
3619
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3620
|
+
);
|
|
3621
|
+
return buildPaginatedResult(
|
|
3622
|
+
body,
|
|
3623
|
+
this.httpClient.fetch
|
|
3624
|
+
);
|
|
3263
3625
|
} catch (error) {
|
|
3264
3626
|
throw new Error("Error fetching the conversation messages!", error);
|
|
3265
3627
|
}
|
|
@@ -3272,8 +3634,13 @@ var Conversation = class {
|
|
|
3272
3634
|
if (pageSize) {
|
|
3273
3635
|
queryParams.append("page_size", pageSize.toString());
|
|
3274
3636
|
}
|
|
3275
|
-
const { body } = await this.httpClient.fetch(
|
|
3276
|
-
|
|
3637
|
+
const { body } = await this.httpClient.fetch(
|
|
3638
|
+
makeQueryParamsUrls(path, queryParams)
|
|
3639
|
+
);
|
|
3640
|
+
return buildPaginatedResult(
|
|
3641
|
+
body,
|
|
3642
|
+
this.httpClient.fetch
|
|
3643
|
+
);
|
|
3277
3644
|
} catch (error) {
|
|
3278
3645
|
throw new Error("Error fetching the conversation messages!", error);
|
|
3279
3646
|
}
|
|
@@ -3311,15 +3678,24 @@ var Conversation = class {
|
|
|
3311
3678
|
hasNext: !!(conversationMessages == null ? void 0 : conversationMessages.hasNext) || !!cached.length,
|
|
3312
3679
|
hasPrev: !!(conversationMessages == null ? void 0 : conversationMessages.hasPrev),
|
|
3313
3680
|
nextPage: () => fetchChatMessagesPage(conversationMessages == null ? void 0 : conversationMessages.nextPage, missingReturns),
|
|
3314
|
-
prevPage: () => fetchChatMessagesPage(
|
|
3681
|
+
prevPage: () => fetchChatMessagesPage(
|
|
3682
|
+
conversationMessages == null ? void 0 : conversationMessages.prevPage,
|
|
3683
|
+
missingReturns,
|
|
3684
|
+
false
|
|
3685
|
+
),
|
|
3315
3686
|
self: () => fetchChatMessagesPage(conversationMessages == null ? void 0 : conversationMessages.self, missingReturns),
|
|
3316
|
-
firstPage: () => fetchChatMessagesPage(
|
|
3687
|
+
firstPage: () => fetchChatMessagesPage(
|
|
3688
|
+
conversationMessages == null ? void 0 : conversationMessages.firstPage,
|
|
3689
|
+
missingReturns
|
|
3690
|
+
)
|
|
3317
3691
|
};
|
|
3318
3692
|
};
|
|
3319
|
-
return fetchChatMessagesPage(
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3693
|
+
return fetchChatMessagesPage(
|
|
3694
|
+
() => this.getConversationMessages({
|
|
3695
|
+
addressId,
|
|
3696
|
+
pageSize
|
|
3697
|
+
})
|
|
3698
|
+
);
|
|
3323
3699
|
}
|
|
3324
3700
|
async subscribe(callback) {
|
|
3325
3701
|
this.callbacks.add(callback);
|
|
@@ -3341,12 +3717,15 @@ var Conversation = class {
|
|
|
3341
3717
|
try {
|
|
3342
3718
|
const { addressId } = params;
|
|
3343
3719
|
const path = "/api/fabric/conversations/join";
|
|
3344
|
-
const { body } = await this.httpClient.fetch(
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3720
|
+
const { body } = await this.httpClient.fetch(
|
|
3721
|
+
path,
|
|
3722
|
+
{
|
|
3723
|
+
method: "POST",
|
|
3724
|
+
body: {
|
|
3725
|
+
conversation_id: addressId
|
|
3726
|
+
}
|
|
3348
3727
|
}
|
|
3349
|
-
|
|
3728
|
+
);
|
|
3350
3729
|
return body;
|
|
3351
3730
|
} catch (error) {
|
|
3352
3731
|
throw new Error("Error joining a conversation!", error);
|
|
@@ -3408,7 +3787,9 @@ var IncomingCallManager = class {
|
|
|
3408
3787
|
handleIncomingInvite(incomingInvite) {
|
|
3409
3788
|
var _a, _b;
|
|
3410
3789
|
if (incomingInvite.callID in this._pendingInvites) {
|
|
3411
|
-
this._client.logger.debug(
|
|
3790
|
+
this._client.logger.debug(
|
|
3791
|
+
`skiping nottification for pending invite to callID: ${incomingInvite.callID}`
|
|
3792
|
+
);
|
|
3412
3793
|
return;
|
|
3413
3794
|
}
|
|
3414
3795
|
this._pendingInvites[incomingInvite.callID] = incomingInvite;
|
|
@@ -3446,6 +3827,11 @@ var SATSession = class extends JWTSession {
|
|
|
3446
3827
|
}
|
|
3447
3828
|
async _checkTokenExpiration() {
|
|
3448
3829
|
}
|
|
3830
|
+
/**
|
|
3831
|
+
* Reauthenticate with the SignalWire Network using a newer SAT.
|
|
3832
|
+
* If the session has expired, this will reconnect it.
|
|
3833
|
+
* @return Promise<void>
|
|
3834
|
+
*/
|
|
3449
3835
|
async reauthenticate() {
|
|
3450
3836
|
this.logger.debug("Session Reauthenticate", {
|
|
3451
3837
|
ready: this.ready,
|
|
@@ -3534,7 +3920,10 @@ var WSClient = class extends BaseClient2 {
|
|
|
3534
3920
|
}
|
|
3535
3921
|
const joinMutedHandler = (params) => {
|
|
3536
3922
|
var _a2;
|
|
3537
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3923
|
+
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3924
|
+
// @ts-expect-error FIXME:
|
|
3925
|
+
(m) => m.id === room.memberId || m.member_id === room.memberId
|
|
3926
|
+
);
|
|
3538
3927
|
if (member == null ? void 0 : member.audio_muted) {
|
|
3539
3928
|
try {
|
|
3540
3929
|
room.stopOutboundAudio();
|
|
@@ -3600,7 +3989,7 @@ var WSClient = class extends BaseClient2 {
|
|
|
3600
3989
|
stopCameraWhileMuted: true,
|
|
3601
3990
|
stopMicrophoneWhileMuted: true,
|
|
3602
3991
|
watchMediaPackets: false,
|
|
3603
|
-
destinationNumber:
|
|
3992
|
+
destinationNumber: params.to,
|
|
3604
3993
|
nodeId: params.nodeId,
|
|
3605
3994
|
attach: (_e = params.attach) != null ? _e : false,
|
|
3606
3995
|
disableUdpIceServers: params.disableUdpIceServers || false,
|
|
@@ -3723,44 +4112,49 @@ var WSClient = class extends BaseClient2 {
|
|
|
3723
4112
|
});
|
|
3724
4113
|
}
|
|
3725
4114
|
handlePushNotification(params) {
|
|
3726
|
-
return new Promise(
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
4115
|
+
return new Promise(
|
|
4116
|
+
async (resolve, reject) => {
|
|
4117
|
+
const { decrypted, type } = params;
|
|
4118
|
+
if (type !== "call_invite") {
|
|
4119
|
+
this.logger.warn("Unknown notification type", params);
|
|
4120
|
+
reject("Unknown notification type");
|
|
4121
|
+
}
|
|
4122
|
+
this.logger.debug("handlePushNotification", params);
|
|
4123
|
+
const {
|
|
4124
|
+
params: { params: payload },
|
|
4125
|
+
node_id: nodeId
|
|
4126
|
+
} = decrypted;
|
|
3738
4127
|
try {
|
|
3739
|
-
|
|
4128
|
+
try {
|
|
4129
|
+
await this.executeVertoSubscribe(payload.callID, nodeId);
|
|
4130
|
+
} catch (error) {
|
|
4131
|
+
this.logger.warn("Verto Subscribe", error);
|
|
4132
|
+
}
|
|
4133
|
+
this._incomingCallManager.handleIncomingInvite(__spreadValues({
|
|
4134
|
+
source: "pushNotification",
|
|
4135
|
+
nodeId
|
|
4136
|
+
}, payload));
|
|
4137
|
+
resolve({ resultType: "inboundCall" });
|
|
3740
4138
|
} catch (error) {
|
|
3741
|
-
|
|
4139
|
+
reject(error);
|
|
3742
4140
|
}
|
|
3743
|
-
this._incomingCallManager.handleIncomingInvite(__spreadValues({
|
|
3744
|
-
source: "pushNotification",
|
|
3745
|
-
nodeId
|
|
3746
|
-
}, payload));
|
|
3747
|
-
resolve({ resultType: "inboundCall" });
|
|
3748
|
-
} catch (error) {
|
|
3749
|
-
reject(error);
|
|
3750
4141
|
}
|
|
3751
|
-
|
|
4142
|
+
);
|
|
3752
4143
|
}
|
|
3753
4144
|
updateToken(token) {
|
|
3754
4145
|
return new Promise((resolve, reject) => {
|
|
3755
|
-
this.once("session.auth_error", (error) => {
|
|
4146
|
+
this.session.once("session.auth_error", (error) => {
|
|
3756
4147
|
reject(error);
|
|
3757
4148
|
});
|
|
3758
|
-
this.once("session.connected", () => {
|
|
4149
|
+
this.session.once("session.connected", () => {
|
|
3759
4150
|
resolve();
|
|
3760
4151
|
});
|
|
3761
4152
|
this.store.dispatch(actions4.reauthAction({ token }));
|
|
3762
4153
|
});
|
|
3763
4154
|
}
|
|
4155
|
+
/**
|
|
4156
|
+
* Mark the client as 'online' to receive calls over WebSocket
|
|
4157
|
+
*/
|
|
3764
4158
|
async online({ incomingCallHandlers }) {
|
|
3765
4159
|
this._incomingCallManager.setNotificationHandlers(incomingCallHandlers);
|
|
3766
4160
|
return this.execute({
|
|
@@ -3768,6 +4162,9 @@ var WSClient = class extends BaseClient2 {
|
|
|
3768
4162
|
params: {}
|
|
3769
4163
|
});
|
|
3770
4164
|
}
|
|
4165
|
+
/**
|
|
4166
|
+
* Mark the client as 'offline' to receive calls over WebSocket
|
|
4167
|
+
*/
|
|
3771
4168
|
offline() {
|
|
3772
4169
|
this._incomingCallManager.setNotificationHandlers({});
|
|
3773
4170
|
return this.execute({
|
|
@@ -3778,7 +4175,7 @@ var WSClient = class extends BaseClient2 {
|
|
|
3778
4175
|
};
|
|
3779
4176
|
|
|
3780
4177
|
// src/fabric/SignalWire.ts
|
|
3781
|
-
var SignalWire = (() => {
|
|
4178
|
+
var SignalWire = /* @__PURE__ */ (() => {
|
|
3782
4179
|
let instance = null;
|
|
3783
4180
|
return (params) => {
|
|
3784
4181
|
if (!instance) {
|
|
@@ -3820,6 +4217,9 @@ var SignalWire = (() => {
|
|
|
3820
4217
|
sendMessage: conversation.sendMessage.bind(conversation),
|
|
3821
4218
|
join: conversation.joinConversation.bind(conversation)
|
|
3822
4219
|
},
|
|
4220
|
+
// @ts-expect-error For debugging purposes
|
|
4221
|
+
on: wsClient.on.bind(wsClient),
|
|
4222
|
+
off: wsClient.off.bind(wsClient),
|
|
3823
4223
|
__httpClient: httpClient,
|
|
3824
4224
|
__wsClient: wsClient
|
|
3825
4225
|
});
|
|
@@ -3885,7 +4285,9 @@ var createRoomObject = (roomOptions) => {
|
|
|
3885
4285
|
rootElement = el;
|
|
3886
4286
|
} else {
|
|
3887
4287
|
rootElement = document.body;
|
|
3888
|
-
getLogger24().warn(
|
|
4288
|
+
getLogger24().warn(
|
|
4289
|
+
`We couldn't find an element with id: ${rootElementId}: using 'document.body' instead.`
|
|
4290
|
+
);
|
|
3889
4291
|
}
|
|
3890
4292
|
}
|
|
3891
4293
|
const roomObject = client.rooms.makeRoomObject({
|
|
@@ -4031,7 +4433,9 @@ var RoomSession = function(roomOptions) {
|
|
|
4031
4433
|
const deprecatedParams = ["audio", "video"];
|
|
4032
4434
|
deprecatedParams.forEach((param) => {
|
|
4033
4435
|
if (param in roomOptions) {
|
|
4034
|
-
getLogger25().warn(
|
|
4436
|
+
getLogger25().warn(
|
|
4437
|
+
`The '${param}' parameter on the RoomSession constructor is deprecated. Set it on the '.join()' function instead.`
|
|
4438
|
+
);
|
|
4035
4439
|
}
|
|
4036
4440
|
});
|
|
4037
4441
|
const allowReattach = (roomOptions == null ? void 0 : roomOptions.reattach) !== false;
|
|
@@ -4069,6 +4473,8 @@ var RoomSession = function(roomOptions) {
|
|
|
4069
4473
|
};
|
|
4070
4474
|
const client = createClient(userOptions);
|
|
4071
4475
|
const room = client.rooms.makeRoomObject({
|
|
4476
|
+
// audio,
|
|
4477
|
+
// video: video === true ? VIDEO_CONSTRAINTS : video,
|
|
4072
4478
|
negotiateAudio: true,
|
|
4073
4479
|
negotiateVideo: true,
|
|
4074
4480
|
iceServers,
|
|
@@ -4106,14 +4512,19 @@ var RoomSession = function(roomOptions) {
|
|
|
4106
4512
|
if (authState && authState.type === "video") {
|
|
4107
4513
|
const mediaOptions = getJoinMediaParams(__spreadValues({
|
|
4108
4514
|
authState,
|
|
4515
|
+
// constructor values override the send
|
|
4109
4516
|
sendAudio: Boolean(audio),
|
|
4110
4517
|
sendVideo: Boolean(video)
|
|
4111
4518
|
}, params));
|
|
4112
4519
|
if (!checkMediaParams(mediaOptions)) {
|
|
4113
4520
|
client.disconnect();
|
|
4114
|
-
return reject(
|
|
4521
|
+
return reject(
|
|
4522
|
+
new Error(
|
|
4523
|
+
`Invalid arguments to join the room. The token used has join_as: '${authState.join_as}'.
|
|
4115
4524
|
${JSON.stringify(params, null, 2)}
|
|
4116
|
-
`
|
|
4525
|
+
`
|
|
4526
|
+
)
|
|
4527
|
+
);
|
|
4117
4528
|
}
|
|
4118
4529
|
getLogger25().debug("Set mediaOptions", mediaOptions);
|
|
4119
4530
|
room.updateMediaOptions({
|
|
@@ -4145,7 +4556,9 @@ ${JSON.stringify(params, null, 2)}
|
|
|
4145
4556
|
return interceptors[prop];
|
|
4146
4557
|
}
|
|
4147
4558
|
if (!target.active && UNSAFE_PROP_ACCESS.includes(prop)) {
|
|
4148
|
-
throw new Error(
|
|
4559
|
+
throw new Error(
|
|
4560
|
+
`Tried to access the property/method "${prop}" before the room was connected. Please call roomSession.join() first.`
|
|
4561
|
+
);
|
|
4149
4562
|
}
|
|
4150
4563
|
return Reflect.get(target, prop, receiver);
|
|
4151
4564
|
}
|