@signalwire/js 3.29.2 → 4.0.0-dev-20260220205014
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/base-A5AZTrAd.d.cts +23 -0
- package/dist/base-A5AZTrAd.d.cts.map +1 -0
- package/dist/base-aVtoG8Wk.d.mts +23 -0
- package/dist/base-aVtoG8Wk.d.mts.map +1 -0
- package/dist/browser.mjs +16625 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/browser.umd.js +16646 -0
- package/dist/browser.umd.js.map +1 -0
- package/dist/index.cjs +6210 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2690 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2690 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6194 -0
- package/dist/index.mjs.map +1 -0
- package/dist/operators/index.cjs +6 -0
- package/dist/operators/index.d.cts +109 -0
- package/dist/operators/index.d.cts.map +1 -0
- package/dist/operators/index.d.mts +109 -0
- package/dist/operators/index.d.mts.map +1 -0
- package/dist/operators/index.mjs +3 -0
- package/dist/operators-BHQMSEzq.mjs +371 -0
- package/dist/operators-BHQMSEzq.mjs.map +1 -0
- package/dist/operators-DT4UB24-.cjs +596 -0
- package/dist/operators-DT4UB24-.cjs.map +1 -0
- package/package.json +73 -37
- package/README.md +0 -40
- package/dist/core/src/BaseClient.d.ts +0 -19
- package/dist/core/src/BaseClient.d.ts.map +0 -1
- package/dist/core/src/BaseComponent.d.ts +0 -101
- package/dist/core/src/BaseComponent.d.ts.map +0 -1
- package/dist/core/src/BaseComponent.test.d.ts +0 -2
- package/dist/core/src/BaseComponent.test.d.ts.map +0 -1
- package/dist/core/src/BaseConsumer.d.ts +0 -18
- package/dist/core/src/BaseConsumer.d.ts.map +0 -1
- package/dist/core/src/BaseConsumer.test.d.ts +0 -2
- package/dist/core/src/BaseConsumer.test.d.ts.map +0 -1
- package/dist/core/src/BaseJWTSession.d.ts +0 -47
- package/dist/core/src/BaseJWTSession.d.ts.map +0 -1
- package/dist/core/src/BaseJWTSession.test.d.ts +0 -2
- package/dist/core/src/BaseJWTSession.test.d.ts.map +0 -1
- package/dist/core/src/BaseSession.d.ts +0 -117
- package/dist/core/src/BaseSession.d.ts.map +0 -1
- package/dist/core/src/BaseSession.test.d.ts +0 -2
- package/dist/core/src/BaseSession.test.d.ts.map +0 -1
- package/dist/core/src/CustomErrors.d.ts +0 -17
- package/dist/core/src/CustomErrors.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCConnect.d.ts +0 -42
- package/dist/core/src/RPCMessages/RPCConnect.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCDisconnect.d.ts +0 -8
- package/dist/core/src/RPCMessages/RPCDisconnect.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCEventAck.d.ts +0 -8
- package/dist/core/src/RPCMessages/RPCEventAck.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCExecute.d.ts +0 -16
- package/dist/core/src/RPCMessages/RPCExecute.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCPing.d.ts +0 -16
- package/dist/core/src/RPCMessages/RPCPing.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/RPCReauthenticate.d.ts +0 -13
- package/dist/core/src/RPCMessages/RPCReauthenticate.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/VertoMessages.d.ts +0 -84
- package/dist/core/src/RPCMessages/VertoMessages.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/helpers.d.ts +0 -31
- package/dist/core/src/RPCMessages/helpers.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/index.d.ts +0 -9
- package/dist/core/src/RPCMessages/index.d.ts.map +0 -1
- package/dist/core/src/RPCMessages/index.test.d.ts +0 -2
- package/dist/core/src/RPCMessages/index.test.d.ts.map +0 -1
- package/dist/core/src/chat/BaseChat.d.ts +0 -23
- package/dist/core/src/chat/BaseChat.d.ts.map +0 -1
- package/dist/core/src/chat/ChatMember.d.ts +0 -15
- package/dist/core/src/chat/ChatMember.d.ts.map +0 -1
- package/dist/core/src/chat/ChatMessage.d.ts +0 -10
- package/dist/core/src/chat/ChatMessage.d.ts.map +0 -1
- package/dist/core/src/chat/applyCommonMethods.d.ts +0 -22
- package/dist/core/src/chat/applyCommonMethods.d.ts.map +0 -1
- package/dist/core/src/chat/index.d.ts +0 -6
- package/dist/core/src/chat/index.d.ts.map +0 -1
- package/dist/core/src/chat/methods.d.ts +0 -31
- package/dist/core/src/chat/methods.d.ts.map +0 -1
- package/dist/core/src/chat/utils/index.d.ts +0 -3
- package/dist/core/src/chat/utils/index.d.ts.map +0 -1
- package/dist/core/src/chat/utils/toInternalChatChannels.d.ts +0 -3
- package/dist/core/src/chat/utils/toInternalChatChannels.d.ts.map +0 -1
- package/dist/core/src/chat/utils/toInternalChatChannels.test.d.ts +0 -2
- package/dist/core/src/chat/utils/toInternalChatChannels.test.d.ts.map +0 -1
- package/dist/core/src/chat/workers/chatWorker.d.ts +0 -4
- package/dist/core/src/chat/workers/chatWorker.d.ts.map +0 -1
- package/dist/core/src/chat/workers/index.d.ts +0 -2
- package/dist/core/src/chat/workers/index.d.ts.map +0 -1
- package/dist/core/src/index.d.ts +0 -45
- package/dist/core/src/index.d.ts.map +0 -1
- package/dist/core/src/index.test.d.ts +0 -1
- package/dist/core/src/index.test.d.ts.map +0 -1
- package/dist/core/src/memberPosition/index.d.ts +0 -2
- package/dist/core/src/memberPosition/index.d.ts.map +0 -1
- package/dist/core/src/memberPosition/workers.d.ts +0 -13
- package/dist/core/src/memberPosition/workers.d.ts.map +0 -1
- package/dist/core/src/memberPosition/workers.test.d.ts +0 -2
- package/dist/core/src/memberPosition/workers.test.d.ts.map +0 -1
- package/dist/core/src/pubSub/BasePubSub.d.ts +0 -43
- package/dist/core/src/pubSub/BasePubSub.d.ts.map +0 -1
- package/dist/core/src/pubSub/PubSubMessage.d.ts +0 -19
- package/dist/core/src/pubSub/PubSubMessage.d.ts.map +0 -1
- package/dist/core/src/pubSub/index.d.ts +0 -3
- package/dist/core/src/pubSub/index.d.ts.map +0 -1
- package/dist/core/src/pubSub/workers/index.d.ts +0 -2
- package/dist/core/src/pubSub/workers/index.d.ts.map +0 -1
- package/dist/core/src/pubSub/workers/pubSubWorker.d.ts +0 -4
- package/dist/core/src/pubSub/workers/pubSubWorker.d.ts.map +0 -1
- package/dist/core/src/redux/actions.d.ts +0 -25
- package/dist/core/src/redux/actions.d.ts.map +0 -1
- package/dist/core/src/redux/connect.d.ts +0 -23
- package/dist/core/src/redux/connect.d.ts.map +0 -1
- package/dist/core/src/redux/connect.test.d.ts +0 -2
- package/dist/core/src/redux/connect.test.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSaga.d.ts +0 -4
- package/dist/core/src/redux/features/component/componentSaga.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSaga.test.d.ts +0 -2
- package/dist/core/src/redux/features/component/componentSaga.test.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSelectors.d.ts +0 -7
- package/dist/core/src/redux/features/component/componentSelectors.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSelectors.test.d.ts +0 -2
- package/dist/core/src/redux/features/component/componentSelectors.test.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSlice.d.ts +0 -2319
- package/dist/core/src/redux/features/component/componentSlice.d.ts.map +0 -1
- package/dist/core/src/redux/features/component/componentSlice.test.d.ts +0 -2
- package/dist/core/src/redux/features/component/componentSlice.test.d.ts.map +0 -1
- package/dist/core/src/redux/features/index.d.ts +0 -3
- package/dist/core/src/redux/features/index.d.ts.map +0 -1
- package/dist/core/src/redux/features/session/sessionSaga.d.ts +0 -11
- package/dist/core/src/redux/features/session/sessionSaga.d.ts.map +0 -1
- package/dist/core/src/redux/features/session/sessionSelectors.d.ts +0 -9
- package/dist/core/src/redux/features/session/sessionSelectors.d.ts.map +0 -1
- package/dist/core/src/redux/features/session/sessionSlice.d.ts +0 -521
- package/dist/core/src/redux/features/session/sessionSlice.d.ts.map +0 -1
- package/dist/core/src/redux/features/session/sessionSlice.test.d.ts +0 -2
- package/dist/core/src/redux/features/session/sessionSlice.test.d.ts.map +0 -1
- package/dist/core/src/redux/index.d.ts +0 -31
- package/dist/core/src/redux/index.d.ts.map +0 -1
- package/dist/core/src/redux/interfaces.d.ts +0 -87
- package/dist/core/src/redux/interfaces.d.ts.map +0 -1
- package/dist/core/src/redux/rootReducer.d.ts +0 -457
- package/dist/core/src/redux/rootReducer.d.ts.map +0 -1
- package/dist/core/src/redux/rootSaga.d.ts +0 -40
- package/dist/core/src/redux/rootSaga.d.ts.map +0 -1
- package/dist/core/src/redux/rootSaga.test.d.ts +0 -2
- package/dist/core/src/redux/rootSaga.test.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/configureStore.d.ts +0 -77
- package/dist/core/src/redux/toolkit/configureStore.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/createAction.d.ts +0 -180
- package/dist/core/src/redux/toolkit/createAction.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/createReducer.d.ts +0 -42
- package/dist/core/src/redux/toolkit/createReducer.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/createSlice.d.ts +0 -142
- package/dist/core/src/redux/toolkit/createSlice.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/devtoolsExtension.d.ts +0 -185
- package/dist/core/src/redux/toolkit/devtoolsExtension.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/getDefaultMiddleware.d.ts +0 -12
- package/dist/core/src/redux/toolkit/getDefaultMiddleware.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/index.d.ts +0 -13
- package/dist/core/src/redux/toolkit/index.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/isPlainObject.d.ts +0 -12
- package/dist/core/src/redux/toolkit/isPlainObject.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/mapBuilders.d.ts +0 -38
- package/dist/core/src/redux/toolkit/mapBuilders.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/tsHelpers.d.ts +0 -51
- package/dist/core/src/redux/toolkit/tsHelpers.d.ts.map +0 -1
- package/dist/core/src/redux/toolkit/utils.d.ts +0 -11
- package/dist/core/src/redux/toolkit/utils.d.ts.map +0 -1
- package/dist/core/src/redux/utils/createDestroyableSlice.d.ts +0 -9
- package/dist/core/src/redux/utils/createDestroyableSlice.d.ts.map +0 -1
- package/dist/core/src/redux/utils/createDestroyableSlice.test.d.ts +0 -2
- package/dist/core/src/redux/utils/createDestroyableSlice.test.d.ts.map +0 -1
- package/dist/core/src/redux/utils/sagaHelpers.d.ts +0 -5
- package/dist/core/src/redux/utils/sagaHelpers.d.ts.map +0 -1
- package/dist/core/src/redux/utils/useInstanceMap.d.ts +0 -3
- package/dist/core/src/redux/utils/useInstanceMap.d.ts.map +0 -1
- package/dist/core/src/redux/utils/useSession.d.ts +0 -16
- package/dist/core/src/redux/utils/useSession.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionPlayback.d.ts +0 -40
- package/dist/core/src/rooms/RoomSessionPlayback.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionPlayback.test.d.ts +0 -2
- package/dist/core/src/rooms/RoomSessionPlayback.test.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionRecording.d.ts +0 -30
- package/dist/core/src/rooms/RoomSessionRecording.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionRecording.test.d.ts +0 -2
- package/dist/core/src/rooms/RoomSessionRecording.test.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionStream.d.ts +0 -29
- package/dist/core/src/rooms/RoomSessionStream.d.ts.map +0 -1
- package/dist/core/src/rooms/RoomSessionStream.test.d.ts +0 -2
- package/dist/core/src/rooms/RoomSessionStream.test.d.ts.map +0 -1
- package/dist/core/src/rooms/index.d.ts +0 -11
- package/dist/core/src/rooms/index.d.ts.map +0 -1
- package/dist/core/src/rooms/methods.d.ts +0 -179
- package/dist/core/src/rooms/methods.d.ts.map +0 -1
- package/dist/core/src/rooms/methods.test.d.ts +0 -2
- package/dist/core/src/rooms/methods.test.d.ts.map +0 -1
- package/dist/core/src/setupTests.d.ts +0 -1
- package/dist/core/src/setupTests.d.ts.map +0 -1
- package/dist/core/src/testUtils.d.ts +0 -54
- package/dist/core/src/testUtils.d.ts.map +0 -1
- package/dist/core/src/types/cantina.d.ts +0 -82
- package/dist/core/src/types/cantina.d.ts.map +0 -1
- package/dist/core/src/types/chat.d.ts +0 -270
- package/dist/core/src/types/chat.d.ts.map +0 -1
- package/dist/core/src/types/common.d.ts +0 -34
- package/dist/core/src/types/common.d.ts.map +0 -1
- package/dist/core/src/types/conversation.d.ts +0 -33
- package/dist/core/src/types/conversation.d.ts.map +0 -1
- package/dist/core/src/types/fabric.d.ts +0 -15
- package/dist/core/src/types/fabric.d.ts.map +0 -1
- package/dist/core/src/types/fabricLayout.d.ts +0 -25
- package/dist/core/src/types/fabricLayout.d.ts.map +0 -1
- package/dist/core/src/types/fabricMember.d.ts +0 -148
- package/dist/core/src/types/fabricMember.d.ts.map +0 -1
- package/dist/core/src/types/fabricRoomSession.d.ts +0 -631
- package/dist/core/src/types/fabricRoomSession.d.ts.map +0 -1
- package/dist/core/src/types/index.d.ts +0 -276
- package/dist/core/src/types/index.d.ts.map +0 -1
- package/dist/core/src/types/messaging.d.ts +0 -90
- package/dist/core/src/types/messaging.d.ts.map +0 -1
- package/dist/core/src/types/pubSub.d.ts +0 -123
- package/dist/core/src/types/pubSub.d.ts.map +0 -1
- package/dist/core/src/types/task.d.ts +0 -36
- package/dist/core/src/types/task.d.ts.map +0 -1
- package/dist/core/src/types/utils.d.ts +0 -71
- package/dist/core/src/types/utils.d.ts.map +0 -1
- package/dist/core/src/types/video.d.ts +0 -62
- package/dist/core/src/types/video.d.ts.map +0 -1
- package/dist/core/src/types/videoLayout.d.ts +0 -75
- package/dist/core/src/types/videoLayout.d.ts.map +0 -1
- package/dist/core/src/types/videoMember.d.ts +0 -384
- package/dist/core/src/types/videoMember.d.ts.map +0 -1
- package/dist/core/src/types/videoPlayback.d.ts +0 -123
- package/dist/core/src/types/videoPlayback.d.ts.map +0 -1
- package/dist/core/src/types/videoRecording.d.ts +0 -114
- package/dist/core/src/types/videoRecording.d.ts.map +0 -1
- package/dist/core/src/types/videoRoomDevice.d.ts +0 -23
- package/dist/core/src/types/videoRoomDevice.d.ts.map +0 -1
- package/dist/core/src/types/videoRoomSession.d.ts +0 -921
- package/dist/core/src/types/videoRoomSession.d.ts.map +0 -1
- package/dist/core/src/types/videoStream.d.ts +0 -104
- package/dist/core/src/types/videoStream.d.ts.map +0 -1
- package/dist/core/src/types/voice.d.ts +0 -15
- package/dist/core/src/types/voice.d.ts.map +0 -1
- package/dist/core/src/types/voiceCall.d.ts +0 -253
- package/dist/core/src/types/voiceCall.d.ts.map +0 -1
- package/dist/core/src/types/voiceCollect.d.ts +0 -166
- package/dist/core/src/types/voiceCollect.d.ts.map +0 -1
- package/dist/core/src/types/voiceConnect.d.ts +0 -77
- package/dist/core/src/types/voiceConnect.d.ts.map +0 -1
- package/dist/core/src/types/voiceDetect.d.ts +0 -127
- package/dist/core/src/types/voiceDetect.d.ts.map +0 -1
- package/dist/core/src/types/voicePlayback.d.ts +0 -141
- package/dist/core/src/types/voicePlayback.d.ts.map +0 -1
- package/dist/core/src/types/voicePrompt.d.ts +0 -105
- package/dist/core/src/types/voicePrompt.d.ts.map +0 -1
- package/dist/core/src/types/voiceRecording.d.ts +0 -107
- package/dist/core/src/types/voiceRecording.d.ts.map +0 -1
- package/dist/core/src/types/voiceSendDigits.d.ts +0 -21
- package/dist/core/src/types/voiceSendDigits.d.ts.map +0 -1
- package/dist/core/src/types/voiceTap.d.ts +0 -116
- package/dist/core/src/types/voiceTap.d.ts.map +0 -1
- package/dist/core/src/utils/EventEmitter.d.ts +0 -9
- package/dist/core/src/utils/EventEmitter.d.ts.map +0 -1
- package/dist/core/src/utils/EventEmitter.test.d.ts +0 -2
- package/dist/core/src/utils/EventEmitter.test.d.ts.map +0 -1
- package/dist/core/src/utils/SWCloseEvent.d.ts +0 -18
- package/dist/core/src/utils/SWCloseEvent.d.ts.map +0 -1
- package/dist/core/src/utils/asyncRetry.d.ts +0 -18
- package/dist/core/src/utils/asyncRetry.d.ts.map +0 -1
- package/dist/core/src/utils/asyncRetry.test.d.ts +0 -2
- package/dist/core/src/utils/asyncRetry.test.d.ts.map +0 -1
- package/dist/core/src/utils/common.d.ts +0 -9
- package/dist/core/src/utils/common.d.ts.map +0 -1
- package/dist/core/src/utils/constants.d.ts +0 -44
- package/dist/core/src/utils/constants.d.ts.map +0 -1
- package/dist/core/src/utils/debounce.d.ts +0 -8
- package/dist/core/src/utils/debounce.d.ts.map +0 -1
- package/dist/core/src/utils/eventUtils.d.ts +0 -2
- package/dist/core/src/utils/eventUtils.d.ts.map +0 -1
- package/dist/core/src/utils/extendComponent.d.ts +0 -4
- package/dist/core/src/utils/extendComponent.d.ts.map +0 -1
- package/dist/core/src/utils/extendComponent.test.d.ts +0 -2
- package/dist/core/src/utils/extendComponent.test.d.ts.map +0 -1
- package/dist/core/src/utils/index.d.ts +0 -47
- package/dist/core/src/utils/index.d.ts.map +0 -1
- package/dist/core/src/utils/index.test.d.ts +0 -2
- package/dist/core/src/utils/index.test.d.ts.map +0 -1
- package/dist/core/src/utils/interfaces.d.ts +0 -296
- package/dist/core/src/utils/interfaces.d.ts.map +0 -1
- package/dist/core/src/utils/logger.d.ts +0 -6
- package/dist/core/src/utils/logger.d.ts.map +0 -1
- package/dist/core/src/utils/logger.test.d.ts +0 -2
- package/dist/core/src/utils/logger.test.d.ts.map +0 -1
- package/dist/core/src/utils/parseRPCResponse.d.ts +0 -10
- package/dist/core/src/utils/parseRPCResponse.d.ts.map +0 -1
- package/dist/core/src/utils/parseRPCResponse.test.d.ts +0 -2
- package/dist/core/src/utils/parseRPCResponse.test.d.ts.map +0 -1
- package/dist/core/src/utils/storage/index.d.ts +0 -11
- package/dist/core/src/utils/storage/index.d.ts.map +0 -1
- package/dist/core/src/utils/storage/index.native.d.ts +0 -11
- package/dist/core/src/utils/storage/index.native.d.ts.map +0 -1
- package/dist/core/src/utils/toExternalJSON.d.ts +0 -34
- package/dist/core/src/utils/toExternalJSON.d.ts.map +0 -1
- package/dist/core/src/utils/toExternalJSON.test.d.ts +0 -2
- package/dist/core/src/utils/toExternalJSON.test.d.ts.map +0 -1
- package/dist/core/src/utils/toInternalAction.d.ts +0 -7
- package/dist/core/src/utils/toInternalAction.d.ts.map +0 -1
- package/dist/core/src/utils/toInternalAction.test.d.ts +0 -2
- package/dist/core/src/utils/toInternalAction.test.d.ts.map +0 -1
- package/dist/core/src/utils/toInternalEventName.d.ts +0 -8
- package/dist/core/src/utils/toInternalEventName.d.ts.map +0 -1
- package/dist/core/src/utils/toInternalEventName.test.d.ts +0 -2
- package/dist/core/src/utils/toInternalEventName.test.d.ts.map +0 -1
- package/dist/core/src/utils/toSnakeCaseKeys.d.ts +0 -7
- package/dist/core/src/utils/toSnakeCaseKeys.d.ts.map +0 -1
- package/dist/core/src/utils/toSnakeCaseKeys.test.d.ts +0 -2
- package/dist/core/src/utils/toSnakeCaseKeys.test.d.ts.map +0 -1
- package/dist/core/src/workers/executeActionWorker.d.ts +0 -7
- package/dist/core/src/workers/executeActionWorker.d.ts.map +0 -1
- package/dist/core/src/workers/index.d.ts +0 -2
- package/dist/core/src/workers/index.d.ts.map +0 -1
- package/dist/index.esm.js +0 -4673
- package/dist/index.esm.js.map +0 -7
- package/dist/index.js +0 -4655
- package/dist/index.js.map +0 -7
- package/dist/index.umd.js +0 -31
- package/dist/index.umd.js.map +0 -1
- package/dist/js/src/BaseRoomSession.d.ts +0 -52
- package/dist/js/src/BaseRoomSession.d.ts.map +0 -1
- package/dist/js/src/Client.d.ts +0 -38
- package/dist/js/src/Client.d.ts.map +0 -1
- package/dist/js/src/JWTSession.d.ts +0 -31
- package/dist/js/src/JWTSession.d.ts.map +0 -1
- package/dist/js/src/RoomSessionDevice.d.ts +0 -30
- package/dist/js/src/RoomSessionDevice.d.ts.map +0 -1
- package/dist/js/src/RoomSessionScreenShare.d.ts +0 -26
- package/dist/js/src/RoomSessionScreenShare.d.ts.map +0 -1
- package/dist/js/src/VideoOverlays.d.ts +0 -42
- package/dist/js/src/VideoOverlays.d.ts.map +0 -1
- package/dist/js/src/buildVideoElement.d.ts +0 -18
- package/dist/js/src/buildVideoElement.d.ts.map +0 -1
- package/dist/js/src/cantina/VideoManager.d.ts +0 -16
- package/dist/js/src/cantina/VideoManager.d.ts.map +0 -1
- package/dist/js/src/cantina/index.d.ts +0 -2
- package/dist/js/src/cantina/index.d.ts.map +0 -1
- package/dist/js/src/cantina/workers/index.d.ts +0 -2
- package/dist/js/src/cantina/workers/index.d.ts.map +0 -1
- package/dist/js/src/cantina/workers/videoManagerRoomWorker.d.ts +0 -4
- package/dist/js/src/cantina/workers/videoManagerRoomWorker.d.ts.map +0 -1
- package/dist/js/src/cantina/workers/videoManagerRoomsWorker.d.ts +0 -4
- package/dist/js/src/cantina/workers/videoManagerRoomsWorker.d.ts.map +0 -1
- package/dist/js/src/cantina/workers/videoManagerWorker.d.ts +0 -7
- package/dist/js/src/cantina/workers/videoManagerWorker.d.ts.map +0 -1
- package/dist/js/src/chat/Client.d.ts +0 -46
- package/dist/js/src/chat/Client.d.ts.map +0 -1
- package/dist/js/src/chat/index.d.ts +0 -5
- package/dist/js/src/chat/index.d.ts.map +0 -1
- package/dist/js/src/createClient.d.ts +0 -26
- package/dist/js/src/createClient.d.ts.map +0 -1
- package/dist/js/src/createRoomObject.d.ts +0 -38
- package/dist/js/src/createRoomObject.d.ts.map +0 -1
- package/dist/js/src/fabric/FabricRoomSession.d.ts +0 -80
- package/dist/js/src/fabric/FabricRoomSession.d.ts.map +0 -1
- package/dist/js/src/fabric/FabricRoomSessionMember.d.ts +0 -46
- package/dist/js/src/fabric/FabricRoomSessionMember.d.ts.map +0 -1
- package/dist/js/src/fabric/HTTPClient.d.ts +0 -16
- package/dist/js/src/fabric/HTTPClient.d.ts.map +0 -1
- package/dist/js/src/fabric/IncomingCallManager.d.ts +0 -19
- package/dist/js/src/fabric/IncomingCallManager.d.ts.map +0 -1
- package/dist/js/src/fabric/SATSession.d.ts +0 -25
- package/dist/js/src/fabric/SATSession.d.ts.map +0 -1
- package/dist/js/src/fabric/SignalWire.d.ts +0 -3
- package/dist/js/src/fabric/SignalWire.d.ts.map +0 -1
- package/dist/js/src/fabric/WSClient.d.ts +0 -33
- package/dist/js/src/fabric/WSClient.d.ts.map +0 -1
- package/dist/js/src/fabric/createHttpClient.d.ts +0 -22
- package/dist/js/src/fabric/createHttpClient.d.ts.map +0 -1
- package/dist/js/src/fabric/createWSClient.d.ts +0 -38
- package/dist/js/src/fabric/createWSClient.d.ts.map +0 -1
- package/dist/js/src/fabric/index.d.ts +0 -15
- package/dist/js/src/fabric/index.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/address.d.ts +0 -37
- package/dist/js/src/fabric/interfaces/address.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/capabilities.d.ts +0 -29
- package/dist/js/src/fabric/interfaces/capabilities.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/conversation.d.ts +0 -105
- package/dist/js/src/fabric/interfaces/conversation.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/device.d.ts +0 -18
- package/dist/js/src/fabric/interfaces/device.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/httpClient.d.ts +0 -41
- package/dist/js/src/fabric/interfaces/httpClient.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/incomingCallManager.d.ts +0 -30
- package/dist/js/src/fabric/interfaces/incomingCallManager.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/index.d.ts +0 -71
- package/dist/js/src/fabric/interfaces/index.d.ts.map +0 -1
- package/dist/js/src/fabric/interfaces/wsClient.d.ts +0 -132
- package/dist/js/src/fabric/interfaces/wsClient.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts +0 -28
- package/dist/js/src/fabric/utils/capabilitiesHelpers.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/constants.d.ts +0 -5
- package/dist/js/src/fabric/utils/constants.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/eventMappers.d.ts +0 -151
- package/dist/js/src/fabric/utils/eventMappers.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/typeGuard.d.ts +0 -6
- package/dist/js/src/fabric/utils/typeGuard.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/validationProxy.d.ts +0 -13
- package/dist/js/src/fabric/utils/validationProxy.d.ts.map +0 -1
- package/dist/js/src/fabric/utils/validators.d.ts +0 -20
- package/dist/js/src/fabric/utils/validators.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/callJoinWorker.d.ts +0 -4
- package/dist/js/src/fabric/workers/callJoinWorker.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/callLeftWorker.d.ts +0 -4
- package/dist/js/src/fabric/workers/callLeftWorker.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/callSegmentWorker.d.ts +0 -4
- package/dist/js/src/fabric/workers/callSegmentWorker.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/fabricMemberWorker.d.ts +0 -4
- package/dist/js/src/fabric/workers/fabricMemberWorker.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/fabricWorker.d.ts +0 -7
- package/dist/js/src/fabric/workers/fabricWorker.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/index.d.ts +0 -3
- package/dist/js/src/fabric/workers/index.d.ts.map +0 -1
- package/dist/js/src/fabric/workers/wsClientWorker.d.ts +0 -4
- package/dist/js/src/fabric/workers/wsClientWorker.d.ts.map +0 -1
- package/dist/js/src/features/actions.d.ts +0 -2
- package/dist/js/src/features/actions.d.ts.map +0 -1
- package/dist/js/src/features/mediaElements/mediaElementsSagas.d.ts +0 -7
- package/dist/js/src/features/mediaElements/mediaElementsSagas.d.ts.map +0 -1
- package/dist/js/src/index.d.ts +0 -87
- package/dist/js/src/index.d.ts.map +0 -1
- package/dist/js/src/joinRoom.d.ts +0 -24
- package/dist/js/src/joinRoom.d.ts.map +0 -1
- package/dist/js/src/pubSub/Client.d.ts +0 -46
- package/dist/js/src/pubSub/Client.d.ts.map +0 -1
- package/dist/js/src/pubSub/index.d.ts +0 -6
- package/dist/js/src/pubSub/index.d.ts.map +0 -1
- package/dist/js/src/setupTests.d.ts +0 -2
- package/dist/js/src/setupTests.d.ts.map +0 -1
- package/dist/js/src/testUtils.d.ts +0 -77
- package/dist/js/src/testUtils.d.ts.map +0 -1
- package/dist/js/src/utils/CloseEvent.d.ts +0 -7
- package/dist/js/src/utils/CloseEvent.d.ts.map +0 -1
- package/dist/js/src/utils/audioElement.d.ts +0 -6
- package/dist/js/src/utils/audioElement.d.ts.map +0 -1
- package/dist/js/src/utils/constants.d.ts +0 -2
- package/dist/js/src/utils/constants.d.ts.map +0 -1
- package/dist/js/src/utils/interfaces/base.d.ts +0 -55
- package/dist/js/src/utils/interfaces/base.d.ts.map +0 -1
- package/dist/js/src/utils/interfaces/fabric.d.ts +0 -71
- package/dist/js/src/utils/interfaces/fabric.d.ts.map +0 -1
- package/dist/js/src/utils/interfaces/index.d.ts +0 -4
- package/dist/js/src/utils/interfaces/index.d.ts.map +0 -1
- package/dist/js/src/utils/interfaces/video.d.ts +0 -307
- package/dist/js/src/utils/interfaces/video.d.ts.map +0 -1
- package/dist/js/src/utils/makeQueryParamsUrl.d.ts +0 -9
- package/dist/js/src/utils/makeQueryParamsUrl.d.ts.map +0 -1
- package/dist/js/src/utils/paginatedResult.d.ts +0 -12
- package/dist/js/src/utils/paginatedResult.d.ts.map +0 -1
- package/dist/js/src/utils/roomSession.d.ts +0 -26
- package/dist/js/src/utils/roomSession.d.ts.map +0 -1
- package/dist/js/src/utils/storage.d.ts +0 -10
- package/dist/js/src/utils/storage.d.ts.map +0 -1
- package/dist/js/src/utils/videoElement.d.ts +0 -35
- package/dist/js/src/utils/videoElement.d.ts.map +0 -1
- package/dist/js/src/video/RoomSession.d.ts +0 -38
- package/dist/js/src/video/RoomSession.d.ts.map +0 -1
- package/dist/js/src/video/VideoRoomSession.d.ts +0 -57
- package/dist/js/src/video/VideoRoomSession.d.ts.map +0 -1
- package/dist/js/src/video/index.d.ts +0 -16
- package/dist/js/src/video/index.d.ts.map +0 -1
- package/dist/js/src/video/workers/childMemberJoinedWorker.d.ts +0 -10
- package/dist/js/src/video/workers/childMemberJoinedWorker.d.ts.map +0 -1
- package/dist/js/src/video/workers/index.d.ts +0 -7
- package/dist/js/src/video/workers/index.d.ts.map +0 -1
- package/dist/js/src/video/workers/memberListUpdatedWorker.d.ts +0 -14
- package/dist/js/src/video/workers/memberListUpdatedWorker.d.ts.map +0 -1
- package/dist/js/src/video/workers/videoPlaybackWorker.d.ts +0 -4
- package/dist/js/src/video/workers/videoPlaybackWorker.d.ts.map +0 -1
- package/dist/js/src/video/workers/videoRecordWorker.d.ts +0 -4
- package/dist/js/src/video/workers/videoRecordWorker.d.ts.map +0 -1
- package/dist/js/src/video/workers/videoStreamWorker.d.ts +0 -4
- package/dist/js/src/video/workers/videoStreamWorker.d.ts.map +0 -1
- package/dist/js/src/video/workers/videoWorker.d.ts +0 -7
- package/dist/js/src/video/workers/videoWorker.d.ts.map +0 -1
- package/dist/js/src/webrtc.d.ts +0 -3
- package/dist/js/src/webrtc.d.ts.map +0 -1
- package/dist/js/tsconfig.build.tsbuildinfo +0 -1
- package/dist/webrtc/src/BaseConnection.d.ts +0 -232
- package/dist/webrtc/src/BaseConnection.d.ts.map +0 -1
- package/dist/webrtc/src/RTCPeer.d.ts +0 -134
- package/dist/webrtc/src/RTCPeer.d.ts.map +0 -1
- package/dist/webrtc/src/RTCPeer.test.d.ts +0 -2
- package/dist/webrtc/src/RTCPeer.test.d.ts.map +0 -1
- package/dist/webrtc/src/RTCPeerConnectionManager.d.ts +0 -63
- package/dist/webrtc/src/RTCPeerConnectionManager.d.ts.map +0 -1
- package/dist/webrtc/src/RTCPeerConnectionManager.test.d.ts +0 -2
- package/dist/webrtc/src/RTCPeerConnectionManager.test.d.ts.map +0 -1
- package/dist/webrtc/src/connectionPoolManager.d.ts +0 -14
- package/dist/webrtc/src/connectionPoolManager.d.ts.map +0 -1
- package/dist/webrtc/src/index.d.ts +0 -7
- package/dist/webrtc/src/index.d.ts.map +0 -1
- package/dist/webrtc/src/index.test.d.ts +0 -1
- package/dist/webrtc/src/index.test.d.ts.map +0 -1
- package/dist/webrtc/src/setupTests.d.ts +0 -2
- package/dist/webrtc/src/setupTests.d.ts.map +0 -1
- package/dist/webrtc/src/utils/constants.d.ts +0 -7
- package/dist/webrtc/src/utils/constants.d.ts.map +0 -1
- package/dist/webrtc/src/utils/deviceHelpers.d.ts +0 -319
- package/dist/webrtc/src/utils/deviceHelpers.d.ts.map +0 -1
- package/dist/webrtc/src/utils/deviceHelpers.test.d.ts +0 -2
- package/dist/webrtc/src/utils/deviceHelpers.test.d.ts.map +0 -1
- package/dist/webrtc/src/utils/enumerateDevices.d.ts +0 -25
- package/dist/webrtc/src/utils/enumerateDevices.d.ts.map +0 -1
- package/dist/webrtc/src/utils/getDisplayMedia.d.ts +0 -17
- package/dist/webrtc/src/utils/getDisplayMedia.d.ts.map +0 -1
- package/dist/webrtc/src/utils/getUserMedia.d.ts +0 -35
- package/dist/webrtc/src/utils/getUserMedia.d.ts.map +0 -1
- package/dist/webrtc/src/utils/helpers.d.ts +0 -18
- package/dist/webrtc/src/utils/helpers.d.ts.map +0 -1
- package/dist/webrtc/src/utils/helpers.test.d.ts +0 -2
- package/dist/webrtc/src/utils/helpers.test.d.ts.map +0 -1
- package/dist/webrtc/src/utils/index.d.ts +0 -8
- package/dist/webrtc/src/utils/index.d.ts.map +0 -1
- package/dist/webrtc/src/utils/interfaces.d.ts +0 -139
- package/dist/webrtc/src/utils/interfaces.d.ts.map +0 -1
- package/dist/webrtc/src/utils/mockTracks.d.ts +0 -26
- package/dist/webrtc/src/utils/mockTracks.d.ts.map +0 -1
- package/dist/webrtc/src/utils/permissions.d.ts +0 -48
- package/dist/webrtc/src/utils/permissions.d.ts.map +0 -1
- package/dist/webrtc/src/utils/primitives.d.ts +0 -54
- package/dist/webrtc/src/utils/primitives.d.ts.map +0 -1
- package/dist/webrtc/src/utils/primitives.native.d.ts +0 -36
- package/dist/webrtc/src/utils/primitives.native.d.ts.map +0 -1
- package/dist/webrtc/src/utils/requestPermissions.d.ts +0 -27
- package/dist/webrtc/src/utils/requestPermissions.d.ts.map +0 -1
- package/dist/webrtc/src/utils/sdpHelpers.d.ts +0 -61
- package/dist/webrtc/src/utils/sdpHelpers.d.ts.map +0 -1
- package/dist/webrtc/src/utils/sdpHelpers.test.d.ts +0 -2
- package/dist/webrtc/src/utils/sdpHelpers.test.d.ts.map +0 -1
- package/dist/webrtc/src/utils/watchRTCPeerMediaPackets.d.ts +0 -7
- package/dist/webrtc/src/utils/watchRTCPeerMediaPackets.d.ts.map +0 -1
- package/dist/webrtc/src/utils/webrtcHelpers.test.d.ts +0 -2
- package/dist/webrtc/src/utils/webrtcHelpers.test.d.ts.map +0 -1
- package/dist/webrtc/src/webrtcMocks.d.ts +0 -110
- package/dist/webrtc/src/webrtcMocks.d.ts.map +0 -1
- package/dist/webrtc/src/workers/connectionPoolWorker.d.ts +0 -7
- package/dist/webrtc/src/workers/connectionPoolWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/index.d.ts +0 -7
- package/dist/webrtc/src/workers/index.d.ts.map +0 -1
- package/dist/webrtc/src/workers/promoteDemoteWorker.d.ts +0 -10
- package/dist/webrtc/src/workers/promoteDemoteWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/roomSubscribedWorker.d.ts +0 -10
- package/dist/webrtc/src/workers/roomSubscribedWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/sessionAuthWorker.d.ts +0 -10
- package/dist/webrtc/src/workers/sessionAuthWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/sessionConnectionPoolWorker.d.ts +0 -7
- package/dist/webrtc/src/workers/sessionConnectionPoolWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/vertoEventWorker.d.ts +0 -10
- package/dist/webrtc/src/workers/vertoEventWorker.d.ts.map +0 -1
- package/dist/webrtc/src/workers/vertoEventWorker.test.d.ts +0 -2
- package/dist/webrtc/src/workers/vertoEventWorker.test.d.ts.map +0 -1
- package/src/BaseRoomSession.ts +0 -302
- package/src/Client.ts +0 -193
- package/src/JWTSession.test.ts +0 -60
- package/src/JWTSession.ts +0 -146
- package/src/RoomSessionDevice.test.ts +0 -25
- package/src/RoomSessionDevice.ts +0 -62
- package/src/RoomSessionScreenShare.test.ts +0 -25
- package/src/RoomSessionScreenShare.ts +0 -58
- package/src/VideoOverlays.ts +0 -171
- package/src/buildVideoElement.test.ts +0 -933
- package/src/buildVideoElement.ts +0 -290
- package/src/cantina/VideoManager.test.ts +0 -95
- package/src/cantina/VideoManager.ts +0 -72
- package/src/cantina/index.ts +0 -1
- package/src/cantina/workers/index.ts +0 -1
- package/src/cantina/workers/videoManagerRoomWorker.ts +0 -28
- package/src/cantina/workers/videoManagerRoomsWorker.ts +0 -34
- package/src/cantina/workers/videoManagerWorker.ts +0 -64
- package/src/chat/Client.test.ts +0 -688
- package/src/chat/Client.ts +0 -94
- package/src/chat/index.ts +0 -31
- package/src/createClient.test.ts +0 -124
- package/src/createClient.ts +0 -48
- package/src/createRoomObject.ts +0 -149
- package/src/fabric/FabricRoomSession.test.ts +0 -695
- package/src/fabric/FabricRoomSession.ts +0 -446
- package/src/fabric/FabricRoomSessionMember.ts +0 -188
- package/src/fabric/HTTPClient.test.ts +0 -28
- package/src/fabric/HTTPClient.ts +0 -154
- package/src/fabric/IncomingCallManager.test.ts +0 -295
- package/src/fabric/IncomingCallManager.ts +0 -92
- package/src/fabric/SATSession.test.ts +0 -65
- package/src/fabric/SATSession.ts +0 -102
- package/src/fabric/SignalWire.test.ts +0 -115
- package/src/fabric/SignalWire.ts +0 -101
- package/src/fabric/WSClient.ts +0 -430
- package/src/fabric/createHttpClient.ts +0 -188
- package/src/fabric/createWSClient.ts +0 -12
- package/src/fabric/index.ts +0 -30
- package/src/fabric/interfaces/address.ts +0 -46
- package/src/fabric/interfaces/capabilities.ts +0 -30
- package/src/fabric/interfaces/conversation.ts +0 -145
- package/src/fabric/interfaces/device.ts +0 -21
- package/src/fabric/interfaces/httpClient.ts +0 -50
- package/src/fabric/interfaces/incomingCallManager.ts +0 -36
- package/src/fabric/interfaces/index.ts +0 -118
- package/src/fabric/interfaces/wsClient.ts +0 -154
- package/src/fabric/utils/capabilitiesHelpers.test.ts +0 -201
- package/src/fabric/utils/capabilitiesHelpers.ts +0 -208
- package/src/fabric/utils/constants.ts +0 -4
- package/src/fabric/utils/eventMappers.ts +0 -184
- package/src/fabric/utils/typeGuard.ts +0 -31
- package/src/fabric/utils/validationProxy.ts +0 -83
- package/src/fabric/utils/validators.ts +0 -242
- package/src/fabric/workers/callJoinWorker.ts +0 -88
- package/src/fabric/workers/callLeftWorker.ts +0 -32
- package/src/fabric/workers/callSegmentWorker.ts +0 -154
- package/src/fabric/workers/fabricMemberWorker.ts +0 -62
- package/src/fabric/workers/fabricWorker.ts +0 -100
- package/src/fabric/workers/index.ts +0 -2
- package/src/fabric/workers/wsClientWorker.ts +0 -60
- package/src/features/actions.ts +0 -5
- package/src/features/mediaElements/mediaElementsSagas.ts +0 -129
- package/src/index.test.ts +0 -5
- package/src/index.ts +0 -153
- package/src/joinRoom.ts +0 -29
- package/src/pubSub/Client.test.ts +0 -245
- package/src/pubSub/Client.ts +0 -90
- package/src/pubSub/index.ts +0 -10
- package/src/setupTests.ts +0 -122
- package/src/testUtils.ts +0 -259
- package/src/utils/CloseEvent.ts +0 -6
- package/src/utils/audioElement.ts +0 -21
- package/src/utils/constants.ts +0 -7
- package/src/utils/interfaces/base.ts +0 -55
- package/src/utils/interfaces/fabric.ts +0 -156
- package/src/utils/interfaces/index.ts +0 -3
- package/src/utils/interfaces/video.ts +0 -440
- package/src/utils/makeQueryParamsUrl.ts +0 -14
- package/src/utils/paginatedResult.ts +0 -35
- package/src/utils/roomSession.test.ts +0 -140
- package/src/utils/roomSession.ts +0 -85
- package/src/utils/storage.test.ts +0 -24
- package/src/utils/storage.ts +0 -37
- package/src/utils/videoElement.ts +0 -342
- package/src/video/RoomSession.test.ts +0 -31
- package/src/video/RoomSession.ts +0 -290
- package/src/video/VideoRoomSession.test.ts +0 -672
- package/src/video/VideoRoomSession.ts +0 -304
- package/src/video/index.ts +0 -43
- package/src/video/workers/childMemberJoinedWorker.test.ts +0 -99
- package/src/video/workers/childMemberJoinedWorker.ts +0 -75
- package/src/video/workers/index.ts +0 -6
- package/src/video/workers/memberListUpdatedWorker.ts +0 -217
- package/src/video/workers/videoPlaybackWorker.ts +0 -54
- package/src/video/workers/videoRecordWorker.ts +0 -54
- package/src/video/workers/videoStreamWorker.ts +0 -48
- package/src/video/workers/videoWorker.ts +0 -113
- package/src/webrtc.ts +0 -33
package/dist/index.esm.js
DELETED
|
@@ -1,4673 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __export = (target, all) => {
|
|
33
|
-
for (var name in all)
|
|
34
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
35
|
-
};
|
|
36
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
-
|
|
38
|
-
// src/chat/index.ts
|
|
39
|
-
var chat_exports = {};
|
|
40
|
-
__export(chat_exports, {
|
|
41
|
-
ChatMember: () => ChatMember,
|
|
42
|
-
ChatMessage: () => ChatMessage,
|
|
43
|
-
Client: () => Client2
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// src/createClient.ts
|
|
47
|
-
import {
|
|
48
|
-
configureStore,
|
|
49
|
-
connect as connect6,
|
|
50
|
-
getEventEmitter
|
|
51
|
-
} from "@signalwire/core";
|
|
52
|
-
|
|
53
|
-
// src/Client.ts
|
|
54
|
-
import {
|
|
55
|
-
BaseClient,
|
|
56
|
-
actions as actions3,
|
|
57
|
-
Chat as ChatNamespace,
|
|
58
|
-
PubSub as PubSubNamespace
|
|
59
|
-
} from "@signalwire/core";
|
|
60
|
-
|
|
61
|
-
// src/features/mediaElements/mediaElementsSagas.ts
|
|
62
|
-
import {
|
|
63
|
-
getLogger,
|
|
64
|
-
actions as actions2,
|
|
65
|
-
sagaEffects,
|
|
66
|
-
LOCAL_EVENT_PREFIX
|
|
67
|
-
} from "@signalwire/core";
|
|
68
|
-
import { setMediaElementSinkId } from "@signalwire/webrtc";
|
|
69
|
-
|
|
70
|
-
// src/utils/audioElement.ts
|
|
71
|
-
var setAudioMediaTrack = ({
|
|
72
|
-
track,
|
|
73
|
-
element
|
|
74
|
-
}) => {
|
|
75
|
-
element.autoplay = true;
|
|
76
|
-
element.playsinline = true;
|
|
77
|
-
element.srcObject = new MediaStream([track]);
|
|
78
|
-
track.addEventListener("ended", () => {
|
|
79
|
-
element.srcObject = null;
|
|
80
|
-
element.remove();
|
|
81
|
-
});
|
|
82
|
-
return element;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// src/features/actions.ts
|
|
86
|
-
import { actions } from "@signalwire/core";
|
|
87
|
-
var audioSetSpeakerAction = actions.createAction(
|
|
88
|
-
"swJs/audioSetSpeakerAction"
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// src/features/mediaElements/mediaElementsSagas.ts
|
|
92
|
-
var makeAudioElementSaga = ({ speakerId }) => {
|
|
93
|
-
return function* audioElementSaga({
|
|
94
|
-
instance: room,
|
|
95
|
-
runSaga
|
|
96
|
-
}) {
|
|
97
|
-
if (typeof Audio === "undefined") {
|
|
98
|
-
getLogger().warn("`Audio` is not supported on this environment.");
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const audioEl = room.getAudioEl();
|
|
103
|
-
let audioTask;
|
|
104
|
-
const trackHandler = function(event) {
|
|
105
|
-
switch (event.track.kind) {
|
|
106
|
-
case "audio": {
|
|
107
|
-
audioTask = runSaga(audioElementSetupWorker, {
|
|
108
|
-
track: event.track,
|
|
109
|
-
element: audioEl,
|
|
110
|
-
speakerId,
|
|
111
|
-
room
|
|
112
|
-
});
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
room.on("track", trackHandler);
|
|
118
|
-
room.once("destroy", () => {
|
|
119
|
-
audioTask == null ? void 0 : audioTask.cancel();
|
|
120
|
-
});
|
|
121
|
-
} catch (error) {
|
|
122
|
-
getLogger().error("audioElementSaga", error);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
function* audioElementActionsWatcher({
|
|
127
|
-
element,
|
|
128
|
-
room
|
|
129
|
-
}) {
|
|
130
|
-
const setSpeakerActionType = actions2.getCustomSagaActionType(
|
|
131
|
-
room.__uuid,
|
|
132
|
-
audioSetSpeakerAction
|
|
133
|
-
);
|
|
134
|
-
while (true) {
|
|
135
|
-
const action = yield sagaEffects.take([setSpeakerActionType]);
|
|
136
|
-
try {
|
|
137
|
-
switch (action.type) {
|
|
138
|
-
case setSpeakerActionType:
|
|
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
|
-
);
|
|
149
|
-
room.settleCustomSagaTrigger({
|
|
150
|
-
dispatchId: action.dispatchId,
|
|
151
|
-
payload: response,
|
|
152
|
-
kind: "resolve"
|
|
153
|
-
});
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
} catch (error) {
|
|
157
|
-
room.settleCustomSagaTrigger({
|
|
158
|
-
dispatchId: action.dispatchId,
|
|
159
|
-
payload: error,
|
|
160
|
-
kind: "reject"
|
|
161
|
-
});
|
|
162
|
-
getLogger().error(error);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function* audioElementSetupWorker({
|
|
167
|
-
track,
|
|
168
|
-
element,
|
|
169
|
-
speakerId,
|
|
170
|
-
room
|
|
171
|
-
}) {
|
|
172
|
-
setAudioMediaTrack({ track, element });
|
|
173
|
-
if (speakerId) {
|
|
174
|
-
setMediaElementSinkId(element, speakerId).catch(() => {
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
yield sagaEffects.fork(audioElementActionsWatcher, {
|
|
178
|
-
element,
|
|
179
|
-
room
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// src/cantina/VideoManager.ts
|
|
184
|
-
import {
|
|
185
|
-
connect,
|
|
186
|
-
validateEventsToSubscribe,
|
|
187
|
-
BaseConsumer
|
|
188
|
-
} from "@signalwire/core";
|
|
189
|
-
|
|
190
|
-
// src/cantina/workers/videoManagerWorker.ts
|
|
191
|
-
import { getLogger as getLogger4, sagaEffects as sagaEffects2 } from "@signalwire/core";
|
|
192
|
-
|
|
193
|
-
// src/cantina/workers/videoManagerRoomsWorker.ts
|
|
194
|
-
import {
|
|
195
|
-
getLogger as getLogger2,
|
|
196
|
-
toExternalJSON,
|
|
197
|
-
stripNamespacePrefix
|
|
198
|
-
} from "@signalwire/core";
|
|
199
|
-
var videoManagerRoomsWorker = function* (options) {
|
|
200
|
-
getLogger2().trace("videoManagerRoomsWorker started");
|
|
201
|
-
const {
|
|
202
|
-
instance: client,
|
|
203
|
-
action: { type, payload }
|
|
204
|
-
} = options;
|
|
205
|
-
const modPayload = {
|
|
206
|
-
rooms: payload.rooms.map((row) => toExternalJSON(row))
|
|
207
|
-
};
|
|
208
|
-
client.emit(
|
|
209
|
-
stripNamespacePrefix(type),
|
|
210
|
-
// @ts-expect-error
|
|
211
|
-
modPayload
|
|
212
|
-
);
|
|
213
|
-
getLogger2().trace("videoManagerRoomsWorker ended");
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// src/cantina/workers/videoManagerRoomWorker.ts
|
|
217
|
-
import {
|
|
218
|
-
getLogger as getLogger3,
|
|
219
|
-
toExternalJSON as toExternalJSON2,
|
|
220
|
-
stripNamespacePrefix as stripNamespacePrefix2
|
|
221
|
-
} from "@signalwire/core";
|
|
222
|
-
var videoManagerRoomWorker = function* (options) {
|
|
223
|
-
getLogger3().trace("videoManagerRoomWorker started");
|
|
224
|
-
const {
|
|
225
|
-
instance: client,
|
|
226
|
-
action: { type, payload }
|
|
227
|
-
} = options;
|
|
228
|
-
client.emit(
|
|
229
|
-
stripNamespacePrefix2(type),
|
|
230
|
-
toExternalJSON2(payload)
|
|
231
|
-
);
|
|
232
|
-
getLogger3().trace("videoManagerRoomWorker ended");
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
// src/cantina/workers/videoManagerWorker.ts
|
|
236
|
-
var videoManagerWorker = function* (options) {
|
|
237
|
-
getLogger4().trace("videoManagerWorker started");
|
|
238
|
-
const {
|
|
239
|
-
channels: { swEventChannel }
|
|
240
|
-
} = options;
|
|
241
|
-
function* worker(action) {
|
|
242
|
-
const { type } = action;
|
|
243
|
-
switch (type) {
|
|
244
|
-
case "video-manager.rooms.subscribed":
|
|
245
|
-
yield sagaEffects2.fork(videoManagerRoomsWorker, __spreadValues({
|
|
246
|
-
action
|
|
247
|
-
}, options));
|
|
248
|
-
break;
|
|
249
|
-
case "video-manager.room.added":
|
|
250
|
-
case "video-manager.room.deleted":
|
|
251
|
-
case "video-manager.room.ended":
|
|
252
|
-
case "video-manager.room.started":
|
|
253
|
-
case "video-manager.room.updated":
|
|
254
|
-
yield sagaEffects2.fork(videoManagerRoomWorker, __spreadValues({
|
|
255
|
-
action
|
|
256
|
-
}, options));
|
|
257
|
-
break;
|
|
258
|
-
default:
|
|
259
|
-
getLogger4().warn(`Unknown video-manager event: "${type}"`);
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
while (true) {
|
|
264
|
-
const action = yield sagaEffects2.take(
|
|
265
|
-
swEventChannel,
|
|
266
|
-
(action2) => {
|
|
267
|
-
return action2.type.startsWith("video-manager.");
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
yield sagaEffects2.fork(worker, action);
|
|
271
|
-
}
|
|
272
|
-
getLogger4().trace("videoManagerWorker ended");
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
// src/cantina/VideoManager.ts
|
|
276
|
-
var VideoManagerAPI = class extends BaseConsumer {
|
|
277
|
-
constructor(options) {
|
|
278
|
-
super(options);
|
|
279
|
-
this.runWorker("videoManagerWorker", {
|
|
280
|
-
worker: videoManagerWorker
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
/** @internal */
|
|
284
|
-
getSubscriptions() {
|
|
285
|
-
const eventNamesWithPrefix = this.eventNames().map(
|
|
286
|
-
(event) => `video-manager.${event}`
|
|
287
|
-
);
|
|
288
|
-
return validateEventsToSubscribe(eventNamesWithPrefix);
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
var createVideoManagerObject = (params) => {
|
|
292
|
-
const manager = connect({
|
|
293
|
-
store: params.store,
|
|
294
|
-
Component: VideoManagerAPI
|
|
295
|
-
})(params);
|
|
296
|
-
const proxy = new Proxy(manager, {
|
|
297
|
-
get(target, property, receiver) {
|
|
298
|
-
if (property === "_eventsNamespace") {
|
|
299
|
-
return "";
|
|
300
|
-
} else if (property === "eventChannel") {
|
|
301
|
-
return "video-manager.rooms";
|
|
302
|
-
}
|
|
303
|
-
return Reflect.get(target, property, receiver);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
return proxy;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// src/buildVideoElement.ts
|
|
310
|
-
import {
|
|
311
|
-
getLogger as getLogger20,
|
|
312
|
-
uuid as uuid2
|
|
313
|
-
} from "@signalwire/core";
|
|
314
|
-
|
|
315
|
-
// src/utils/videoElement.ts
|
|
316
|
-
import {
|
|
317
|
-
getLogger as getLogger19,
|
|
318
|
-
debounce,
|
|
319
|
-
uuid
|
|
320
|
-
} from "@signalwire/core";
|
|
321
|
-
|
|
322
|
-
// src/VideoOverlays.ts
|
|
323
|
-
import { getLogger as getLogger18 } from "@signalwire/core";
|
|
324
|
-
|
|
325
|
-
// src/video/VideoRoomSession.ts
|
|
326
|
-
import {
|
|
327
|
-
connect as connect3,
|
|
328
|
-
extendComponent as extendComponent3,
|
|
329
|
-
Rooms as Rooms6,
|
|
330
|
-
validateEventsToSubscribe as validateEventsToSubscribe3
|
|
331
|
-
} from "@signalwire/core";
|
|
332
|
-
|
|
333
|
-
// src/BaseRoomSession.ts
|
|
334
|
-
import {
|
|
335
|
-
connect as connect2,
|
|
336
|
-
LOCAL_EVENT_PREFIX as LOCAL_EVENT_PREFIX2
|
|
337
|
-
} from "@signalwire/core";
|
|
338
|
-
import {
|
|
339
|
-
BaseConnection as BaseConnection2,
|
|
340
|
-
createSpeakerDeviceWatcher,
|
|
341
|
-
getDisplayMedia,
|
|
342
|
-
getSpeakerById,
|
|
343
|
-
supportsMediaOutput
|
|
344
|
-
} from "@signalwire/webrtc";
|
|
345
|
-
|
|
346
|
-
// src/utils/constants.ts
|
|
347
|
-
var SCREENSHARE_AUDIO_CONSTRAINTS = {
|
|
348
|
-
echoCancellation: true,
|
|
349
|
-
noiseSuppression: false,
|
|
350
|
-
autoGainControl: false,
|
|
351
|
-
// @ts-expect-error
|
|
352
|
-
googAutoGainControl: false
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
// src/utils/roomSession.ts
|
|
356
|
-
import { getLogger as getLogger5 } from "@signalwire/core";
|
|
357
|
-
var getJoinMediaParams = (options) => {
|
|
358
|
-
const {
|
|
359
|
-
authorization,
|
|
360
|
-
audio = true,
|
|
361
|
-
video = true,
|
|
362
|
-
sendAudio,
|
|
363
|
-
sendVideo,
|
|
364
|
-
receiveAudio,
|
|
365
|
-
receiveVideo
|
|
366
|
-
} = options;
|
|
367
|
-
getLogger5().debug("getJoinMediaParams options", __spreadValues({}, options));
|
|
368
|
-
const { audio_allowed, video_allowed, join_as } = authorization;
|
|
369
|
-
const joinAs = join_as != null ? join_as : "member";
|
|
370
|
-
const canSend = joinAs === "member";
|
|
371
|
-
const canSendAudio = canSend && audio_allowed === "both";
|
|
372
|
-
const canSendVideo = canSend && video_allowed === "both";
|
|
373
|
-
const canReceiveAudio = audio_allowed !== "none";
|
|
374
|
-
const canReceiveVideo = video_allowed !== "none";
|
|
375
|
-
const reqToSendAudio = Boolean(sendAudio != null ? sendAudio : audio);
|
|
376
|
-
const reqToSendVideo = Boolean(sendVideo != null ? sendVideo : video);
|
|
377
|
-
const reqToReceiveAudio = Boolean(receiveAudio != null ? receiveAudio : audio);
|
|
378
|
-
const reqToReceiveVideo = Boolean(receiveVideo != null ? receiveVideo : video);
|
|
379
|
-
if (!canSendAudio && reqToSendAudio) {
|
|
380
|
-
getLogger5().info(
|
|
381
|
-
"Not allowed to send audio on this room. Default values will be used."
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
if (!canSendVideo && reqToSendVideo) {
|
|
385
|
-
getLogger5().info(
|
|
386
|
-
"Not allowed to send video on this room. Default values will be used."
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
if (!canReceiveAudio && reqToReceiveAudio) {
|
|
390
|
-
getLogger5().info(
|
|
391
|
-
"Not allowed to receive video from the room. Default values will be used."
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
if (!canReceiveVideo && reqToReceiveVideo) {
|
|
395
|
-
getLogger5().info(
|
|
396
|
-
"Not allowed to receive video from the room. Default values will be used."
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
mustSendAudio: canSendAudio && reqToSendAudio,
|
|
401
|
-
mustSendVideo: canSendVideo && reqToSendVideo,
|
|
402
|
-
mustRecvAudio: canReceiveAudio && reqToReceiveAudio,
|
|
403
|
-
mustRecvVideo: canReceiveVideo && reqToReceiveVideo
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
var checkMediaParams = (options) => {
|
|
407
|
-
return Object.values(options).some(Boolean);
|
|
408
|
-
};
|
|
409
|
-
var SDK_PREFIX = "sw-sdk-";
|
|
410
|
-
var addSDKPrefix = (id) => {
|
|
411
|
-
return `${SDK_PREFIX}${id}`;
|
|
412
|
-
};
|
|
413
|
-
var OVERLAY_PREFIX = "sw-overlay-";
|
|
414
|
-
var addOverlayPrefix = (id) => {
|
|
415
|
-
return `${OVERLAY_PREFIX}${id}`;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
// src/RoomSessionScreenShare.ts
|
|
419
|
-
import {
|
|
420
|
-
Rooms,
|
|
421
|
-
extendComponent
|
|
422
|
-
} from "@signalwire/core";
|
|
423
|
-
import { BaseConnection } from "@signalwire/webrtc";
|
|
424
|
-
var RoomSessionScreenShareConnection = class extends BaseConnection {
|
|
425
|
-
join() {
|
|
426
|
-
return super.invite();
|
|
427
|
-
}
|
|
428
|
-
leave() {
|
|
429
|
-
return super.hangup();
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
var RoomSessionScreenShareAPI = extendComponent(RoomSessionScreenShareConnection, {
|
|
433
|
-
audioMute: Rooms.audioMuteMember,
|
|
434
|
-
audioUnmute: Rooms.audioUnmuteMember,
|
|
435
|
-
videoMute: Rooms.videoMuteMember,
|
|
436
|
-
videoUnmute: Rooms.videoUnmuteMember,
|
|
437
|
-
setMicrophoneVolume: Rooms.setInputVolumeMember,
|
|
438
|
-
setInputVolume: Rooms.setInputVolumeMember,
|
|
439
|
-
setInputSensitivity: Rooms.setInputSensitivityMember
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
// src/video/workers/memberListUpdatedWorker.ts
|
|
443
|
-
import {
|
|
444
|
-
sagaEffects as sagaEffects3,
|
|
445
|
-
toSyntheticEvent,
|
|
446
|
-
validateEventsToSubscribe as validateEventsToSubscribe2,
|
|
447
|
-
toInternalEventName
|
|
448
|
-
} from "@signalwire/core";
|
|
449
|
-
var noop = () => {
|
|
450
|
-
};
|
|
451
|
-
var EXTERNAL_MEMBER_LIST_UPDATED_EVENT = "memberList.updated";
|
|
452
|
-
var INTERNAL_MEMBER_LIST_UPDATED_EVENT = toInternalEventName({
|
|
453
|
-
event: EXTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
454
|
-
});
|
|
455
|
-
var SYNTHETIC_MEMBER_LIST_UPDATED_EVENT = toSyntheticEvent(
|
|
456
|
-
INTERNAL_MEMBER_LIST_UPDATED_EVENT
|
|
457
|
-
);
|
|
458
|
-
var MEMBER_LIST_EVENTS = [
|
|
459
|
-
/** Alias to `video.room.subscribed` */
|
|
460
|
-
"video.room.joined",
|
|
461
|
-
"video.member.joined",
|
|
462
|
-
"video.member.left",
|
|
463
|
-
"video.member.updated"
|
|
464
|
-
];
|
|
465
|
-
var isMemberListEvent = (event) => {
|
|
466
|
-
return MEMBER_LIST_EVENTS.includes(event);
|
|
467
|
-
};
|
|
468
|
-
var getMemberListEventsToSubscribe = (subscriptions) => {
|
|
469
|
-
return validateEventsToSubscribe2(MEMBER_LIST_EVENTS).filter((event) => {
|
|
470
|
-
return !subscriptions.includes(event);
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
var shouldHandleMemberList = (subscriptions) => {
|
|
474
|
-
return subscriptions.some(
|
|
475
|
-
(event) => event.includes(EXTERNAL_MEMBER_LIST_UPDATED_EVENT)
|
|
476
|
-
);
|
|
477
|
-
};
|
|
478
|
-
var getMembersFromAction = (action) => {
|
|
479
|
-
if (action.type === "video.room.joined") {
|
|
480
|
-
return action.payload.room_session.members;
|
|
481
|
-
}
|
|
482
|
-
return [action.payload.member];
|
|
483
|
-
};
|
|
484
|
-
var getUpdatedMembers = ({
|
|
485
|
-
action,
|
|
486
|
-
memberList
|
|
487
|
-
}) => {
|
|
488
|
-
const actionMembers = getMembersFromAction(action);
|
|
489
|
-
switch (action.type) {
|
|
490
|
-
case "video.member.left":
|
|
491
|
-
actionMembers.forEach((member) => {
|
|
492
|
-
memberList.delete(member.id);
|
|
493
|
-
});
|
|
494
|
-
break;
|
|
495
|
-
default:
|
|
496
|
-
actionMembers.forEach((member) => {
|
|
497
|
-
memberList.set(member.id, member);
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
return Array.from(memberList.values());
|
|
501
|
-
};
|
|
502
|
-
var initMemberListSubscriptions = (room, subscriptions) => {
|
|
503
|
-
const events = getMemberListEventsToSubscribe(subscriptions);
|
|
504
|
-
events.forEach((event) => {
|
|
505
|
-
room.once(event, noop);
|
|
506
|
-
});
|
|
507
|
-
const eventBridgeHandler = ({ members }) => {
|
|
508
|
-
room.emit(EXTERNAL_MEMBER_LIST_UPDATED_EVENT, { members });
|
|
509
|
-
};
|
|
510
|
-
room.on(SYNTHETIC_MEMBER_LIST_UPDATED_EVENT, eventBridgeHandler);
|
|
511
|
-
const cleanup = () => {
|
|
512
|
-
room.off(SYNTHETIC_MEMBER_LIST_UPDATED_EVENT, eventBridgeHandler);
|
|
513
|
-
};
|
|
514
|
-
return {
|
|
515
|
-
cleanup
|
|
516
|
-
};
|
|
517
|
-
};
|
|
518
|
-
function* membersListUpdatedWatcher({
|
|
519
|
-
swEventChannel,
|
|
520
|
-
instance
|
|
521
|
-
}) {
|
|
522
|
-
const memberList = /* @__PURE__ */ new Map();
|
|
523
|
-
function* worker(pubSubAction) {
|
|
524
|
-
const roomSessionId = pubSubAction.type === "video.room.joined" ? pubSubAction.payload.room_session.id : pubSubAction.payload.room_session_id;
|
|
525
|
-
const members = getUpdatedMembers({ action: pubSubAction, memberList });
|
|
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
|
-
*/
|
|
533
|
-
room_session_id: roomSessionId,
|
|
534
|
-
members
|
|
535
|
-
};
|
|
536
|
-
instance.emit(SYNTHETIC_MEMBER_LIST_UPDATED_EVENT, memberListPayload);
|
|
537
|
-
}
|
|
538
|
-
while (true) {
|
|
539
|
-
const pubSubAction = yield sagaEffects3.take(
|
|
540
|
-
swEventChannel,
|
|
541
|
-
({ type }) => {
|
|
542
|
-
return isMemberListEvent(type);
|
|
543
|
-
}
|
|
544
|
-
);
|
|
545
|
-
yield sagaEffects3.fork(worker, pubSubAction);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
var memberListUpdatedWorker = function* membersChangedWorker({
|
|
549
|
-
channels: { swEventChannel },
|
|
550
|
-
instance
|
|
551
|
-
}) {
|
|
552
|
-
const subscriptions = instance.getSubscriptions();
|
|
553
|
-
if (!shouldHandleMemberList(subscriptions)) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
const { cleanup } = initMemberListSubscriptions(instance, subscriptions);
|
|
557
|
-
yield sagaEffects3.fork(membersListUpdatedWatcher, {
|
|
558
|
-
swEventChannel,
|
|
559
|
-
instance
|
|
560
|
-
});
|
|
561
|
-
instance.once("destroy", () => {
|
|
562
|
-
cleanup();
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
// src/video/workers/childMemberJoinedWorker.ts
|
|
567
|
-
import {
|
|
568
|
-
getLogger as getLogger6,
|
|
569
|
-
sagaEffects as sagaEffects4,
|
|
570
|
-
componentSelectors,
|
|
571
|
-
componentActions
|
|
572
|
-
} from "@signalwire/core";
|
|
573
|
-
var childMemberJoinedWorker = function* (options) {
|
|
574
|
-
getLogger6().trace("childMemberJoinedWorker started");
|
|
575
|
-
const { channels, instance, initialState, onDone, onFail } = options;
|
|
576
|
-
const { swEventChannel } = channels;
|
|
577
|
-
const { parentId } = initialState;
|
|
578
|
-
if (!parentId) {
|
|
579
|
-
throw new Error("Missing parentId for childMemberJoinedWorker");
|
|
580
|
-
}
|
|
581
|
-
const action = yield sagaEffects4.take(swEventChannel, (action2) => {
|
|
582
|
-
if (action2.type === "video.member.joined") {
|
|
583
|
-
return action2.payload.member.parent_id === parentId;
|
|
584
|
-
}
|
|
585
|
-
return false;
|
|
586
|
-
});
|
|
587
|
-
const { member } = action.payload;
|
|
588
|
-
if (member == null ? void 0 : member.parent_id) {
|
|
589
|
-
const byId = yield sagaEffects4.select(
|
|
590
|
-
componentSelectors.getComponentsById
|
|
591
|
-
);
|
|
592
|
-
const parent = Object.values(byId).find((row) => {
|
|
593
|
-
return "memberId" in row && row.memberId === member.parent_id;
|
|
594
|
-
});
|
|
595
|
-
if (parent) {
|
|
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
|
-
);
|
|
604
|
-
onDone == null ? void 0 : onDone();
|
|
605
|
-
} else {
|
|
606
|
-
onFail == null ? void 0 : onFail({ error: new Error("Unknown parent_id") });
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
getLogger6().trace("childMemberJoinedWorker ended");
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
// src/video/workers/videoWorker.ts
|
|
613
|
-
import {
|
|
614
|
-
getLogger as getLogger10,
|
|
615
|
-
sagaEffects as sagaEffects5,
|
|
616
|
-
MemberPosition,
|
|
617
|
-
stripNamespacePrefix as stripNamespacePrefix5
|
|
618
|
-
} from "@signalwire/core";
|
|
619
|
-
|
|
620
|
-
// src/video/workers/videoStreamWorker.ts
|
|
621
|
-
import {
|
|
622
|
-
getLogger as getLogger7,
|
|
623
|
-
Rooms as Rooms2
|
|
624
|
-
} from "@signalwire/core";
|
|
625
|
-
var videoStreamWorker = function* (options) {
|
|
626
|
-
getLogger7().trace("videoStreamWorker started");
|
|
627
|
-
const {
|
|
628
|
-
instance: roomSession,
|
|
629
|
-
action: { type, payload },
|
|
630
|
-
instanceMap: { get, set, remove }
|
|
631
|
-
} = options;
|
|
632
|
-
let streamInstance = get(payload.stream.id);
|
|
633
|
-
if (!streamInstance) {
|
|
634
|
-
streamInstance = Rooms2.createRoomSessionStreamObject({
|
|
635
|
-
store: roomSession.store,
|
|
636
|
-
payload
|
|
637
|
-
});
|
|
638
|
-
} else {
|
|
639
|
-
streamInstance.setPayload(payload);
|
|
640
|
-
}
|
|
641
|
-
set(payload.stream.id, streamInstance);
|
|
642
|
-
switch (type) {
|
|
643
|
-
case "video.stream.started":
|
|
644
|
-
roomSession.emit("stream.started", streamInstance);
|
|
645
|
-
break;
|
|
646
|
-
case "video.stream.ended":
|
|
647
|
-
roomSession.emit("stream.ended", streamInstance);
|
|
648
|
-
remove(payload.stream.id);
|
|
649
|
-
break;
|
|
650
|
-
default:
|
|
651
|
-
getLogger7().warn(`Unknown video.stream event: "${type}"`);
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
654
|
-
getLogger7().trace("videoStreamWorker ended");
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
// src/video/workers/videoRecordWorker.ts
|
|
658
|
-
import {
|
|
659
|
-
getLogger as getLogger8,
|
|
660
|
-
Rooms as Rooms3,
|
|
661
|
-
stripNamespacePrefix as stripNamespacePrefix3
|
|
662
|
-
} from "@signalwire/core";
|
|
663
|
-
var videoRecordWorker = function* (options) {
|
|
664
|
-
getLogger8().trace("videoRecordWorker started");
|
|
665
|
-
const {
|
|
666
|
-
instance: roomSession,
|
|
667
|
-
action: { type, payload },
|
|
668
|
-
instanceMap: { get, set, remove }
|
|
669
|
-
} = options;
|
|
670
|
-
let recordingInstance = get(payload.recording.id);
|
|
671
|
-
if (!recordingInstance) {
|
|
672
|
-
recordingInstance = Rooms3.createRoomSessionRecordingObject({
|
|
673
|
-
store: roomSession.store,
|
|
674
|
-
payload
|
|
675
|
-
});
|
|
676
|
-
} else {
|
|
677
|
-
recordingInstance.setPayload(payload);
|
|
678
|
-
}
|
|
679
|
-
set(payload.recording.id, recordingInstance);
|
|
680
|
-
const event = stripNamespacePrefix3(type);
|
|
681
|
-
switch (type) {
|
|
682
|
-
case "video.recording.started":
|
|
683
|
-
case "video.recording.updated": {
|
|
684
|
-
roomSession.emit(event, recordingInstance);
|
|
685
|
-
break;
|
|
686
|
-
}
|
|
687
|
-
case "video.recording.ended":
|
|
688
|
-
roomSession.emit(event, recordingInstance);
|
|
689
|
-
remove(payload.recording.id);
|
|
690
|
-
break;
|
|
691
|
-
default:
|
|
692
|
-
getLogger8().warn(`Unknown video.stream event: "${type}"`);
|
|
693
|
-
break;
|
|
694
|
-
}
|
|
695
|
-
getLogger8().trace("videoRecordWorker ended");
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
// src/video/workers/videoPlaybackWorker.ts
|
|
699
|
-
import {
|
|
700
|
-
getLogger as getLogger9,
|
|
701
|
-
Rooms as Rooms4,
|
|
702
|
-
stripNamespacePrefix as stripNamespacePrefix4
|
|
703
|
-
} from "@signalwire/core";
|
|
704
|
-
var videoPlaybackWorker = function* (options) {
|
|
705
|
-
getLogger9().trace("videoPlaybackWorker started");
|
|
706
|
-
const {
|
|
707
|
-
instance: roomSession,
|
|
708
|
-
action: { type, payload },
|
|
709
|
-
instanceMap: { get, set, remove }
|
|
710
|
-
} = options;
|
|
711
|
-
let playbackInstance = get(payload.playback.id);
|
|
712
|
-
if (!playbackInstance) {
|
|
713
|
-
playbackInstance = Rooms4.createRoomSessionPlaybackObject({
|
|
714
|
-
store: roomSession.store,
|
|
715
|
-
payload
|
|
716
|
-
});
|
|
717
|
-
} else {
|
|
718
|
-
playbackInstance.setPayload(payload);
|
|
719
|
-
}
|
|
720
|
-
set(payload.playback.id, playbackInstance);
|
|
721
|
-
const event = stripNamespacePrefix4(type);
|
|
722
|
-
switch (type) {
|
|
723
|
-
case "video.playback.started":
|
|
724
|
-
case "video.playback.updated": {
|
|
725
|
-
roomSession.emit(event, playbackInstance);
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
case "video.playback.ended":
|
|
729
|
-
roomSession.emit(event, playbackInstance);
|
|
730
|
-
remove(payload.playback.id);
|
|
731
|
-
break;
|
|
732
|
-
default:
|
|
733
|
-
getLogger9().warn(`Unknown video.stream event: "${type}"`);
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
getLogger9().trace("videoPlaybackWorker ended");
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
// src/video/workers/videoWorker.ts
|
|
740
|
-
var videoWorker = function* (options) {
|
|
741
|
-
getLogger10().trace("videoWorker started");
|
|
742
|
-
const { channels, instance: roomSession } = options;
|
|
743
|
-
const { swEventChannel } = channels;
|
|
744
|
-
function* worker(action) {
|
|
745
|
-
const { type, payload } = action;
|
|
746
|
-
switch (type) {
|
|
747
|
-
case "video.room.subscribed":
|
|
748
|
-
yield sagaEffects5.fork(MemberPosition.memberPositionWorker, __spreadProps(__spreadValues({}, options), {
|
|
749
|
-
instance: roomSession,
|
|
750
|
-
initialState: payload
|
|
751
|
-
}));
|
|
752
|
-
return;
|
|
753
|
-
case "video.playback.started":
|
|
754
|
-
case "video.playback.updated":
|
|
755
|
-
case "video.playback.ended":
|
|
756
|
-
yield sagaEffects5.fork(videoPlaybackWorker, __spreadValues({
|
|
757
|
-
action
|
|
758
|
-
}, options));
|
|
759
|
-
return;
|
|
760
|
-
// Return since we don't need to handle the raw event for this
|
|
761
|
-
case "video.recording.started":
|
|
762
|
-
case "video.recording.updated":
|
|
763
|
-
case "video.recording.ended":
|
|
764
|
-
yield sagaEffects5.fork(videoRecordWorker, __spreadValues({
|
|
765
|
-
action
|
|
766
|
-
}, options));
|
|
767
|
-
return;
|
|
768
|
-
case "video.stream.ended":
|
|
769
|
-
case "video.stream.started":
|
|
770
|
-
yield sagaEffects5.fork(videoStreamWorker, __spreadValues({
|
|
771
|
-
action
|
|
772
|
-
}, options));
|
|
773
|
-
return;
|
|
774
|
-
case "video.room.audience_count": {
|
|
775
|
-
roomSession.emit("room.audienceCount", payload);
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
case "video.member.talking": {
|
|
779
|
-
const { member } = payload;
|
|
780
|
-
if ("talking" in member) {
|
|
781
|
-
const suffix = member.talking ? "started" : "ended";
|
|
782
|
-
roomSession.emit(`member.talking.${suffix}`, payload);
|
|
783
|
-
const deprecatedSuffix = member.talking ? "start" : "stop";
|
|
784
|
-
roomSession.emit(`member.talking.${deprecatedSuffix}`, payload);
|
|
785
|
-
}
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
case "video.layout.changed": {
|
|
789
|
-
roomSession.currentLayoutEvent = action.payload;
|
|
790
|
-
break;
|
|
791
|
-
}
|
|
792
|
-
default:
|
|
793
|
-
break;
|
|
794
|
-
}
|
|
795
|
-
const event = stripNamespacePrefix5(type, "video");
|
|
796
|
-
roomSession.emit(event, payload);
|
|
797
|
-
}
|
|
798
|
-
const isVideoEvent = (action) => {
|
|
799
|
-
return action.type.startsWith("video.");
|
|
800
|
-
};
|
|
801
|
-
while (true) {
|
|
802
|
-
const action = yield sagaEffects5.take(
|
|
803
|
-
swEventChannel,
|
|
804
|
-
isVideoEvent
|
|
805
|
-
);
|
|
806
|
-
yield sagaEffects5.fork(worker, action);
|
|
807
|
-
}
|
|
808
|
-
getLogger10().trace("videoWorker ended");
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
// src/BaseRoomSession.ts
|
|
812
|
-
var BaseRoomSessionConnection = class extends BaseConnection2 {
|
|
813
|
-
constructor() {
|
|
814
|
-
super(...arguments);
|
|
815
|
-
__publicField(this, "_screenShareList", /* @__PURE__ */ new Set());
|
|
816
|
-
__publicField(this, "_audioEl");
|
|
817
|
-
__publicField(this, "_overlayMap");
|
|
818
|
-
__publicField(this, "_localVideoOverlay");
|
|
819
|
-
}
|
|
820
|
-
get audioEl() {
|
|
821
|
-
return this._audioEl;
|
|
822
|
-
}
|
|
823
|
-
set overlayMap(map) {
|
|
824
|
-
this._overlayMap = map;
|
|
825
|
-
}
|
|
826
|
-
get overlayMap() {
|
|
827
|
-
return this._overlayMap;
|
|
828
|
-
}
|
|
829
|
-
set localVideoOverlay(overlay) {
|
|
830
|
-
this._localVideoOverlay = overlay;
|
|
831
|
-
}
|
|
832
|
-
get localVideoOverlay() {
|
|
833
|
-
return this._localVideoOverlay;
|
|
834
|
-
}
|
|
835
|
-
get screenShareList() {
|
|
836
|
-
return Array.from(this._screenShareList);
|
|
837
|
-
}
|
|
838
|
-
_attachSpeakerTrackListener() {
|
|
839
|
-
if (!supportsMediaOutput()) return;
|
|
840
|
-
createSpeakerDeviceWatcher().then((deviceWatcher) => {
|
|
841
|
-
deviceWatcher.on("removed", async (data) => {
|
|
842
|
-
var _a, _b;
|
|
843
|
-
const sinkId = this._audioEl.sinkId;
|
|
844
|
-
const disconnectedSpeaker = data.changes.find((device) => {
|
|
845
|
-
const payloadDeviceId = device.payload.deviceId;
|
|
846
|
-
return payloadDeviceId === sinkId || payloadDeviceId === "" && sinkId === "default" || payloadDeviceId === "default" && sinkId === "";
|
|
847
|
-
});
|
|
848
|
-
if (disconnectedSpeaker) {
|
|
849
|
-
this.emit("speaker.disconnected", {
|
|
850
|
-
deviceId: disconnectedSpeaker.payload.deviceId,
|
|
851
|
-
label: disconnectedSpeaker.payload.label
|
|
852
|
-
});
|
|
853
|
-
await ((_b = (_a = this._audioEl).setSinkId) == null ? void 0 : _b.call(_a, ""));
|
|
854
|
-
const defaultSpeakers = await getSpeakerById("default");
|
|
855
|
-
if (!(defaultSpeakers == null ? void 0 : defaultSpeakers.deviceId)) return;
|
|
856
|
-
this.emit("speaker.updated", {
|
|
857
|
-
previous: {
|
|
858
|
-
deviceId: disconnectedSpeaker.payload.deviceId,
|
|
859
|
-
label: disconnectedSpeaker.payload.label
|
|
860
|
-
},
|
|
861
|
-
current: {
|
|
862
|
-
deviceId: defaultSpeakers.deviceId,
|
|
863
|
-
label: defaultSpeakers.label
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
/** @internal */
|
|
871
|
-
_finalize() {
|
|
872
|
-
this._screenShareList.clear();
|
|
873
|
-
super._finalize();
|
|
874
|
-
}
|
|
875
|
-
/** @internal */
|
|
876
|
-
async hangup(id) {
|
|
877
|
-
this._screenShareList.forEach((screenShare) => {
|
|
878
|
-
screenShare.leave();
|
|
879
|
-
});
|
|
880
|
-
return super.hangup(id);
|
|
881
|
-
}
|
|
882
|
-
leave() {
|
|
883
|
-
return this.hangup();
|
|
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
|
-
*/
|
|
891
|
-
attachPreConnectWorkers() {
|
|
892
|
-
this.runWorker("memberListUpdated", {
|
|
893
|
-
worker: memberListUpdatedWorker
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
/** @internal */
|
|
897
|
-
getAudioEl() {
|
|
898
|
-
if (this._audioEl) return this._audioEl;
|
|
899
|
-
this._audioEl = new Audio();
|
|
900
|
-
this._attachSpeakerTrackListener();
|
|
901
|
-
return this._audioEl;
|
|
902
|
-
}
|
|
903
|
-
getMemberOverlay(memberId) {
|
|
904
|
-
return this.overlayMap.get(addOverlayPrefix(memberId));
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Allow sharing the screen within the room.
|
|
908
|
-
*/
|
|
909
|
-
async startScreenShare(opts = {}) {
|
|
910
|
-
return new Promise(async (resolve, reject) => {
|
|
911
|
-
var _a;
|
|
912
|
-
const {
|
|
913
|
-
autoJoin = true,
|
|
914
|
-
audio = false,
|
|
915
|
-
video = true,
|
|
916
|
-
layout,
|
|
917
|
-
positions
|
|
918
|
-
} = opts;
|
|
919
|
-
try {
|
|
920
|
-
const displayStream = await getDisplayMedia({
|
|
921
|
-
audio: audio === true ? SCREENSHARE_AUDIO_CONSTRAINTS : audio,
|
|
922
|
-
video
|
|
923
|
-
});
|
|
924
|
-
const options = __spreadProps(__spreadValues({}, this.options), {
|
|
925
|
-
screenShare: true,
|
|
926
|
-
recoverCall: false,
|
|
927
|
-
localStream: displayStream,
|
|
928
|
-
remoteStream: void 0,
|
|
929
|
-
userVariables: __spreadProps(__spreadValues({}, ((_a = this.options) == null ? void 0 : _a.userVariables) || {}), {
|
|
930
|
-
memberCallId: this.callId,
|
|
931
|
-
memberId: this.memberId
|
|
932
|
-
}),
|
|
933
|
-
layout,
|
|
934
|
-
positions
|
|
935
|
-
});
|
|
936
|
-
const screenShare = connect2({
|
|
937
|
-
store: this.store,
|
|
938
|
-
Component: RoomSessionScreenShareAPI
|
|
939
|
-
})(options);
|
|
940
|
-
displayStream.getVideoTracks().forEach((t) => {
|
|
941
|
-
t.addEventListener("ended", () => {
|
|
942
|
-
if (screenShare && screenShare.active) {
|
|
943
|
-
screenShare.leave();
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
});
|
|
947
|
-
screenShare.once("destroy", () => {
|
|
948
|
-
screenShare.emit("room.left");
|
|
949
|
-
this._screenShareList.delete(screenShare);
|
|
950
|
-
});
|
|
951
|
-
screenShare.runWorker("childMemberJoinedWorker", {
|
|
952
|
-
worker: childMemberJoinedWorker,
|
|
953
|
-
onDone: () => resolve(screenShare),
|
|
954
|
-
onFail: reject,
|
|
955
|
-
initialState: {
|
|
956
|
-
parentId: this.memberId
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
this._screenShareList.add(screenShare);
|
|
960
|
-
if (autoJoin) {
|
|
961
|
-
return await screenShare.join();
|
|
962
|
-
}
|
|
963
|
-
return resolve(screenShare);
|
|
964
|
-
} catch (error) {
|
|
965
|
-
this.logger.error("ScreenShare Error", error);
|
|
966
|
-
reject(error);
|
|
967
|
-
}
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
updateSpeaker({ deviceId }) {
|
|
971
|
-
const prevId = this.audioEl.sinkId;
|
|
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
|
-
);
|
|
992
|
-
return this.triggerCustomSaga(audioSetSpeakerAction(deviceId));
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
|
|
996
|
-
// src/RoomSessionDevice.ts
|
|
997
|
-
import {
|
|
998
|
-
Rooms as Rooms5,
|
|
999
|
-
extendComponent as extendComponent2
|
|
1000
|
-
} from "@signalwire/core";
|
|
1001
|
-
import { BaseConnection as BaseConnection3 } from "@signalwire/webrtc";
|
|
1002
|
-
var RoomSessionDeviceConnection = class extends BaseConnection3 {
|
|
1003
|
-
join() {
|
|
1004
|
-
return super.invite();
|
|
1005
|
-
}
|
|
1006
|
-
leave() {
|
|
1007
|
-
return super.hangup();
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
var RoomSessionDeviceAPI = extendComponent2(RoomSessionDeviceConnection, {
|
|
1011
|
-
audioMute: Rooms5.audioMuteMember,
|
|
1012
|
-
audioUnmute: Rooms5.audioUnmuteMember,
|
|
1013
|
-
videoMute: Rooms5.videoMuteMember,
|
|
1014
|
-
videoUnmute: Rooms5.videoUnmuteMember,
|
|
1015
|
-
setInputVolume: Rooms5.setInputVolumeMember,
|
|
1016
|
-
setMicrophoneVolume: Rooms5.setInputVolumeMember,
|
|
1017
|
-
setInputSensitivity: Rooms5.setInputSensitivityMember
|
|
1018
|
-
});
|
|
1019
|
-
|
|
1020
|
-
// src/video/VideoRoomSession.ts
|
|
1021
|
-
var VideoRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
1022
|
-
constructor(options) {
|
|
1023
|
-
super(options);
|
|
1024
|
-
__publicField(this, "_deviceList", /* @__PURE__ */ new Set());
|
|
1025
|
-
__publicField(this, "_currentLayoutEvent");
|
|
1026
|
-
this.initWorker();
|
|
1027
|
-
}
|
|
1028
|
-
set currentLayoutEvent(event) {
|
|
1029
|
-
this._currentLayoutEvent = event;
|
|
1030
|
-
}
|
|
1031
|
-
get currentLayoutEvent() {
|
|
1032
|
-
return this._currentLayoutEvent;
|
|
1033
|
-
}
|
|
1034
|
-
get currentLayout() {
|
|
1035
|
-
var _a;
|
|
1036
|
-
return (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout;
|
|
1037
|
-
}
|
|
1038
|
-
get currentPosition() {
|
|
1039
|
-
var _a, _b;
|
|
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;
|
|
1043
|
-
}
|
|
1044
|
-
get deviceList() {
|
|
1045
|
-
return Array.from(this._deviceList);
|
|
1046
|
-
}
|
|
1047
|
-
get interactivityMode() {
|
|
1048
|
-
return this.select(({ session }) => {
|
|
1049
|
-
var _a;
|
|
1050
|
-
const { authorization } = session;
|
|
1051
|
-
return (_a = authorization == null ? void 0 : authorization.join_as) != null ? _a : "";
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
get permissions() {
|
|
1055
|
-
return this.select(({ session }) => {
|
|
1056
|
-
var _a, _b;
|
|
1057
|
-
const { authorization } = session;
|
|
1058
|
-
return (_b = (_a = authorization == null ? void 0 : authorization.room) == null ? void 0 : _a.scopes) != null ? _b : [];
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
initWorker() {
|
|
1062
|
-
this.runWorker("videoWorker", {
|
|
1063
|
-
worker: videoWorker
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
/** @internal */
|
|
1067
|
-
getSubscriptions() {
|
|
1068
|
-
const eventNamesWithPrefix = this.eventNames().map((event) => {
|
|
1069
|
-
return `video.${String(event)}`;
|
|
1070
|
-
});
|
|
1071
|
-
return validateEventsToSubscribe3(
|
|
1072
|
-
eventNamesWithPrefix
|
|
1073
|
-
);
|
|
1074
|
-
}
|
|
1075
|
-
/** @internal */
|
|
1076
|
-
_finalize() {
|
|
1077
|
-
this._deviceList.clear();
|
|
1078
|
-
super._finalize();
|
|
1079
|
-
}
|
|
1080
|
-
/** @internal */
|
|
1081
|
-
async hangup(id) {
|
|
1082
|
-
this._deviceList.forEach((device) => {
|
|
1083
|
-
device.leave();
|
|
1084
|
-
});
|
|
1085
|
-
return super.hangup(id);
|
|
1086
|
-
}
|
|
1087
|
-
join() {
|
|
1088
|
-
return super.invite();
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* @deprecated Use {@link getLayouts} instead. `getLayoutList` will
|
|
1092
|
-
* be removed in v3.0.0
|
|
1093
|
-
*/
|
|
1094
|
-
getLayoutList() {
|
|
1095
|
-
return this.getLayouts();
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* @deprecated Use {@link getMembers} instead. `getMemberList` will
|
|
1099
|
-
* be removed in v3.0.0
|
|
1100
|
-
*/
|
|
1101
|
-
getMemberList() {
|
|
1102
|
-
return this.getMembers();
|
|
1103
|
-
}
|
|
1104
|
-
/** @deprecated Use {@link startScreenShare} instead. */
|
|
1105
|
-
async createScreenShareObject(opts = {}) {
|
|
1106
|
-
return this.startScreenShare(opts);
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Allow to add a camera to the room.
|
|
1110
|
-
*/
|
|
1111
|
-
addCamera(opts = {}) {
|
|
1112
|
-
const _a = opts, { autoJoin = true } = _a, video = __objRest(_a, ["autoJoin"]);
|
|
1113
|
-
return this.addDevice({
|
|
1114
|
-
autoJoin,
|
|
1115
|
-
video
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Allow to add a microphone to the room.
|
|
1120
|
-
*/
|
|
1121
|
-
addMicrophone(opts = {}) {
|
|
1122
|
-
const _a = opts, { autoJoin = true } = _a, audio = __objRest(_a, ["autoJoin"]);
|
|
1123
|
-
return this.addDevice({
|
|
1124
|
-
autoJoin,
|
|
1125
|
-
audio
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Allow to add additional devices to the room like cameras or microphones.
|
|
1130
|
-
*/
|
|
1131
|
-
async addDevice(opts = {}) {
|
|
1132
|
-
return new Promise(async (resolve, reject) => {
|
|
1133
|
-
var _a;
|
|
1134
|
-
const { autoJoin = true, audio = false, video = false } = opts;
|
|
1135
|
-
if (!audio && !video) {
|
|
1136
|
-
throw new TypeError(
|
|
1137
|
-
"At least one of `audio` or `video` must be requested."
|
|
1138
|
-
);
|
|
1139
|
-
}
|
|
1140
|
-
const options = __spreadProps(__spreadValues({}, this.options), {
|
|
1141
|
-
localStream: void 0,
|
|
1142
|
-
remoteStream: void 0,
|
|
1143
|
-
audio,
|
|
1144
|
-
video,
|
|
1145
|
-
additionalDevice: true,
|
|
1146
|
-
recoverCall: false,
|
|
1147
|
-
userVariables: __spreadProps(__spreadValues({}, ((_a = this.options) == null ? void 0 : _a.userVariables) || {}), {
|
|
1148
|
-
memberCallId: this.callId,
|
|
1149
|
-
memberId: this.memberId
|
|
1150
|
-
})
|
|
1151
|
-
});
|
|
1152
|
-
const roomDevice = connect3({
|
|
1153
|
-
store: this.store,
|
|
1154
|
-
Component: RoomSessionDeviceAPI
|
|
1155
|
-
})(options);
|
|
1156
|
-
roomDevice.once("destroy", () => {
|
|
1157
|
-
roomDevice.emit("room.left");
|
|
1158
|
-
this._deviceList.delete(roomDevice);
|
|
1159
|
-
});
|
|
1160
|
-
try {
|
|
1161
|
-
roomDevice.runWorker("childMemberJoinedWorker", {
|
|
1162
|
-
worker: childMemberJoinedWorker,
|
|
1163
|
-
onDone: () => resolve(roomDevice),
|
|
1164
|
-
onFail: reject,
|
|
1165
|
-
initialState: {
|
|
1166
|
-
parentId: this.memberId
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
this._deviceList.add(roomDevice);
|
|
1170
|
-
if (autoJoin) {
|
|
1171
|
-
return await roomDevice.join();
|
|
1172
|
-
}
|
|
1173
|
-
return resolve(roomDevice);
|
|
1174
|
-
} catch (error) {
|
|
1175
|
-
this.logger.error("RoomDevice Error", error);
|
|
1176
|
-
reject(error);
|
|
1177
|
-
}
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
var VideoRoomSessionAPI = extendComponent3(VideoRoomSessionConnection, {
|
|
1182
|
-
audioMute: Rooms6.audioMuteMember,
|
|
1183
|
-
audioUnmute: Rooms6.audioUnmuteMember,
|
|
1184
|
-
videoMute: Rooms6.videoMuteMember,
|
|
1185
|
-
videoUnmute: Rooms6.videoUnmuteMember,
|
|
1186
|
-
deaf: Rooms6.deafMember,
|
|
1187
|
-
undeaf: Rooms6.undeafMember,
|
|
1188
|
-
setInputVolume: Rooms6.setInputVolumeMember,
|
|
1189
|
-
setOutputVolume: Rooms6.setOutputVolumeMember,
|
|
1190
|
-
setMicrophoneVolume: Rooms6.setInputVolumeMember,
|
|
1191
|
-
setSpeakerVolume: Rooms6.setOutputVolumeMember,
|
|
1192
|
-
setInputSensitivity: Rooms6.setInputSensitivityMember,
|
|
1193
|
-
removeMember: Rooms6.removeMember,
|
|
1194
|
-
removeAllMembers: Rooms6.removeAllMembers,
|
|
1195
|
-
getMembers: Rooms6.getMembers,
|
|
1196
|
-
getLayouts: Rooms6.getLayouts,
|
|
1197
|
-
setLayout: Rooms6.setLayout,
|
|
1198
|
-
setPositions: Rooms6.setPositions,
|
|
1199
|
-
setMemberPosition: Rooms6.setMemberPosition,
|
|
1200
|
-
hideVideoMuted: Rooms6.hideVideoMuted,
|
|
1201
|
-
showVideoMuted: Rooms6.showVideoMuted,
|
|
1202
|
-
getRecordings: Rooms6.getRecordings,
|
|
1203
|
-
startRecording: Rooms6.startRecording,
|
|
1204
|
-
getPlaybacks: Rooms6.getPlaybacks,
|
|
1205
|
-
play: Rooms6.play,
|
|
1206
|
-
setHideVideoMuted: Rooms6.setHideVideoMuted,
|
|
1207
|
-
getMeta: Rooms6.getMeta,
|
|
1208
|
-
setMeta: Rooms6.setMeta,
|
|
1209
|
-
updateMeta: Rooms6.updateMeta,
|
|
1210
|
-
deleteMeta: Rooms6.deleteMeta,
|
|
1211
|
-
getMemberMeta: Rooms6.getMemberMeta,
|
|
1212
|
-
setMemberMeta: Rooms6.setMemberMeta,
|
|
1213
|
-
updateMemberMeta: Rooms6.updateMemberMeta,
|
|
1214
|
-
deleteMemberMeta: Rooms6.deleteMemberMeta,
|
|
1215
|
-
promote: Rooms6.promote,
|
|
1216
|
-
demote: Rooms6.demote,
|
|
1217
|
-
getStreams: Rooms6.getStreams,
|
|
1218
|
-
startStream: Rooms6.startStream,
|
|
1219
|
-
lock: Rooms6.lock,
|
|
1220
|
-
unlock: Rooms6.unlock,
|
|
1221
|
-
setRaisedHand: Rooms6.setRaisedHand,
|
|
1222
|
-
setPrioritizeHandraise: Rooms6.setPrioritizeHandraise
|
|
1223
|
-
});
|
|
1224
|
-
var isVideoRoomSession = (room) => {
|
|
1225
|
-
return room instanceof VideoRoomSessionConnection;
|
|
1226
|
-
};
|
|
1227
|
-
var createVideoRoomSessionObject = (params) => {
|
|
1228
|
-
const room = connect3({
|
|
1229
|
-
store: params.store,
|
|
1230
|
-
customSagas: params.customSagas,
|
|
1231
|
-
Component: VideoRoomSessionAPI
|
|
1232
|
-
})(params);
|
|
1233
|
-
return room;
|
|
1234
|
-
};
|
|
1235
|
-
|
|
1236
|
-
// src/fabric/FabricRoomSession.ts
|
|
1237
|
-
import {
|
|
1238
|
-
connect as connect5,
|
|
1239
|
-
toSnakeCaseKeys
|
|
1240
|
-
} from "@signalwire/core";
|
|
1241
|
-
|
|
1242
|
-
// src/utils/storage.ts
|
|
1243
|
-
import jwtDecode from "jwt-decode";
|
|
1244
|
-
import { getLogger as getLogger11 } from "@signalwire/core";
|
|
1245
|
-
var getStorage = () => {
|
|
1246
|
-
if (window && window.sessionStorage) {
|
|
1247
|
-
return window.sessionStorage;
|
|
1248
|
-
}
|
|
1249
|
-
return void 0;
|
|
1250
|
-
};
|
|
1251
|
-
var sessionStorageManager = (token) => {
|
|
1252
|
-
var _a;
|
|
1253
|
-
let roomName = "";
|
|
1254
|
-
try {
|
|
1255
|
-
const jwtPayload = jwtDecode(token);
|
|
1256
|
-
roomName = (_a = jwtPayload == null ? void 0 : jwtPayload.r) != null ? _a : "";
|
|
1257
|
-
} catch (e) {
|
|
1258
|
-
try {
|
|
1259
|
-
const jwtPayload = jwtDecode(token, { header: true });
|
|
1260
|
-
roomName = jwtPayload.typ || "";
|
|
1261
|
-
} catch (e2) {
|
|
1262
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1263
|
-
getLogger11().error("[sessionStorageManager] error decoding JWT", token);
|
|
1264
|
-
}
|
|
1265
|
-
roomName = "";
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
const valid = Boolean(roomName);
|
|
1269
|
-
return {
|
|
1270
|
-
authStateKey: valid && `as-${roomName}`,
|
|
1271
|
-
protocolKey: valid && `pt-${roomName}`,
|
|
1272
|
-
callIdKey: valid && `ci-${roomName}`
|
|
1273
|
-
};
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
|
-
// src/fabric/utils/constants.ts
|
|
1277
|
-
var PREVIOUS_CALLID_STORAGE_KEY = "ci-SAT";
|
|
1278
|
-
var DEFAULT_API_REQUEST_RETRIES = 10;
|
|
1279
|
-
var DEFAULT_API_REQUEST_RETRIES_DELAY = 300;
|
|
1280
|
-
var DEFAULT_API_REQUEST_RETRIES_DELAY_INCREMENT = 100;
|
|
1281
|
-
|
|
1282
|
-
// src/fabric/workers/wsClientWorker.ts
|
|
1283
|
-
import {
|
|
1284
|
-
getLogger as getLogger12,
|
|
1285
|
-
sagaEffects as sagaEffects6
|
|
1286
|
-
} from "@signalwire/core";
|
|
1287
|
-
var wsClientWorker = function* (options) {
|
|
1288
|
-
getLogger12().debug("wsClientWorker started");
|
|
1289
|
-
const { channels, initialState, instance: client } = options;
|
|
1290
|
-
const { swEventChannel } = channels;
|
|
1291
|
-
const { handleIncomingInvite } = initialState;
|
|
1292
|
-
function* fireHoseWorker(action) {
|
|
1293
|
-
client.emit(action.type, action.payload);
|
|
1294
|
-
}
|
|
1295
|
-
function* vertoInviteWorker(action) {
|
|
1296
|
-
handleIncomingInvite(action.payload.params);
|
|
1297
|
-
}
|
|
1298
|
-
const isVertoInvite2 = (action) => {
|
|
1299
|
-
if (action.type === "webrtc.message") {
|
|
1300
|
-
return action.payload.method === "verto.invite";
|
|
1301
|
-
}
|
|
1302
|
-
return false;
|
|
1303
|
-
};
|
|
1304
|
-
try {
|
|
1305
|
-
while (true) {
|
|
1306
|
-
const action = yield sagaEffects6.take(
|
|
1307
|
-
swEventChannel,
|
|
1308
|
-
() => true
|
|
1309
|
-
);
|
|
1310
|
-
yield sagaEffects6.fork(fireHoseWorker, action);
|
|
1311
|
-
if (isVertoInvite2(action)) {
|
|
1312
|
-
getLogger12().debug("Receiving a call over WebSocket", action);
|
|
1313
|
-
yield sagaEffects6.fork(
|
|
1314
|
-
vertoInviteWorker,
|
|
1315
|
-
action
|
|
1316
|
-
);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
} finally {
|
|
1320
|
-
getLogger12().trace("wsClientWorker ended");
|
|
1321
|
-
}
|
|
1322
|
-
};
|
|
1323
|
-
|
|
1324
|
-
// src/fabric/workers/fabricWorker.ts
|
|
1325
|
-
import {
|
|
1326
|
-
getLogger as getLogger17,
|
|
1327
|
-
sagaEffects as sagaEffects9
|
|
1328
|
-
} from "@signalwire/core";
|
|
1329
|
-
|
|
1330
|
-
// src/fabric/FabricRoomSessionMember.ts
|
|
1331
|
-
import {
|
|
1332
|
-
connect as connect4,
|
|
1333
|
-
BaseComponent
|
|
1334
|
-
} from "@signalwire/core";
|
|
1335
|
-
var FabricRoomSessionMemberAPI = class extends BaseComponent {
|
|
1336
|
-
constructor(options) {
|
|
1337
|
-
super(options);
|
|
1338
|
-
__publicField(this, "_payload");
|
|
1339
|
-
this._payload = options.payload;
|
|
1340
|
-
}
|
|
1341
|
-
get id() {
|
|
1342
|
-
return this._payload.member.member_id;
|
|
1343
|
-
}
|
|
1344
|
-
get callId() {
|
|
1345
|
-
return this._payload.member.call_id;
|
|
1346
|
-
}
|
|
1347
|
-
get nodeId() {
|
|
1348
|
-
return this._payload.member.node_id;
|
|
1349
|
-
}
|
|
1350
|
-
get memberId() {
|
|
1351
|
-
return this.id;
|
|
1352
|
-
}
|
|
1353
|
-
get roomSessionId() {
|
|
1354
|
-
return this._payload.room_session_id;
|
|
1355
|
-
}
|
|
1356
|
-
get roomId() {
|
|
1357
|
-
return this._payload.room_id;
|
|
1358
|
-
}
|
|
1359
|
-
get parentId() {
|
|
1360
|
-
return this._payload.member.parent_id;
|
|
1361
|
-
}
|
|
1362
|
-
get subscriberId() {
|
|
1363
|
-
return this._payload.member.subscriber_id;
|
|
1364
|
-
}
|
|
1365
|
-
get addressId() {
|
|
1366
|
-
return this._payload.member.address_id;
|
|
1367
|
-
}
|
|
1368
|
-
get name() {
|
|
1369
|
-
return this._payload.member.name;
|
|
1370
|
-
}
|
|
1371
|
-
get type() {
|
|
1372
|
-
return this._payload.member.type;
|
|
1373
|
-
}
|
|
1374
|
-
get requestedPosition() {
|
|
1375
|
-
return this._payload.member.requested_position;
|
|
1376
|
-
}
|
|
1377
|
-
get currentPosition() {
|
|
1378
|
-
return this._payload.member.current_position;
|
|
1379
|
-
}
|
|
1380
|
-
get meta() {
|
|
1381
|
-
return this._payload.member.meta;
|
|
1382
|
-
}
|
|
1383
|
-
get handraised() {
|
|
1384
|
-
return this._payload.member.handraised;
|
|
1385
|
-
}
|
|
1386
|
-
get talking() {
|
|
1387
|
-
return this._payload.member.talking;
|
|
1388
|
-
}
|
|
1389
|
-
get audioMuted() {
|
|
1390
|
-
return this._payload.member.audio_muted;
|
|
1391
|
-
}
|
|
1392
|
-
get videoMuted() {
|
|
1393
|
-
return this._payload.member.video_muted;
|
|
1394
|
-
}
|
|
1395
|
-
get deaf() {
|
|
1396
|
-
return this._payload.member.deaf;
|
|
1397
|
-
}
|
|
1398
|
-
get visible() {
|
|
1399
|
-
return this._payload.member.visible;
|
|
1400
|
-
}
|
|
1401
|
-
get inputVolume() {
|
|
1402
|
-
return this._payload.member.input_volume;
|
|
1403
|
-
}
|
|
1404
|
-
get outputVolume() {
|
|
1405
|
-
return this._payload.member.output_volume;
|
|
1406
|
-
}
|
|
1407
|
-
get inputSensitivity() {
|
|
1408
|
-
return this._payload.member.input_sensitivity;
|
|
1409
|
-
}
|
|
1410
|
-
get echoCancellation() {
|
|
1411
|
-
return this._payload.member.echo_cancellation;
|
|
1412
|
-
}
|
|
1413
|
-
get autoGain() {
|
|
1414
|
-
return this._payload.member.auto_gain;
|
|
1415
|
-
}
|
|
1416
|
-
get noiseSuppression() {
|
|
1417
|
-
return this._payload.member.noise_suppression;
|
|
1418
|
-
}
|
|
1419
|
-
/** @internal */
|
|
1420
|
-
setPayload(payload) {
|
|
1421
|
-
const newPayload = __spreadProps(__spreadValues(__spreadValues({}, this._payload), payload), {
|
|
1422
|
-
member: __spreadValues(__spreadValues({}, this._payload.member), payload.member)
|
|
1423
|
-
});
|
|
1424
|
-
this._payload = newPayload;
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
var createFabricRoomSessionMemberObject = (params) => {
|
|
1428
|
-
const member = connect4({
|
|
1429
|
-
store: params.store,
|
|
1430
|
-
Component: FabricRoomSessionMemberAPI
|
|
1431
|
-
})(params);
|
|
1432
|
-
return member;
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
// src/fabric/workers/callSegmentWorker.ts
|
|
1436
|
-
import {
|
|
1437
|
-
getLogger as getLogger16,
|
|
1438
|
-
sagaEffects as sagaEffects8
|
|
1439
|
-
} from "@signalwire/core";
|
|
1440
|
-
|
|
1441
|
-
// src/fabric/workers/callLeftWorker.ts
|
|
1442
|
-
import { getLogger as getLogger13 } from "@signalwire/core";
|
|
1443
|
-
var callLeftWorker = function* (options) {
|
|
1444
|
-
getLogger13().trace("callLeftWorker started");
|
|
1445
|
-
const {
|
|
1446
|
-
action: { payload },
|
|
1447
|
-
instance: cfRoomSession,
|
|
1448
|
-
instanceMap
|
|
1449
|
-
} = options;
|
|
1450
|
-
const { room_session_id } = payload;
|
|
1451
|
-
instanceMap.getAll().forEach(([key, obj]) => {
|
|
1452
|
-
if (obj instanceof FabricRoomSessionMemberAPI && obj.roomSessionId === room_session_id) {
|
|
1453
|
-
instanceMap.remove(key);
|
|
1454
|
-
}
|
|
1455
|
-
});
|
|
1456
|
-
cfRoomSession.emit("call.left", payload);
|
|
1457
|
-
cfRoomSession.emit("room.left", payload);
|
|
1458
|
-
getLogger13().trace("callLeftWorker ended");
|
|
1459
|
-
};
|
|
1460
|
-
|
|
1461
|
-
// src/fabric/workers/callJoinWorker.ts
|
|
1462
|
-
import {
|
|
1463
|
-
getLogger as getLogger15,
|
|
1464
|
-
sagaEffects as sagaEffects7,
|
|
1465
|
-
MemberPosition as MemberPosition2,
|
|
1466
|
-
stripNamespacePrefix as stripNamespacePrefix6
|
|
1467
|
-
} from "@signalwire/core";
|
|
1468
|
-
|
|
1469
|
-
// src/fabric/workers/fabricMemberWorker.ts
|
|
1470
|
-
import {
|
|
1471
|
-
fromSnakeToCamelCase,
|
|
1472
|
-
getLogger as getLogger14
|
|
1473
|
-
} from "@signalwire/core";
|
|
1474
|
-
var fabricMemberWorker = function* (options) {
|
|
1475
|
-
getLogger14().trace("fabricMemberWorker started");
|
|
1476
|
-
const {
|
|
1477
|
-
instance: roomSession,
|
|
1478
|
-
action: { type, payload },
|
|
1479
|
-
instanceMap: { get, set, remove }
|
|
1480
|
-
} = options;
|
|
1481
|
-
const memberId = payload.member.member_id;
|
|
1482
|
-
let memberInstance = get(memberId);
|
|
1483
|
-
if (!memberInstance && type !== "member.talking") {
|
|
1484
|
-
memberInstance = createFabricRoomSessionMemberObject({
|
|
1485
|
-
store: roomSession.store,
|
|
1486
|
-
payload
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
if (memberInstance) {
|
|
1490
|
-
memberInstance.setPayload(payload);
|
|
1491
|
-
}
|
|
1492
|
-
set(memberId, memberInstance);
|
|
1493
|
-
if (type.startsWith("member.updated.")) {
|
|
1494
|
-
const clientType = fromSnakeToCamelCase(type);
|
|
1495
|
-
roomSession.emit(clientType, payload);
|
|
1496
|
-
}
|
|
1497
|
-
switch (type) {
|
|
1498
|
-
case "member.joined":
|
|
1499
|
-
roomSession.emit(type, payload);
|
|
1500
|
-
break;
|
|
1501
|
-
case "member.updated":
|
|
1502
|
-
roomSession.emit(type, payload);
|
|
1503
|
-
break;
|
|
1504
|
-
case "member.left":
|
|
1505
|
-
roomSession.emit(type, payload);
|
|
1506
|
-
remove(memberId);
|
|
1507
|
-
break;
|
|
1508
|
-
case "member.talking":
|
|
1509
|
-
roomSession.emit(type, payload);
|
|
1510
|
-
break;
|
|
1511
|
-
default:
|
|
1512
|
-
break;
|
|
1513
|
-
}
|
|
1514
|
-
getLogger14().trace("fabricMemberWorker ended");
|
|
1515
|
-
};
|
|
1516
|
-
|
|
1517
|
-
// src/fabric/utils/capabilitiesHelpers.ts
|
|
1518
|
-
var CapabilityOnOffState = class {
|
|
1519
|
-
constructor(_flags) {
|
|
1520
|
-
this._flags = _flags;
|
|
1521
|
-
}
|
|
1522
|
-
get on() {
|
|
1523
|
-
return this._flags.some((flag) => !flag.endsWith(".off"));
|
|
1524
|
-
}
|
|
1525
|
-
get off() {
|
|
1526
|
-
return this._flags.some((flag) => !flag.endsWith(".on"));
|
|
1527
|
-
}
|
|
1528
|
-
};
|
|
1529
|
-
var MemberCapability = class {
|
|
1530
|
-
constructor(_flags, _memberType) {
|
|
1531
|
-
this._flags = _flags;
|
|
1532
|
-
this._memberType = _memberType;
|
|
1533
|
-
__publicField(this, "_muteAudio");
|
|
1534
|
-
__publicField(this, "_muteVideo");
|
|
1535
|
-
__publicField(this, "_deaf");
|
|
1536
|
-
__publicField(this, "_raisehand");
|
|
1537
|
-
}
|
|
1538
|
-
get muteAudio() {
|
|
1539
|
-
var _a;
|
|
1540
|
-
this._muteAudio = (_a = this._muteAudio) != null ? _a : new CapabilityOnOffState(
|
|
1541
|
-
this._flags.filter(
|
|
1542
|
-
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.audio`)
|
|
1543
|
-
)
|
|
1544
|
-
);
|
|
1545
|
-
return this._muteAudio;
|
|
1546
|
-
}
|
|
1547
|
-
get muteVideo() {
|
|
1548
|
-
var _a;
|
|
1549
|
-
this._muteVideo = (_a = this._muteVideo) != null ? _a : new CapabilityOnOffState(
|
|
1550
|
-
this._flags.filter(
|
|
1551
|
-
(flag) => flag === this._memberType || flag === `${this._memberType}.mute` || flag.startsWith(`${this._memberType}.mute.video`)
|
|
1552
|
-
)
|
|
1553
|
-
);
|
|
1554
|
-
return this._muteVideo;
|
|
1555
|
-
}
|
|
1556
|
-
get microphoneVolume() {
|
|
1557
|
-
return this._flags.some(
|
|
1558
|
-
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.volume`)
|
|
1559
|
-
);
|
|
1560
|
-
}
|
|
1561
|
-
get microphoneSensitivity() {
|
|
1562
|
-
return this._flags.some(
|
|
1563
|
-
(flag) => flag === this._memberType || flag === `${this._memberType}.microphone` || flag.startsWith(`${this._memberType}.microphone.sensitivity`)
|
|
1564
|
-
);
|
|
1565
|
-
}
|
|
1566
|
-
get speakerVolume() {
|
|
1567
|
-
return this._flags.some(
|
|
1568
|
-
(flag) => flag === this._memberType || flag === `${this._memberType}.speaker` || flag.startsWith(`${this._memberType}.speaker.volume`)
|
|
1569
|
-
);
|
|
1570
|
-
}
|
|
1571
|
-
get deaf() {
|
|
1572
|
-
var _a;
|
|
1573
|
-
this._deaf = (_a = this._deaf) != null ? _a : new CapabilityOnOffState(
|
|
1574
|
-
this._flags.filter(
|
|
1575
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.deaf`)
|
|
1576
|
-
)
|
|
1577
|
-
);
|
|
1578
|
-
return this._deaf;
|
|
1579
|
-
}
|
|
1580
|
-
get raisehand() {
|
|
1581
|
-
var _a;
|
|
1582
|
-
this._raisehand = (_a = this._raisehand) != null ? _a : new CapabilityOnOffState(
|
|
1583
|
-
this._flags.filter(
|
|
1584
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.raisehand`)
|
|
1585
|
-
)
|
|
1586
|
-
);
|
|
1587
|
-
return this._raisehand;
|
|
1588
|
-
}
|
|
1589
|
-
get position() {
|
|
1590
|
-
return this._flags.some(
|
|
1591
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.position`)
|
|
1592
|
-
);
|
|
1593
|
-
}
|
|
1594
|
-
get meta() {
|
|
1595
|
-
return this._flags.some(
|
|
1596
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.meta`)
|
|
1597
|
-
);
|
|
1598
|
-
}
|
|
1599
|
-
get remove() {
|
|
1600
|
-
return this._flags.some(
|
|
1601
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.remove`)
|
|
1602
|
-
);
|
|
1603
|
-
}
|
|
1604
|
-
get audioFlags() {
|
|
1605
|
-
return this._flags.some(
|
|
1606
|
-
(flag) => flag === this._memberType || flag.startsWith(`${this._memberType}.audioflags.set`)
|
|
1607
|
-
);
|
|
1608
|
-
}
|
|
1609
|
-
};
|
|
1610
|
-
var CallCapabilities = class {
|
|
1611
|
-
constructor(_flags) {
|
|
1612
|
-
this._flags = _flags;
|
|
1613
|
-
__publicField(this, "_self");
|
|
1614
|
-
__publicField(this, "_member");
|
|
1615
|
-
__publicField(this, "_vmutedHide");
|
|
1616
|
-
__publicField(this, "_lock");
|
|
1617
|
-
}
|
|
1618
|
-
_buildMemberCapability(memberType) {
|
|
1619
|
-
return new MemberCapability(
|
|
1620
|
-
this._flags.filter((flag) => flag.startsWith(memberType)),
|
|
1621
|
-
memberType
|
|
1622
|
-
);
|
|
1623
|
-
}
|
|
1624
|
-
get self() {
|
|
1625
|
-
var _a;
|
|
1626
|
-
this._self = (_a = this._self) != null ? _a : this._buildMemberCapability("self");
|
|
1627
|
-
return this._self;
|
|
1628
|
-
}
|
|
1629
|
-
get member() {
|
|
1630
|
-
var _a;
|
|
1631
|
-
this._member = (_a = this._member) != null ? _a : this._buildMemberCapability("member");
|
|
1632
|
-
return this._member;
|
|
1633
|
-
}
|
|
1634
|
-
get end() {
|
|
1635
|
-
return this._flags.some((capability) => capability === "end");
|
|
1636
|
-
}
|
|
1637
|
-
get setLayout() {
|
|
1638
|
-
return this._flags.some((capability) => capability.startsWith("layout"));
|
|
1639
|
-
}
|
|
1640
|
-
get sendDigit() {
|
|
1641
|
-
return this._flags.some((capability) => capability.startsWith("digit"));
|
|
1642
|
-
}
|
|
1643
|
-
get vmutedHide() {
|
|
1644
|
-
var _a;
|
|
1645
|
-
this._vmutedHide = (_a = this._vmutedHide) != null ? _a : new CapabilityOnOffState(
|
|
1646
|
-
this._flags.filter((flag) => flag.startsWith("vmuted"))
|
|
1647
|
-
);
|
|
1648
|
-
return this._vmutedHide;
|
|
1649
|
-
}
|
|
1650
|
-
get lock() {
|
|
1651
|
-
var _a;
|
|
1652
|
-
this._lock = (_a = this._lock) != null ? _a : new CapabilityOnOffState(
|
|
1653
|
-
this._flags.filter((flag) => flag.startsWith("lock"))
|
|
1654
|
-
);
|
|
1655
|
-
return this._lock;
|
|
1656
|
-
}
|
|
1657
|
-
get device() {
|
|
1658
|
-
return this._flags.some((capability) => capability === "device");
|
|
1659
|
-
}
|
|
1660
|
-
get screenshare() {
|
|
1661
|
-
return this._flags.some((capability) => capability === "screenshare");
|
|
1662
|
-
}
|
|
1663
|
-
};
|
|
1664
|
-
var mapCapabilityPayload = (capabilities) => new CallCapabilities(capabilities);
|
|
1665
|
-
|
|
1666
|
-
// src/fabric/utils/eventMappers.ts
|
|
1667
|
-
var mapInternalFabricMemberToInternalVideoMemberEntity = (params) => {
|
|
1668
|
-
return __spreadProps(__spreadValues({}, params), {
|
|
1669
|
-
id: params.member_id
|
|
1670
|
-
});
|
|
1671
|
-
};
|
|
1672
|
-
var mapInternalFabricMemberToInternalVideoMemberUpdatedEntity = (params) => {
|
|
1673
|
-
return __spreadProps(__spreadValues({}, mapInternalFabricMemberToInternalVideoMemberEntity(params)), {
|
|
1674
|
-
updated: params.updated.map(
|
|
1675
|
-
(key) => key === "member_id" ? "id" : key
|
|
1676
|
-
)
|
|
1677
|
-
});
|
|
1678
|
-
};
|
|
1679
|
-
var mapCallJoinedToRoomSubscribedEventParams = (params) => {
|
|
1680
|
-
return __spreadProps(__spreadValues({}, params), {
|
|
1681
|
-
room: __spreadProps(__spreadValues({}, params.room_session), {
|
|
1682
|
-
members: params.room_session.members.map(
|
|
1683
|
-
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1684
|
-
)
|
|
1685
|
-
}),
|
|
1686
|
-
room_session: __spreadProps(__spreadValues({}, params.room_session), {
|
|
1687
|
-
members: params.room_session.members.map(
|
|
1688
|
-
mapInternalFabricMemberToInternalVideoMemberEntity
|
|
1689
|
-
)
|
|
1690
|
-
})
|
|
1691
|
-
});
|
|
1692
|
-
};
|
|
1693
|
-
var mapFabricMemberToVideoMemberJoinAndLeftEventParams = (params) => {
|
|
1694
|
-
return {
|
|
1695
|
-
room_session_id: params.room_session_id,
|
|
1696
|
-
room_id: params.room_id,
|
|
1697
|
-
member: mapInternalFabricMemberToInternalVideoMemberEntity(params.member)
|
|
1698
|
-
};
|
|
1699
|
-
};
|
|
1700
|
-
var mapFabricMemberActionToVideoMemberJoinAndLeftAction = (action) => {
|
|
1701
|
-
return {
|
|
1702
|
-
type: `video.${action.type}`,
|
|
1703
|
-
payload: mapFabricMemberToVideoMemberJoinAndLeftEventParams(action.payload)
|
|
1704
|
-
};
|
|
1705
|
-
};
|
|
1706
|
-
var mapFabricMemberEventToVideoMemberUpdatedEventParams = (params) => {
|
|
1707
|
-
return {
|
|
1708
|
-
room_session_id: params.room_session_id,
|
|
1709
|
-
room_id: params.room_id,
|
|
1710
|
-
member: mapInternalFabricMemberToInternalVideoMemberUpdatedEntity(
|
|
1711
|
-
params.member
|
|
1712
|
-
)
|
|
1713
|
-
};
|
|
1714
|
-
};
|
|
1715
|
-
var mapFabricMemberActionToVideoMemberUpdatedAction = (action) => {
|
|
1716
|
-
return {
|
|
1717
|
-
type: `video.${action.type}`,
|
|
1718
|
-
payload: mapFabricMemberEventToVideoMemberUpdatedEventParams(
|
|
1719
|
-
action.payload
|
|
1720
|
-
)
|
|
1721
|
-
};
|
|
1722
|
-
};
|
|
1723
|
-
var mapFabricLayoutActionToVideoLayoutAction = (action) => {
|
|
1724
|
-
return {
|
|
1725
|
-
type: `video.${action.type}`,
|
|
1726
|
-
payload: action.payload
|
|
1727
|
-
};
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
// src/fabric/workers/callJoinWorker.ts
|
|
1731
|
-
var callJoinWorker = function* (options) {
|
|
1732
|
-
var _a;
|
|
1733
|
-
getLogger15().trace("callJoinWorker started");
|
|
1734
|
-
const { action, instanceMap, instance: cfRoomSession } = options;
|
|
1735
|
-
const { payload } = action;
|
|
1736
|
-
const { get, set } = instanceMap;
|
|
1737
|
-
yield sagaEffects7.fork(MemberPosition2.memberPositionWorker, __spreadProps(__spreadValues({}, options), {
|
|
1738
|
-
/**
|
|
1739
|
-
* The {@link memberPositionWorker} worker understands only the Video SDK events.
|
|
1740
|
-
* So, we need to map CF SDK event to Video SDK event.
|
|
1741
|
-
* Similar to what we do in the {@link callSegmentWorker}, for member events.
|
|
1742
|
-
*/
|
|
1743
|
-
initialState: mapCallJoinedToRoomSubscribedEventParams(payload),
|
|
1744
|
-
dispatcher: function* (subType, subPayload) {
|
|
1745
|
-
const fabricType = stripNamespacePrefix6(subType, "video");
|
|
1746
|
-
const fabricPaylod = __spreadProps(__spreadValues({}, subPayload), {
|
|
1747
|
-
member: __spreadProps(__spreadValues({}, subPayload.member), {
|
|
1748
|
-
member_id: subPayload.member.id
|
|
1749
|
-
})
|
|
1750
|
-
});
|
|
1751
|
-
yield sagaEffects7.fork(fabricMemberWorker, __spreadProps(__spreadValues({}, options), {
|
|
1752
|
-
action: { type: fabricType, payload: fabricPaylod }
|
|
1753
|
-
}));
|
|
1754
|
-
}
|
|
1755
|
-
}));
|
|
1756
|
-
(_a = payload.room_session.members) == null ? void 0 : _a.forEach((member) => {
|
|
1757
|
-
let memberInstance = get(member.member_id);
|
|
1758
|
-
if (!memberInstance) {
|
|
1759
|
-
memberInstance = createFabricRoomSessionMemberObject({
|
|
1760
|
-
store: cfRoomSession.store,
|
|
1761
|
-
payload: {
|
|
1762
|
-
member,
|
|
1763
|
-
room_id: payload.room_id,
|
|
1764
|
-
room_session_id: payload.room_session_id
|
|
1765
|
-
}
|
|
1766
|
-
});
|
|
1767
|
-
} else {
|
|
1768
|
-
memberInstance.setPayload({
|
|
1769
|
-
member,
|
|
1770
|
-
room_id: payload.room_id,
|
|
1771
|
-
room_session_id: payload.room_session_id
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
|
-
set(member.member_id, memberInstance);
|
|
1775
|
-
});
|
|
1776
|
-
cfRoomSession.member = get(payload.member_id);
|
|
1777
|
-
cfRoomSession.capabilities = mapCapabilityPayload(payload.capabilities);
|
|
1778
|
-
const fabricEvent = __spreadProps(__spreadValues({}, payload), {
|
|
1779
|
-
capabilities: cfRoomSession.capabilities
|
|
1780
|
-
});
|
|
1781
|
-
cfRoomSession.emit("call.joined", fabricEvent);
|
|
1782
|
-
getLogger15().trace("callJoinWorker ended");
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
// src/fabric/workers/callSegmentWorker.ts
|
|
1786
|
-
var callSegmentWorker = function* (options) {
|
|
1787
|
-
const {
|
|
1788
|
-
action,
|
|
1789
|
-
channels: { swEventChannel },
|
|
1790
|
-
instance: cfRoomSession
|
|
1791
|
-
} = options;
|
|
1792
|
-
const segmentCallId = action.payload.call_id;
|
|
1793
|
-
const segmentRooSessionId = action.payload.room_session_id;
|
|
1794
|
-
getLogger16().debug(
|
|
1795
|
-
`callSegmentWorker started for: callId ${segmentCallId}, roomSessionId ${segmentRooSessionId}`
|
|
1796
|
-
);
|
|
1797
|
-
yield sagaEffects8.fork(callJoinWorker, __spreadProps(__spreadValues({}, options), {
|
|
1798
|
-
action
|
|
1799
|
-
}));
|
|
1800
|
-
function* worker(action2) {
|
|
1801
|
-
const { type, payload } = action2;
|
|
1802
|
-
switch (type) {
|
|
1803
|
-
case "call.joined":
|
|
1804
|
-
break;
|
|
1805
|
-
case "call.left":
|
|
1806
|
-
yield sagaEffects8.call(callLeftWorker, __spreadProps(__spreadValues({}, options), {
|
|
1807
|
-
action: action2
|
|
1808
|
-
}));
|
|
1809
|
-
return true;
|
|
1810
|
-
case "call.updated":
|
|
1811
|
-
cfRoomSession.emit(type, payload);
|
|
1812
|
-
cfRoomSession.emit("room.updated", payload);
|
|
1813
|
-
break;
|
|
1814
|
-
case "call.play":
|
|
1815
|
-
cfRoomSession.emit(type, payload);
|
|
1816
|
-
break;
|
|
1817
|
-
case "call.connect":
|
|
1818
|
-
cfRoomSession.emit(type, payload);
|
|
1819
|
-
break;
|
|
1820
|
-
case "call.room":
|
|
1821
|
-
cfRoomSession.emit(type, payload);
|
|
1822
|
-
break;
|
|
1823
|
-
/**
|
|
1824
|
-
* The Core module includes a generic worker, {@link memberPositionWorker},
|
|
1825
|
-
* which listens for member & layout events to add a "current_position" parameter
|
|
1826
|
-
* and handle member "updated" parameter.
|
|
1827
|
-
* This worker in CF SDK is initialized by the {@link callJoinWorker} worker.
|
|
1828
|
-
*
|
|
1829
|
-
* To ensure compatibility, we map these events to Video SDK events and
|
|
1830
|
-
* re-publish them on the channel so that they can be processed by the
|
|
1831
|
-
* generic worker. Note that the generic worker only dispatches "member.updated"
|
|
1832
|
-
* and "member.updated.*" events.
|
|
1833
|
-
*
|
|
1834
|
-
* Additionally, the "member.joined" event is monitored by another worker,
|
|
1835
|
-
* {@link childMemberJoinedWorker}, specifically for the screen share API.
|
|
1836
|
-
*/
|
|
1837
|
-
case "member.joined":
|
|
1838
|
-
case "member.left": {
|
|
1839
|
-
yield sagaEffects8.fork(fabricMemberWorker, __spreadProps(__spreadValues({}, options), {
|
|
1840
|
-
action: action2
|
|
1841
|
-
}));
|
|
1842
|
-
const videoAction = mapFabricMemberActionToVideoMemberJoinAndLeftAction(action2);
|
|
1843
|
-
yield sagaEffects8.put(swEventChannel, videoAction);
|
|
1844
|
-
break;
|
|
1845
|
-
}
|
|
1846
|
-
case "member.updated": {
|
|
1847
|
-
const videoAction = mapFabricMemberActionToVideoMemberUpdatedAction(action2);
|
|
1848
|
-
yield sagaEffects8.put(swEventChannel, videoAction);
|
|
1849
|
-
break;
|
|
1850
|
-
}
|
|
1851
|
-
case "layout.changed": {
|
|
1852
|
-
cfRoomSession.currentLayoutEvent = action2.payload;
|
|
1853
|
-
cfRoomSession.emit(type, payload);
|
|
1854
|
-
const videoAction = mapFabricLayoutActionToVideoLayoutAction(action2);
|
|
1855
|
-
yield sagaEffects8.put(swEventChannel, videoAction);
|
|
1856
|
-
break;
|
|
1857
|
-
}
|
|
1858
|
-
case "member.talking": {
|
|
1859
|
-
yield sagaEffects8.fork(fabricMemberWorker, __spreadProps(__spreadValues({}, options), {
|
|
1860
|
-
action: action2
|
|
1861
|
-
}));
|
|
1862
|
-
break;
|
|
1863
|
-
}
|
|
1864
|
-
default: {
|
|
1865
|
-
getLogger16().warn("Got an unknown fabric event", action2);
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
return false;
|
|
1869
|
-
}
|
|
1870
|
-
const isSegmentEvent = (action2) => {
|
|
1871
|
-
const { type, payload } = action2;
|
|
1872
|
-
const shouldWatch = type.startsWith("call.") || type.startsWith("member.") || type.startsWith("layout.");
|
|
1873
|
-
const hasSegmentCallId = "call_id" in payload && segmentCallId === payload.call_id;
|
|
1874
|
-
const hasSegmentRoomSessionId = segmentRooSessionId === payload.room_session_id;
|
|
1875
|
-
if (shouldWatch && (hasSegmentCallId || hasSegmentRoomSessionId)) {
|
|
1876
|
-
return true;
|
|
1877
|
-
}
|
|
1878
|
-
return false;
|
|
1879
|
-
};
|
|
1880
|
-
while (true) {
|
|
1881
|
-
const action2 = yield sagaEffects8.take(
|
|
1882
|
-
swEventChannel,
|
|
1883
|
-
isSegmentEvent
|
|
1884
|
-
);
|
|
1885
|
-
const task = yield sagaEffects8.fork(worker, action2);
|
|
1886
|
-
const shouldStop = yield sagaEffects8.join(task);
|
|
1887
|
-
if (shouldStop) return;
|
|
1888
|
-
}
|
|
1889
|
-
};
|
|
1890
|
-
|
|
1891
|
-
// src/fabric/workers/fabricWorker.ts
|
|
1892
|
-
var fabricWorker = function* (options) {
|
|
1893
|
-
getLogger17().trace("fabricWorker started");
|
|
1894
|
-
const {
|
|
1895
|
-
channels: { swEventChannel },
|
|
1896
|
-
instance: cfRoomSession
|
|
1897
|
-
} = options;
|
|
1898
|
-
function* worker(action) {
|
|
1899
|
-
const { type, payload } = action;
|
|
1900
|
-
switch (type) {
|
|
1901
|
-
case "call.joined": {
|
|
1902
|
-
if (!cfRoomSession.selfMember) {
|
|
1903
|
-
const memberInstance = createFabricRoomSessionMemberObject({
|
|
1904
|
-
store: cfRoomSession.store,
|
|
1905
|
-
payload: {
|
|
1906
|
-
member: action.payload.room_session.members.find(
|
|
1907
|
-
(m) => m.member_id === action.payload.member_id
|
|
1908
|
-
),
|
|
1909
|
-
room_id: action.payload.room_id,
|
|
1910
|
-
room_session_id: action.payload.room_session_id
|
|
1911
|
-
}
|
|
1912
|
-
});
|
|
1913
|
-
cfRoomSession.selfMember = memberInstance;
|
|
1914
|
-
}
|
|
1915
|
-
yield sagaEffects9.fork(callSegmentWorker, __spreadProps(__spreadValues({}, options), {
|
|
1916
|
-
instance: cfRoomSession,
|
|
1917
|
-
action
|
|
1918
|
-
}));
|
|
1919
|
-
break;
|
|
1920
|
-
}
|
|
1921
|
-
case "call.state":
|
|
1922
|
-
cfRoomSession.emit(type, payload);
|
|
1923
|
-
break;
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
let firstCallJoinedReceived = false;
|
|
1927
|
-
const isFirstCallJoinedorCallStateEvent = (action) => {
|
|
1928
|
-
if (action.type === "call.state") {
|
|
1929
|
-
return true;
|
|
1930
|
-
}
|
|
1931
|
-
if (action.type !== "call.joined") {
|
|
1932
|
-
return false;
|
|
1933
|
-
}
|
|
1934
|
-
if (!firstCallJoinedReceived) {
|
|
1935
|
-
const callId = action.payload.call_id;
|
|
1936
|
-
const originCallId = action.payload.origin_call_id;
|
|
1937
|
-
if (callId === originCallId) {
|
|
1938
|
-
firstCallJoinedReceived = true;
|
|
1939
|
-
return true;
|
|
1940
|
-
}
|
|
1941
|
-
return false;
|
|
1942
|
-
}
|
|
1943
|
-
return true;
|
|
1944
|
-
};
|
|
1945
|
-
while (true) {
|
|
1946
|
-
const action = yield sagaEffects9.take(
|
|
1947
|
-
swEventChannel,
|
|
1948
|
-
isFirstCallJoinedorCallStateEvent
|
|
1949
|
-
);
|
|
1950
|
-
yield sagaEffects9.fork(worker, action);
|
|
1951
|
-
}
|
|
1952
|
-
getLogger17().trace("fabricWorker ended");
|
|
1953
|
-
};
|
|
1954
|
-
|
|
1955
|
-
// src/fabric/utils/validators.ts
|
|
1956
|
-
import {
|
|
1957
|
-
CapabilityError
|
|
1958
|
-
} from "@signalwire/core";
|
|
1959
|
-
var isSelfMember = (params, ctx) => {
|
|
1960
|
-
return !(params == null ? void 0 : params.memberId) || params.memberId === ctx.member.id;
|
|
1961
|
-
};
|
|
1962
|
-
function validateAudioMute(params) {
|
|
1963
|
-
var _a, _b;
|
|
1964
|
-
const isSelf = isSelfMember(params, this);
|
|
1965
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.off : (_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.off;
|
|
1966
|
-
if (!capability) {
|
|
1967
|
-
throw new CapabilityError("Missing audio mute capability");
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
function validateAudioUnmute(params) {
|
|
1971
|
-
var _a, _b;
|
|
1972
|
-
const isSelf = isSelfMember(params, this);
|
|
1973
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.muteAudio.on : (_b = this.capabilities) == null ? void 0 : _b.member.muteAudio.on;
|
|
1974
|
-
if (!capability) {
|
|
1975
|
-
throw new CapabilityError("Missing audio unmute capability");
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
function validateVideoMute(params) {
|
|
1979
|
-
var _a, _b;
|
|
1980
|
-
const isSelf = isSelfMember(params, this);
|
|
1981
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.off : (_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.off;
|
|
1982
|
-
if (!capability) {
|
|
1983
|
-
throw new CapabilityError("Missing video mute capability");
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
function validateVideoUnmute(params) {
|
|
1987
|
-
var _a, _b;
|
|
1988
|
-
const isSelf = isSelfMember(params, this);
|
|
1989
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.muteVideo.on : (_b = this.capabilities) == null ? void 0 : _b.member.muteVideo.on;
|
|
1990
|
-
if (!capability) {
|
|
1991
|
-
throw new CapabilityError("Missing video unmute capability");
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
function validateDeaf(params) {
|
|
1995
|
-
var _a, _b;
|
|
1996
|
-
const isSelf = isSelfMember(params, this);
|
|
1997
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.deaf.on : (_b = this.capabilities) == null ? void 0 : _b.member.deaf.on;
|
|
1998
|
-
if (!capability) {
|
|
1999
|
-
throw new CapabilityError("Missing deaf capability");
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
function validateUndeaf(params) {
|
|
2003
|
-
var _a, _b;
|
|
2004
|
-
const isSelf = isSelfMember(params, this);
|
|
2005
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.deaf.off : (_b = this.capabilities) == null ? void 0 : _b.member.deaf.off;
|
|
2006
|
-
if (!capability) {
|
|
2007
|
-
throw new CapabilityError("Missing undeaf capability");
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
function validateRemoveMember(params) {
|
|
2011
|
-
var _a;
|
|
2012
|
-
if (!(params == null ? void 0 : params.memberId)) {
|
|
2013
|
-
throw new TypeError('Invalid or missing "memberId" argument');
|
|
2014
|
-
}
|
|
2015
|
-
const capability = (_a = this.capabilities) == null ? void 0 : _a.member.remove;
|
|
2016
|
-
if (!capability) {
|
|
2017
|
-
throw new CapabilityError("Missing remove member capability");
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
function validateSetRaiseHand(params) {
|
|
2021
|
-
var _a, _b, _c, _d;
|
|
2022
|
-
const { raised = true } = params || {};
|
|
2023
|
-
const self = isSelfMember(params, this);
|
|
2024
|
-
const raiseCap = self ? (_a = this.capabilities) == null ? void 0 : _a.self.raisehand.on : (_b = this.capabilities) == null ? void 0 : _b.member.raisehand.on;
|
|
2025
|
-
const lowerCap = self ? (_c = this.capabilities) == null ? void 0 : _c.self.raisehand.off : (_d = this.capabilities) == null ? void 0 : _d.member.raisehand.off;
|
|
2026
|
-
if (raised && !raiseCap) {
|
|
2027
|
-
throw new CapabilityError("Missing raisehand capability");
|
|
2028
|
-
}
|
|
2029
|
-
if (!raised && !lowerCap) {
|
|
2030
|
-
throw new CapabilityError("Missing lowerhand capability");
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
function validateSetLayout() {
|
|
2034
|
-
var _a;
|
|
2035
|
-
if (!((_a = this.capabilities) == null ? void 0 : _a.setLayout)) {
|
|
2036
|
-
throw new CapabilityError("Missing setLayout capability");
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
function validateSetInputVolume(params) {
|
|
2040
|
-
var _a, _b, _c, _d;
|
|
2041
|
-
const isSelf = isSelfMember(params, this);
|
|
2042
|
-
const capability = isSelf ? (_b = (_a = this.capabilities) == null ? void 0 : _a.self) == null ? void 0 : _b.microphoneVolume : (_d = (_c = this.capabilities) == null ? void 0 : _c.member) == null ? void 0 : _d.microphoneVolume;
|
|
2043
|
-
if (!capability) {
|
|
2044
|
-
throw new CapabilityError("Missing setInputVolume capability");
|
|
2045
|
-
}
|
|
2046
|
-
if (params.volume < -50 || params.volume > 50) {
|
|
2047
|
-
throw new RangeError("The volume ranges from -50 to 50");
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
function validateSetOutputVolume(params) {
|
|
2051
|
-
var _a, _b, _c, _d;
|
|
2052
|
-
const isSelf = isSelfMember(params, this);
|
|
2053
|
-
const capability = isSelf ? (_b = (_a = this.capabilities) == null ? void 0 : _a.self) == null ? void 0 : _b.speakerVolume : (_d = (_c = this.capabilities) == null ? void 0 : _c.member) == null ? void 0 : _d.speakerVolume;
|
|
2054
|
-
if (!capability) {
|
|
2055
|
-
throw new CapabilityError("Missing setOutputVolume capability");
|
|
2056
|
-
}
|
|
2057
|
-
if (params.volume < -50 || params.volume > 50) {
|
|
2058
|
-
throw new RangeError("The volume ranges from -50 to 50");
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
function validateSetInputSensitivity(params) {
|
|
2062
|
-
var _a, _b;
|
|
2063
|
-
const isSelf = isSelfMember(params, this);
|
|
2064
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.microphoneSensitivity : (_b = this.capabilities) == null ? void 0 : _b.member.microphoneSensitivity;
|
|
2065
|
-
if (!capability) {
|
|
2066
|
-
throw new CapabilityError("Missing setInputSensitivity capability");
|
|
2067
|
-
}
|
|
2068
|
-
if (params.value < 0 || params.value > 100) {
|
|
2069
|
-
throw new RangeError("The sensitivity value ranges from 0 to 100");
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
function validateSetPositions(params) {
|
|
2073
|
-
var _a, _b;
|
|
2074
|
-
if (params.positions && !Object.keys(params.positions).length) {
|
|
2075
|
-
throw new TypeError("Invalid positions specified");
|
|
2076
|
-
}
|
|
2077
|
-
const hasSelfPositions = Object.keys(params.positions).some(
|
|
2078
|
-
(p) => ["self", `${this.memberId}`].includes(p)
|
|
2079
|
-
);
|
|
2080
|
-
const capability = hasSelfPositions ? (_a = this.capabilities) == null ? void 0 : _a.self.position : (_b = this.capabilities) == null ? void 0 : _b.member.position;
|
|
2081
|
-
if (!capability) {
|
|
2082
|
-
throw new CapabilityError("Missing setPositions capability");
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
function validateLock() {
|
|
2086
|
-
var _a;
|
|
2087
|
-
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.on)) {
|
|
2088
|
-
throw new CapabilityError("Missing lock capability");
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
function validateUnlock() {
|
|
2092
|
-
var _a;
|
|
2093
|
-
if (!((_a = this.capabilities) == null ? void 0 : _a.lock.off)) {
|
|
2094
|
-
throw new CapabilityError("Missing unlock capability");
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
function validateSetAudioFlags(params) {
|
|
2098
|
-
var _a, _b;
|
|
2099
|
-
const isSelf = isSelfMember(params, this);
|
|
2100
|
-
const capability = isSelf ? (_a = this.capabilities) == null ? void 0 : _a.self.audioFlags : (_b = this.capabilities) == null ? void 0 : _b.member.audioFlags;
|
|
2101
|
-
if (!capability) {
|
|
2102
|
-
throw new CapabilityError("Missing audio flags capability");
|
|
2103
|
-
}
|
|
2104
|
-
const { echoCancellation, autoGain, noiseSuppression } = params || {};
|
|
2105
|
-
if (echoCancellation === void 0 && autoGain === void 0 && noiseSuppression === void 0) {
|
|
2106
|
-
throw new TypeError(
|
|
2107
|
-
"Invalid parameters: you must specify at least one of `echoCancellation`, `autoGain`, or `noiseSuppression`"
|
|
2108
|
-
);
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
function validateEnd() {
|
|
2112
|
-
var _a;
|
|
2113
|
-
const capability = (_a = this.capabilities) == null ? void 0 : _a.end;
|
|
2114
|
-
if (!capability) {
|
|
2115
|
-
throw new CapabilityError("Missing 'end' capability");
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
// src/fabric/utils/validationProxy.ts
|
|
2120
|
-
var validationsMap = {
|
|
2121
|
-
audioMute: validateAudioMute,
|
|
2122
|
-
audioUnmute: validateAudioUnmute,
|
|
2123
|
-
videoMute: validateVideoMute,
|
|
2124
|
-
videoUnmute: validateVideoUnmute,
|
|
2125
|
-
deaf: validateDeaf,
|
|
2126
|
-
undeaf: validateUndeaf,
|
|
2127
|
-
removeMember: validateRemoveMember,
|
|
2128
|
-
setRaisedHand: validateSetRaiseHand,
|
|
2129
|
-
setLayout: validateSetLayout,
|
|
2130
|
-
setInputVolume: validateSetInputVolume,
|
|
2131
|
-
setOutputVolume: validateSetOutputVolume,
|
|
2132
|
-
setInputSensitivity: validateSetInputSensitivity,
|
|
2133
|
-
setPositions: validateSetPositions,
|
|
2134
|
-
lock: validateLock,
|
|
2135
|
-
unlock: validateUnlock,
|
|
2136
|
-
setAudioFlags: validateSetAudioFlags,
|
|
2137
|
-
end: validateEnd
|
|
2138
|
-
};
|
|
2139
|
-
function createFabricRoomSessionValidateProxy(instance) {
|
|
2140
|
-
return new Proxy(instance, {
|
|
2141
|
-
get(target, prop, receiver) {
|
|
2142
|
-
if (typeof prop === "string" && prop in validationsMap) {
|
|
2143
|
-
const targetConn = target;
|
|
2144
|
-
const origMethod = targetConn[prop];
|
|
2145
|
-
if (typeof origMethod === "function") {
|
|
2146
|
-
return async function(...args) {
|
|
2147
|
-
const validator = validationsMap[prop];
|
|
2148
|
-
if (validator) {
|
|
2149
|
-
validator.apply(targetConn, args);
|
|
2150
|
-
}
|
|
2151
|
-
return origMethod.apply(targetConn, args);
|
|
2152
|
-
};
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
return Reflect.get(target, prop, receiver);
|
|
2156
|
-
}
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
// src/fabric/FabricRoomSession.ts
|
|
2161
|
-
var FabricRoomSessionConnection = class extends BaseRoomSessionConnection {
|
|
2162
|
-
constructor(options) {
|
|
2163
|
-
super(options);
|
|
2164
|
-
// this is "self" parameter required by the RPC, and is always "the member" on the 1st call segment
|
|
2165
|
-
__publicField(this, "_self");
|
|
2166
|
-
// this is "the member" on the last/active call segment
|
|
2167
|
-
__publicField(this, "_member");
|
|
2168
|
-
__publicField(this, "_currentLayoutEvent");
|
|
2169
|
-
//describes what are methods are allow for the user in a call segment
|
|
2170
|
-
__publicField(this, "_capabilities");
|
|
2171
|
-
this.initWorker();
|
|
2172
|
-
}
|
|
2173
|
-
get memberId() {
|
|
2174
|
-
var _a;
|
|
2175
|
-
return (_a = this._member) == null ? void 0 : _a.memberId;
|
|
2176
|
-
}
|
|
2177
|
-
dialogParams(rtcPeerId) {
|
|
2178
|
-
const params = super.dialogParams(rtcPeerId);
|
|
2179
|
-
params.dialogParams.attach = this.options.attach || this.resuming;
|
|
2180
|
-
params.dialogParams.reattaching = this.options.attach || this.resuming;
|
|
2181
|
-
return params;
|
|
2182
|
-
}
|
|
2183
|
-
set currentLayoutEvent(event) {
|
|
2184
|
-
this._currentLayoutEvent = event;
|
|
2185
|
-
}
|
|
2186
|
-
get currentLayoutEvent() {
|
|
2187
|
-
return this._currentLayoutEvent;
|
|
2188
|
-
}
|
|
2189
|
-
get currentLayout() {
|
|
2190
|
-
var _a;
|
|
2191
|
-
return (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout;
|
|
2192
|
-
}
|
|
2193
|
-
get currentPosition() {
|
|
2194
|
-
var _a, _b;
|
|
2195
|
-
return (_b = (_a = this._currentLayoutEvent) == null ? void 0 : _a.layout.layers.find(
|
|
2196
|
-
(layer) => layer.member_id === this.memberId
|
|
2197
|
-
)) == null ? void 0 : _b.position;
|
|
2198
|
-
}
|
|
2199
|
-
get capabilities() {
|
|
2200
|
-
return this._capabilities;
|
|
2201
|
-
}
|
|
2202
|
-
set capabilities(capabilities) {
|
|
2203
|
-
this._capabilities = capabilities;
|
|
2204
|
-
}
|
|
2205
|
-
get selfMember() {
|
|
2206
|
-
return this._self;
|
|
2207
|
-
}
|
|
2208
|
-
set selfMember(member) {
|
|
2209
|
-
this._self = member;
|
|
2210
|
-
}
|
|
2211
|
-
set member(member) {
|
|
2212
|
-
this._member = member;
|
|
2213
|
-
}
|
|
2214
|
-
get member() {
|
|
2215
|
-
return this._member;
|
|
2216
|
-
}
|
|
2217
|
-
initWorker() {
|
|
2218
|
-
this.runWorker("fabricWorker", {
|
|
2219
|
-
worker: fabricWorker
|
|
2220
|
-
});
|
|
2221
|
-
this.runWorker("makeAudioElement", {
|
|
2222
|
-
worker: makeAudioElementSaga({
|
|
2223
|
-
speakerId: this.options.speakerId
|
|
2224
|
-
})
|
|
2225
|
-
});
|
|
2226
|
-
}
|
|
2227
|
-
async join() {
|
|
2228
|
-
var _a, _b;
|
|
2229
|
-
if (this.options.attach) {
|
|
2230
|
-
this.options.prevCallId = (_b = (_a = getStorage()) == null ? void 0 : _a.getItem(PREVIOUS_CALLID_STORAGE_KEY)) != null ? _b : void 0;
|
|
2231
|
-
this.logger.debug(
|
|
2232
|
-
`Tying to reattach to previuos call? ${!!this.options.prevCallId} - prevCallId: ${this.options.prevCallId}`
|
|
2233
|
-
);
|
|
2234
|
-
}
|
|
2235
|
-
return super.invite();
|
|
2236
|
-
}
|
|
2237
|
-
executeAction(params, options = {}) {
|
|
2238
|
-
var _a, _b, _c;
|
|
2239
|
-
const { method, channel, memberId, extraParams = {} } = params;
|
|
2240
|
-
const targetMember = !memberId || memberId === "all" ? this.member : this.instanceMap.get(memberId);
|
|
2241
|
-
if (!targetMember) {
|
|
2242
|
-
throw new Error(
|
|
2243
|
-
memberId && memberId !== "all" ? `Member ${memberId} not found` : "No target member available"
|
|
2244
|
-
);
|
|
2245
|
-
}
|
|
2246
|
-
return this.execute(
|
|
2247
|
-
{
|
|
2248
|
-
method,
|
|
2249
|
-
params: __spreadValues(__spreadProps(__spreadValues({}, channel && { channels: [channel] }), {
|
|
2250
|
-
self: {
|
|
2251
|
-
member_id: (_a = this.selfMember) == null ? void 0 : _a.id,
|
|
2252
|
-
call_id: (_b = this.selfMember) == null ? void 0 : _b.callId,
|
|
2253
|
-
node_id: (_c = this.selfMember) == null ? void 0 : _c.nodeId
|
|
2254
|
-
},
|
|
2255
|
-
target: {
|
|
2256
|
-
member_id: memberId === "all" ? memberId : targetMember.id,
|
|
2257
|
-
call_id: targetMember.callId,
|
|
2258
|
-
node_id: targetMember.nodeId
|
|
2259
|
-
}
|
|
2260
|
-
}), extraParams)
|
|
2261
|
-
},
|
|
2262
|
-
options
|
|
2263
|
-
);
|
|
2264
|
-
}
|
|
2265
|
-
/** @internal */
|
|
2266
|
-
async resume() {
|
|
2267
|
-
var _a;
|
|
2268
|
-
this.logger.warn(`[resume] Call ${this.id}`);
|
|
2269
|
-
if ((_a = this.peer) == null ? void 0 : _a.instance) {
|
|
2270
|
-
const { connectionState } = this.peer.instance;
|
|
2271
|
-
this.logger.debug(
|
|
2272
|
-
`[resume] connectionState for ${this.id} is '${connectionState}'`
|
|
2273
|
-
);
|
|
2274
|
-
if (["closed", "failed", "disconnected"].includes(connectionState)) {
|
|
2275
|
-
this.resuming = !this.selfMember;
|
|
2276
|
-
this.peer.restartIce();
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
async start() {
|
|
2281
|
-
return new Promise(async (resolve, reject) => {
|
|
2282
|
-
try {
|
|
2283
|
-
this.once("room.subscribed", (params) => {
|
|
2284
|
-
var _a;
|
|
2285
|
-
(_a = getStorage()) == null ? void 0 : _a.setItem(PREVIOUS_CALLID_STORAGE_KEY, params.call_id);
|
|
2286
|
-
resolve();
|
|
2287
|
-
});
|
|
2288
|
-
this.once("destroy", () => {
|
|
2289
|
-
var _a;
|
|
2290
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(PREVIOUS_CALLID_STORAGE_KEY);
|
|
2291
|
-
});
|
|
2292
|
-
await this.join();
|
|
2293
|
-
} catch (error) {
|
|
2294
|
-
this.logger.error("WSClient call start", error);
|
|
2295
|
-
reject(error);
|
|
2296
|
-
}
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
async audioMute(params) {
|
|
2300
|
-
return this.executeAction({
|
|
2301
|
-
method: "call.mute",
|
|
2302
|
-
channel: "audio",
|
|
2303
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
async audioUnmute(params) {
|
|
2307
|
-
return this.executeAction({
|
|
2308
|
-
method: "call.unmute",
|
|
2309
|
-
channel: "audio",
|
|
2310
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
async videoMute(params) {
|
|
2314
|
-
return this.executeAction({
|
|
2315
|
-
method: "call.mute",
|
|
2316
|
-
channel: "video",
|
|
2317
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2318
|
-
});
|
|
2319
|
-
}
|
|
2320
|
-
async videoUnmute(params) {
|
|
2321
|
-
return this.executeAction({
|
|
2322
|
-
method: "call.unmute",
|
|
2323
|
-
channel: "video",
|
|
2324
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2325
|
-
});
|
|
2326
|
-
}
|
|
2327
|
-
async deaf(params) {
|
|
2328
|
-
return this.executeAction({
|
|
2329
|
-
method: "call.deaf",
|
|
2330
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
async undeaf(params) {
|
|
2334
|
-
return this.executeAction({
|
|
2335
|
-
method: "call.undeaf",
|
|
2336
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
async getLayouts() {
|
|
2340
|
-
return this.executeAction(
|
|
2341
|
-
{
|
|
2342
|
-
method: "call.layout.list"
|
|
2343
|
-
},
|
|
2344
|
-
{
|
|
2345
|
-
transformResolve: (payload) => ({
|
|
2346
|
-
layouts: payload.layouts
|
|
2347
|
-
})
|
|
2348
|
-
}
|
|
2349
|
-
);
|
|
2350
|
-
}
|
|
2351
|
-
async getMembers() {
|
|
2352
|
-
return this.executeAction(
|
|
2353
|
-
{
|
|
2354
|
-
method: "call.member.list"
|
|
2355
|
-
},
|
|
2356
|
-
{
|
|
2357
|
-
transformResolve: (payload) => ({
|
|
2358
|
-
members: payload.members
|
|
2359
|
-
})
|
|
2360
|
-
}
|
|
2361
|
-
);
|
|
2362
|
-
}
|
|
2363
|
-
async removeMember(params) {
|
|
2364
|
-
return this.executeAction({
|
|
2365
|
-
method: "call.member.remove",
|
|
2366
|
-
memberId: params.memberId
|
|
2367
|
-
});
|
|
2368
|
-
}
|
|
2369
|
-
async setRaisedHand(params) {
|
|
2370
|
-
const { raised = true, memberId } = params || {};
|
|
2371
|
-
return this.executeAction({
|
|
2372
|
-
method: raised ? "call.raisehand" : "call.lowerhand",
|
|
2373
|
-
memberId
|
|
2374
|
-
});
|
|
2375
|
-
}
|
|
2376
|
-
async setLayout(params) {
|
|
2377
|
-
const extraParams = {
|
|
2378
|
-
layout: params.name,
|
|
2379
|
-
positions: params.positions
|
|
2380
|
-
};
|
|
2381
|
-
return this.executeAction({
|
|
2382
|
-
method: "call.layout.set",
|
|
2383
|
-
extraParams
|
|
2384
|
-
});
|
|
2385
|
-
}
|
|
2386
|
-
async setInputVolume(params) {
|
|
2387
|
-
return this.executeAction({
|
|
2388
|
-
method: "call.microphone.volume.set",
|
|
2389
|
-
memberId: params.memberId,
|
|
2390
|
-
extraParams: {
|
|
2391
|
-
volume: params.volume
|
|
2392
|
-
}
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
async setOutputVolume(params) {
|
|
2396
|
-
return this.executeAction({
|
|
2397
|
-
method: "call.speaker.volume.set",
|
|
2398
|
-
memberId: params.memberId,
|
|
2399
|
-
extraParams: {
|
|
2400
|
-
volume: params.volume
|
|
2401
|
-
}
|
|
2402
|
-
});
|
|
2403
|
-
}
|
|
2404
|
-
async setInputSensitivity(params) {
|
|
2405
|
-
return this.executeAction({
|
|
2406
|
-
method: "call.microphone.sensitivity.set",
|
|
2407
|
-
memberId: params.memberId,
|
|
2408
|
-
extraParams: {
|
|
2409
|
-
sensitivity: params.value
|
|
2410
|
-
}
|
|
2411
|
-
});
|
|
2412
|
-
}
|
|
2413
|
-
async setPositions(params) {
|
|
2414
|
-
var _a, _b, _c;
|
|
2415
|
-
const targets = [];
|
|
2416
|
-
Object.entries(params.positions).forEach(([key, value]) => {
|
|
2417
|
-
const targetMember = key === "self" ? this.member : this.instanceMap.get(key);
|
|
2418
|
-
if (targetMember) {
|
|
2419
|
-
targets.push({
|
|
2420
|
-
target: {
|
|
2421
|
-
member_id: targetMember.id,
|
|
2422
|
-
call_id: targetMember.callId,
|
|
2423
|
-
node_id: targetMember.nodeId
|
|
2424
|
-
},
|
|
2425
|
-
position: value
|
|
2426
|
-
});
|
|
2427
|
-
}
|
|
2428
|
-
});
|
|
2429
|
-
if (!targets.length) {
|
|
2430
|
-
throw new Error("Invalid targets");
|
|
2431
|
-
}
|
|
2432
|
-
return this.execute({
|
|
2433
|
-
method: "call.member.position.set",
|
|
2434
|
-
params: {
|
|
2435
|
-
self: {
|
|
2436
|
-
member_id: (_a = this.selfMember) == null ? void 0 : _a.id,
|
|
2437
|
-
call_id: (_b = this.selfMember) == null ? void 0 : _b.callId,
|
|
2438
|
-
node_id: (_c = this.selfMember) == null ? void 0 : _c.nodeId
|
|
2439
|
-
},
|
|
2440
|
-
targets
|
|
2441
|
-
}
|
|
2442
|
-
});
|
|
2443
|
-
}
|
|
2444
|
-
async lock() {
|
|
2445
|
-
return this.executeAction({
|
|
2446
|
-
method: "call.lock"
|
|
2447
|
-
});
|
|
2448
|
-
}
|
|
2449
|
-
async unlock() {
|
|
2450
|
-
return this.executeAction({
|
|
2451
|
-
method: "call.unlock"
|
|
2452
|
-
});
|
|
2453
|
-
}
|
|
2454
|
-
async setAudioFlags(params) {
|
|
2455
|
-
const _a = params, { memberId } = _a, rest = __objRest(_a, ["memberId"]);
|
|
2456
|
-
return this.executeAction({
|
|
2457
|
-
method: "call.audioflags.set",
|
|
2458
|
-
memberId,
|
|
2459
|
-
extraParams: toSnakeCaseKeys(rest)
|
|
2460
|
-
});
|
|
2461
|
-
}
|
|
2462
|
-
async end(params) {
|
|
2463
|
-
return this.executeAction({
|
|
2464
|
-
method: "call.end",
|
|
2465
|
-
memberId: params == null ? void 0 : params.memberId
|
|
2466
|
-
});
|
|
2467
|
-
}
|
|
2468
|
-
};
|
|
2469
|
-
var isFabricRoomSession = (room) => {
|
|
2470
|
-
return room instanceof FabricRoomSessionConnection;
|
|
2471
|
-
};
|
|
2472
|
-
var createFabricRoomSessionObject = (params) => {
|
|
2473
|
-
const room = connect5({
|
|
2474
|
-
store: params.store,
|
|
2475
|
-
Component: FabricRoomSessionConnection
|
|
2476
|
-
})(params);
|
|
2477
|
-
return createFabricRoomSessionValidateProxy(room);
|
|
2478
|
-
};
|
|
2479
|
-
|
|
2480
|
-
// src/VideoOverlays.ts
|
|
2481
|
-
var UserOverlay = class {
|
|
2482
|
-
constructor(options) {
|
|
2483
|
-
__publicField(this, "id");
|
|
2484
|
-
__publicField(this, "_domElement");
|
|
2485
|
-
__publicField(this, "_status");
|
|
2486
|
-
this.id = options.id;
|
|
2487
|
-
this._status = "hidden";
|
|
2488
|
-
}
|
|
2489
|
-
get userId() {
|
|
2490
|
-
return this.id.split(OVERLAY_PREFIX)[1];
|
|
2491
|
-
}
|
|
2492
|
-
get domElement() {
|
|
2493
|
-
return this._domElement;
|
|
2494
|
-
}
|
|
2495
|
-
set domElement(element) {
|
|
2496
|
-
getLogger18().debug("Setting domElement for ", this.id);
|
|
2497
|
-
this._domElement = element;
|
|
2498
|
-
}
|
|
2499
|
-
get status() {
|
|
2500
|
-
return this._status;
|
|
2501
|
-
}
|
|
2502
|
-
set status(status) {
|
|
2503
|
-
this._status = status;
|
|
2504
|
-
}
|
|
2505
|
-
hide() {
|
|
2506
|
-
if (!this.domElement) {
|
|
2507
|
-
return getLogger18().warn("Missing overlay to hide");
|
|
2508
|
-
}
|
|
2509
|
-
this.domElement.style.opacity = "0";
|
|
2510
|
-
this.status = "hidden";
|
|
2511
|
-
}
|
|
2512
|
-
show() {
|
|
2513
|
-
if (!this.domElement) {
|
|
2514
|
-
return getLogger18().warn("Missing overlay to show");
|
|
2515
|
-
}
|
|
2516
|
-
this.domElement.style.opacity = "1";
|
|
2517
|
-
this.status = "visible";
|
|
2518
|
-
}
|
|
2519
|
-
};
|
|
2520
|
-
var LocalVideoOverlay = class extends UserOverlay {
|
|
2521
|
-
constructor(options) {
|
|
2522
|
-
super(options);
|
|
2523
|
-
__publicField(this, "_mirrored");
|
|
2524
|
-
__publicField(this, "_room");
|
|
2525
|
-
this._mirrored = options.mirrorLocalVideoOverlay;
|
|
2526
|
-
this._room = options.room;
|
|
2527
|
-
this.fabricMemberVideoMutedHandler = this.fabricMemberVideoMutedHandler.bind(this);
|
|
2528
|
-
this.videoMemberVideoMutedHandler = this.videoMemberVideoMutedHandler.bind(this);
|
|
2529
|
-
this.attachListeners();
|
|
2530
|
-
}
|
|
2531
|
-
get userId() {
|
|
2532
|
-
return this.id.split(SDK_PREFIX)[1];
|
|
2533
|
-
}
|
|
2534
|
-
get mirrored() {
|
|
2535
|
-
return this._mirrored;
|
|
2536
|
-
}
|
|
2537
|
-
attachListeners() {
|
|
2538
|
-
if (isFabricRoomSession(this._room)) {
|
|
2539
|
-
this._room.on(
|
|
2540
|
-
"member.updated.videoMuted",
|
|
2541
|
-
this.fabricMemberVideoMutedHandler
|
|
2542
|
-
);
|
|
2543
|
-
} else if (isVideoRoomSession(this._room)) {
|
|
2544
|
-
this._room.on(
|
|
2545
|
-
"member.updated.videoMuted",
|
|
2546
|
-
this.videoMemberVideoMutedHandler
|
|
2547
|
-
);
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
/** @internal */
|
|
2551
|
-
detachListeners() {
|
|
2552
|
-
if (isFabricRoomSession(this._room)) {
|
|
2553
|
-
this._room.off(
|
|
2554
|
-
"member.updated.videoMuted",
|
|
2555
|
-
this.fabricMemberVideoMutedHandler
|
|
2556
|
-
);
|
|
2557
|
-
} else if (isVideoRoomSession(this._room)) {
|
|
2558
|
-
this._room.off(
|
|
2559
|
-
"member.updated.videoMuted",
|
|
2560
|
-
this.videoMemberVideoMutedHandler
|
|
2561
|
-
);
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
memberVideoMutedHandler(memberId, videoMuted) {
|
|
2565
|
-
try {
|
|
2566
|
-
if (memberId === this._room.memberId) {
|
|
2567
|
-
videoMuted ? this.hide() : this.show();
|
|
2568
|
-
}
|
|
2569
|
-
} catch (error) {
|
|
2570
|
-
getLogger18().error("Error handling videoMuted in LocalVideoOverlay", error);
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
fabricMemberVideoMutedHandler(params) {
|
|
2574
|
-
this.memberVideoMutedHandler(
|
|
2575
|
-
params.member.member_id,
|
|
2576
|
-
params.member.video_muted
|
|
2577
|
-
);
|
|
2578
|
-
}
|
|
2579
|
-
videoMemberVideoMutedHandler(params) {
|
|
2580
|
-
this.memberVideoMutedHandler(params.member.id, params.member.video_muted);
|
|
2581
|
-
}
|
|
2582
|
-
setMediaStream(stream) {
|
|
2583
|
-
if (!this.domElement) {
|
|
2584
|
-
return getLogger18().warn("Missing local overlay to set the stream");
|
|
2585
|
-
}
|
|
2586
|
-
const localVideo = this.domElement.querySelector("video");
|
|
2587
|
-
if (localVideo) {
|
|
2588
|
-
localVideo.srcObject = stream;
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
setMirror(mirror = this._mirrored) {
|
|
2592
|
-
if (!this.domElement || !this.domElement.firstChild) {
|
|
2593
|
-
return getLogger18().warn("Missing local overlay to set the mirror");
|
|
2594
|
-
}
|
|
2595
|
-
const videoEl = this.domElement.firstChild;
|
|
2596
|
-
videoEl.style.transform = mirror ? "scale(-1, 1)" : "scale(1, 1)";
|
|
2597
|
-
videoEl.style.webkitTransform = mirror ? "scale(-1, 1)" : "scale(1, 1)";
|
|
2598
|
-
this._mirrored = mirror;
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
|
|
2602
|
-
// src/utils/videoElement.ts
|
|
2603
|
-
var buildVideo = () => {
|
|
2604
|
-
const video = document.createElement("video");
|
|
2605
|
-
video.muted = true;
|
|
2606
|
-
video.autoplay = true;
|
|
2607
|
-
video.playsInline = true;
|
|
2608
|
-
video.addEventListener("pause", () => {
|
|
2609
|
-
video.play().catch((error) => {
|
|
2610
|
-
getLogger19().error("Video Element Paused", video, error);
|
|
2611
|
-
});
|
|
2612
|
-
});
|
|
2613
|
-
return video;
|
|
2614
|
-
};
|
|
2615
|
-
var waitForVideoReady = ({ element }) => {
|
|
2616
|
-
return new Promise((resolve) => {
|
|
2617
|
-
element.addEventListener("canplay", function listener() {
|
|
2618
|
-
element.removeEventListener("canplay", listener);
|
|
2619
|
-
resolve();
|
|
2620
|
-
});
|
|
2621
|
-
element.addEventListener("resize", function listener() {
|
|
2622
|
-
element.removeEventListener("resize", listener);
|
|
2623
|
-
resolve();
|
|
2624
|
-
});
|
|
2625
|
-
});
|
|
2626
|
-
};
|
|
2627
|
-
var _getLocationStyles = ({
|
|
2628
|
-
x,
|
|
2629
|
-
y,
|
|
2630
|
-
width,
|
|
2631
|
-
height
|
|
2632
|
-
}) => {
|
|
2633
|
-
return {
|
|
2634
|
-
top: `${y}%`,
|
|
2635
|
-
left: `${x}%`,
|
|
2636
|
-
width: `${width}%`,
|
|
2637
|
-
height: `${height}%`
|
|
2638
|
-
};
|
|
2639
|
-
};
|
|
2640
|
-
var _buildLayer = ({ location }) => {
|
|
2641
|
-
const { top, left, width, height } = _getLocationStyles(location);
|
|
2642
|
-
const layer = document.createElement("div");
|
|
2643
|
-
layer.style.position = "absolute";
|
|
2644
|
-
layer.style.overflow = "hidden";
|
|
2645
|
-
layer.style.top = top;
|
|
2646
|
-
layer.style.left = left;
|
|
2647
|
-
layer.style.width = width;
|
|
2648
|
-
layer.style.height = height;
|
|
2649
|
-
return layer;
|
|
2650
|
-
};
|
|
2651
|
-
var _updateLayer = ({
|
|
2652
|
-
location,
|
|
2653
|
-
element
|
|
2654
|
-
}) => {
|
|
2655
|
-
const { top, left, width, height } = _getLocationStyles(location);
|
|
2656
|
-
element.style.top = top;
|
|
2657
|
-
element.style.left = left;
|
|
2658
|
-
element.style.width = width;
|
|
2659
|
-
element.style.height = height;
|
|
2660
|
-
return element;
|
|
2661
|
-
};
|
|
2662
|
-
var makeLayoutChangedHandler = (params) => {
|
|
2663
|
-
const {
|
|
2664
|
-
applyLocalVideoOverlay,
|
|
2665
|
-
applyMemberOverlay,
|
|
2666
|
-
overlayMap,
|
|
2667
|
-
localVideoOverlay,
|
|
2668
|
-
mirrorLocalVideoOverlay,
|
|
2669
|
-
rootElement
|
|
2670
|
-
} = params;
|
|
2671
|
-
return async (params2) => {
|
|
2672
|
-
getLogger19().debug("Process layout.changed");
|
|
2673
|
-
try {
|
|
2674
|
-
const { layout, memberId, localStream } = params2;
|
|
2675
|
-
const { layers = [] } = layout;
|
|
2676
|
-
const mcuLayers = rootElement.querySelector(".mcuLayers");
|
|
2677
|
-
const fragment = document.createDocumentFragment();
|
|
2678
|
-
const currentOverlayIds = /* @__PURE__ */ new Set();
|
|
2679
|
-
if (applyLocalVideoOverlay) {
|
|
2680
|
-
const location = layers.find(({ member_id }) => member_id === memberId);
|
|
2681
|
-
const overlayId = localVideoOverlay.id;
|
|
2682
|
-
let myLayerEl = localVideoOverlay.domElement;
|
|
2683
|
-
currentOverlayIds.add(overlayId);
|
|
2684
|
-
if (!location) {
|
|
2685
|
-
getLogger19().warn("Local video overlay location not found", memberId);
|
|
2686
|
-
localVideoOverlay.status = "hidden";
|
|
2687
|
-
if (myLayerEl) {
|
|
2688
|
-
localVideoOverlay.hide();
|
|
2689
|
-
}
|
|
2690
|
-
} else {
|
|
2691
|
-
if (myLayerEl) {
|
|
2692
|
-
getLogger19().debug("Update local video overlay");
|
|
2693
|
-
_updateLayer({ location, element: myLayerEl });
|
|
2694
|
-
} else {
|
|
2695
|
-
getLogger19().debug("Build local video overlay");
|
|
2696
|
-
myLayerEl = _buildLayer({ location });
|
|
2697
|
-
myLayerEl.id = overlayId;
|
|
2698
|
-
const localVideo = buildVideo();
|
|
2699
|
-
localVideo.srcObject = localStream;
|
|
2700
|
-
localVideo.disablePictureInPicture = true;
|
|
2701
|
-
localVideo.style.width = "100%";
|
|
2702
|
-
localVideo.style.height = "100%";
|
|
2703
|
-
localVideo.style.pointerEvents = "none";
|
|
2704
|
-
localVideo.style.objectFit = "cover";
|
|
2705
|
-
myLayerEl.appendChild(localVideo);
|
|
2706
|
-
localVideoOverlay.domElement = myLayerEl;
|
|
2707
|
-
if (mirrorLocalVideoOverlay) {
|
|
2708
|
-
localVideoOverlay.setMirror();
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
const hasVideo = localStream.getVideoTracks().filter((t) => t.enabled && t.readyState === "live").length > 0;
|
|
2712
|
-
if (hasVideo && location.visible) {
|
|
2713
|
-
localVideoOverlay.setMediaStream(localStream);
|
|
2714
|
-
localVideoOverlay.show();
|
|
2715
|
-
} else {
|
|
2716
|
-
localVideoOverlay.hide();
|
|
2717
|
-
}
|
|
2718
|
-
fragment.appendChild(myLayerEl);
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
if (applyMemberOverlay) {
|
|
2722
|
-
layers.forEach((location) => {
|
|
2723
|
-
const memberIdInLocation = location.member_id;
|
|
2724
|
-
if (!memberIdInLocation) return;
|
|
2725
|
-
const overlayId = addOverlayPrefix(memberIdInLocation);
|
|
2726
|
-
currentOverlayIds.add(overlayId);
|
|
2727
|
-
let overlay = overlayMap.get(overlayId);
|
|
2728
|
-
if (overlay && overlay.domElement) {
|
|
2729
|
-
getLogger19().debug("Update an overlay for", memberIdInLocation);
|
|
2730
|
-
_updateLayer({ location, element: overlay.domElement });
|
|
2731
|
-
} else {
|
|
2732
|
-
getLogger19().debug("Build an overlay for", memberIdInLocation);
|
|
2733
|
-
overlay = new UserOverlay({ id: overlayId });
|
|
2734
|
-
overlayMap.set(overlayId, overlay);
|
|
2735
|
-
const newLayer = _buildLayer({ location });
|
|
2736
|
-
newLayer.id = `${overlayId}-${uuid()}`;
|
|
2737
|
-
overlay.domElement = newLayer;
|
|
2738
|
-
}
|
|
2739
|
-
if (!location.visible) {
|
|
2740
|
-
overlay.hide();
|
|
2741
|
-
} else {
|
|
2742
|
-
overlay.show();
|
|
2743
|
-
}
|
|
2744
|
-
fragment.appendChild(overlay.domElement);
|
|
2745
|
-
});
|
|
2746
|
-
}
|
|
2747
|
-
overlayMap.forEach((overlay, overlayId) => {
|
|
2748
|
-
if (!currentOverlayIds.has(overlayId)) {
|
|
2749
|
-
if (overlay.domElement && overlay.domElement.parentNode) {
|
|
2750
|
-
overlay.domElement.parentNode.removeChild(overlay.domElement);
|
|
2751
|
-
}
|
|
2752
|
-
overlayMap.delete(overlayId);
|
|
2753
|
-
}
|
|
2754
|
-
});
|
|
2755
|
-
if (mcuLayers) {
|
|
2756
|
-
mcuLayers.innerHTML = "";
|
|
2757
|
-
mcuLayers.appendChild(fragment);
|
|
2758
|
-
}
|
|
2759
|
-
} catch (error) {
|
|
2760
|
-
getLogger19().error("Layout Changed Error", error);
|
|
2761
|
-
}
|
|
2762
|
-
};
|
|
2763
|
-
};
|
|
2764
|
-
var cleanupElement = (rootElement) => {
|
|
2765
|
-
while (rootElement.firstChild) {
|
|
2766
|
-
rootElement.removeChild(rootElement.firstChild);
|
|
2767
|
-
}
|
|
2768
|
-
};
|
|
2769
|
-
var setVideoMediaTrack = ({
|
|
2770
|
-
track,
|
|
2771
|
-
element
|
|
2772
|
-
}) => {
|
|
2773
|
-
element.srcObject = new MediaStream([track]);
|
|
2774
|
-
track.addEventListener("ended", () => {
|
|
2775
|
-
element.srcObject = null;
|
|
2776
|
-
element.remove();
|
|
2777
|
-
});
|
|
2778
|
-
};
|
|
2779
|
-
var createRootElementResizeObserver = ({
|
|
2780
|
-
video,
|
|
2781
|
-
rootElement,
|
|
2782
|
-
paddingWrapper
|
|
2783
|
-
}) => {
|
|
2784
|
-
const computePaddingWrapperWidth = (width, height) => {
|
|
2785
|
-
const nativeVideoRatio = video.videoWidth / video.videoHeight;
|
|
2786
|
-
const rootElementRatio = width / height;
|
|
2787
|
-
if (nativeVideoRatio > rootElementRatio) {
|
|
2788
|
-
return "100%";
|
|
2789
|
-
} else {
|
|
2790
|
-
return `${height * nativeVideoRatio}px`;
|
|
2791
|
-
}
|
|
2792
|
-
};
|
|
2793
|
-
const update = debounce(
|
|
2794
|
-
({ width, height }) => {
|
|
2795
|
-
const maxPaddingBottom = video.videoHeight / video.videoWidth * 100;
|
|
2796
|
-
if (paddingWrapper) {
|
|
2797
|
-
const pb = height / width * 100;
|
|
2798
|
-
paddingWrapper.style.paddingBottom = `${pb > maxPaddingBottom ? maxPaddingBottom : pb}%`;
|
|
2799
|
-
paddingWrapper.style.width = computePaddingWrapperWidth(width, height);
|
|
2800
|
-
}
|
|
2801
|
-
},
|
|
2802
|
-
100
|
|
2803
|
-
);
|
|
2804
|
-
const observer = new ResizeObserver((entries) => {
|
|
2805
|
-
entries.forEach((entry) => {
|
|
2806
|
-
if (entry.contentBoxSize) {
|
|
2807
|
-
const { inlineSize, blockSize } = Array.isArray(entry.contentBoxSize) ? entry.contentBoxSize[0] : entry.contentBoxSize;
|
|
2808
|
-
update({ width: inlineSize, height: blockSize });
|
|
2809
|
-
} else if (entry.contentRect) {
|
|
2810
|
-
update({
|
|
2811
|
-
width: entry.contentRect.width,
|
|
2812
|
-
height: entry.contentRect.height
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
});
|
|
2816
|
-
});
|
|
2817
|
-
const onVideoResize = () => {
|
|
2818
|
-
const width = rootElement.clientWidth;
|
|
2819
|
-
const height = rootElement.clientHeight;
|
|
2820
|
-
update({ width, height });
|
|
2821
|
-
};
|
|
2822
|
-
return {
|
|
2823
|
-
start: () => {
|
|
2824
|
-
observer.observe(rootElement);
|
|
2825
|
-
video.addEventListener("resize", onVideoResize);
|
|
2826
|
-
},
|
|
2827
|
-
stop: () => {
|
|
2828
|
-
observer.disconnect();
|
|
2829
|
-
video.removeEventListener("resize", onVideoResize);
|
|
2830
|
-
}
|
|
2831
|
-
};
|
|
2832
|
-
};
|
|
2833
|
-
|
|
2834
|
-
// src/buildVideoElement.ts
|
|
2835
|
-
var buildVideoElement = async (params) => {
|
|
2836
|
-
var _a;
|
|
2837
|
-
try {
|
|
2838
|
-
const {
|
|
2839
|
-
room,
|
|
2840
|
-
rootElement: element,
|
|
2841
|
-
applyLocalVideoOverlay = true,
|
|
2842
|
-
applyMemberOverlay = true,
|
|
2843
|
-
mirrorLocalVideoOverlay = true
|
|
2844
|
-
} = params;
|
|
2845
|
-
let hasVideoTrack = false;
|
|
2846
|
-
const overlayMap = /* @__PURE__ */ new Map();
|
|
2847
|
-
const id = uuid2();
|
|
2848
|
-
let rootElement;
|
|
2849
|
-
if (element) {
|
|
2850
|
-
rootElement = element;
|
|
2851
|
-
} else {
|
|
2852
|
-
rootElement = document.createElement("div");
|
|
2853
|
-
rootElement.id = `rootElement-${id}`;
|
|
2854
|
-
}
|
|
2855
|
-
const overlayId = addSDKPrefix(id);
|
|
2856
|
-
const localVideoOverlay = new LocalVideoOverlay({
|
|
2857
|
-
id: overlayId,
|
|
2858
|
-
mirrorLocalVideoOverlay,
|
|
2859
|
-
room
|
|
2860
|
-
});
|
|
2861
|
-
if (applyLocalVideoOverlay) {
|
|
2862
|
-
overlayMap.set(overlayId, localVideoOverlay);
|
|
2863
|
-
}
|
|
2864
|
-
const makeLayout = makeLayoutChangedHandler({
|
|
2865
|
-
applyLocalVideoOverlay,
|
|
2866
|
-
applyMemberOverlay,
|
|
2867
|
-
overlayMap,
|
|
2868
|
-
localVideoOverlay,
|
|
2869
|
-
mirrorLocalVideoOverlay,
|
|
2870
|
-
rootElement
|
|
2871
|
-
});
|
|
2872
|
-
const processLayoutChanged = (params2) => {
|
|
2873
|
-
var _a2;
|
|
2874
|
-
const hasVideoSender = (_a2 = room.peer) == null ? void 0 : _a2.hasVideoSender;
|
|
2875
|
-
if (hasVideoSender && room.localStream) {
|
|
2876
|
-
makeLayout({
|
|
2877
|
-
layout: params2.layout,
|
|
2878
|
-
localStream: room.localStream,
|
|
2879
|
-
memberId: room.memberId
|
|
2880
|
-
});
|
|
2881
|
-
} else {
|
|
2882
|
-
getLogger20().debug(
|
|
2883
|
-
"No local video sender or local stream, hiding local video overlay",
|
|
2884
|
-
hasVideoSender,
|
|
2885
|
-
room.localStream
|
|
2886
|
-
);
|
|
2887
|
-
localVideoOverlay.hide();
|
|
2888
|
-
}
|
|
2889
|
-
};
|
|
2890
|
-
const layoutChangedHandler = (params2) => {
|
|
2891
|
-
getLogger20().debug("Received layout.changed - videoTrack", hasVideoTrack);
|
|
2892
|
-
if (hasVideoTrack) {
|
|
2893
|
-
processLayoutChanged(params2);
|
|
2894
|
-
return;
|
|
2895
|
-
}
|
|
2896
|
-
};
|
|
2897
|
-
const processVideoTrack = async (track) => {
|
|
2898
|
-
hasVideoTrack = true;
|
|
2899
|
-
await videoElementSetup({
|
|
2900
|
-
applyLocalVideoOverlay,
|
|
2901
|
-
applyMemberOverlay,
|
|
2902
|
-
rootElement,
|
|
2903
|
-
track
|
|
2904
|
-
});
|
|
2905
|
-
const roomCurrentLayoutEvent = room.currentLayoutEvent;
|
|
2906
|
-
if (roomCurrentLayoutEvent) {
|
|
2907
|
-
processLayoutChanged(roomCurrentLayoutEvent);
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
const videoTrack = (_a = room.peer) == null ? void 0 : _a.remoteVideoTrack;
|
|
2911
|
-
if (videoTrack) {
|
|
2912
|
-
await processVideoTrack(videoTrack);
|
|
2913
|
-
}
|
|
2914
|
-
const trackHandler = async function(event) {
|
|
2915
|
-
if (event.track.kind === "video") {
|
|
2916
|
-
await processVideoTrack(event.track);
|
|
2917
|
-
}
|
|
2918
|
-
};
|
|
2919
|
-
const unsubscribe = () => {
|
|
2920
|
-
cleanupElement(rootElement);
|
|
2921
|
-
overlayMap.clear();
|
|
2922
|
-
room.overlayMap = overlayMap;
|
|
2923
|
-
if (isFabricRoomSession(room)) {
|
|
2924
|
-
room.off("track", trackHandler);
|
|
2925
|
-
room.off("layout.changed", layoutChangedHandler);
|
|
2926
|
-
room.off("destroy", unsubscribe);
|
|
2927
|
-
} else if (isVideoRoomSession(room)) {
|
|
2928
|
-
room.off("track", trackHandler);
|
|
2929
|
-
room.off("layout.changed", layoutChangedHandler);
|
|
2930
|
-
room.off("destroy", unsubscribe);
|
|
2931
|
-
}
|
|
2932
|
-
localVideoOverlay.detachListeners();
|
|
2933
|
-
};
|
|
2934
|
-
if (isFabricRoomSession(room)) {
|
|
2935
|
-
room.on("track", trackHandler);
|
|
2936
|
-
room.on("layout.changed", layoutChangedHandler);
|
|
2937
|
-
room.once("destroy", unsubscribe);
|
|
2938
|
-
} else if (isVideoRoomSession(room)) {
|
|
2939
|
-
room.on("track", trackHandler);
|
|
2940
|
-
room.on("layout.changed", layoutChangedHandler);
|
|
2941
|
-
room.once("destroy", unsubscribe);
|
|
2942
|
-
}
|
|
2943
|
-
room.overlayMap = overlayMap;
|
|
2944
|
-
room.localVideoOverlay = localVideoOverlay;
|
|
2945
|
-
return { element: rootElement, overlayMap, localVideoOverlay, unsubscribe };
|
|
2946
|
-
} catch (error) {
|
|
2947
|
-
getLogger20().error("Unable to build the video element");
|
|
2948
|
-
throw error;
|
|
2949
|
-
}
|
|
2950
|
-
};
|
|
2951
|
-
var videoElementSetup = async (options) => {
|
|
2952
|
-
try {
|
|
2953
|
-
const { applyLocalVideoOverlay, applyMemberOverlay, track, rootElement } = options;
|
|
2954
|
-
const videoElement = buildVideo();
|
|
2955
|
-
setVideoMediaTrack({ element: videoElement, track });
|
|
2956
|
-
videoElement.style.width = "100%";
|
|
2957
|
-
videoElement.style.maxHeight = "100%";
|
|
2958
|
-
if (rootElement.querySelector(".mcuContent")) {
|
|
2959
|
-
getLogger20().debug("MCU Content already there");
|
|
2960
|
-
return;
|
|
2961
|
-
}
|
|
2962
|
-
const mcuWrapper = document.createElement("div");
|
|
2963
|
-
mcuWrapper.style.position = "absolute";
|
|
2964
|
-
mcuWrapper.style.top = "0";
|
|
2965
|
-
mcuWrapper.style.left = "0";
|
|
2966
|
-
mcuWrapper.style.right = "0";
|
|
2967
|
-
mcuWrapper.style.bottom = "0";
|
|
2968
|
-
mcuWrapper.appendChild(videoElement);
|
|
2969
|
-
const paddingWrapper = document.createElement("div");
|
|
2970
|
-
paddingWrapper.classList.add("paddingWrapper");
|
|
2971
|
-
paddingWrapper.style.paddingBottom = "56.25%";
|
|
2972
|
-
paddingWrapper.style.position = "relative";
|
|
2973
|
-
paddingWrapper.style.width = "100%";
|
|
2974
|
-
paddingWrapper.appendChild(mcuWrapper);
|
|
2975
|
-
let layersWrapper = null;
|
|
2976
|
-
if (applyLocalVideoOverlay || applyMemberOverlay) {
|
|
2977
|
-
layersWrapper = document.createElement("div");
|
|
2978
|
-
layersWrapper.classList.add("mcuLayers");
|
|
2979
|
-
layersWrapper.style.display = "none";
|
|
2980
|
-
paddingWrapper.appendChild(layersWrapper);
|
|
2981
|
-
}
|
|
2982
|
-
const relativeWrapper = document.createElement("div");
|
|
2983
|
-
relativeWrapper.classList.add("mcuContent");
|
|
2984
|
-
relativeWrapper.style.position = "relative";
|
|
2985
|
-
relativeWrapper.style.width = "100%";
|
|
2986
|
-
relativeWrapper.style.height = "100%";
|
|
2987
|
-
relativeWrapper.style.margin = "0 auto";
|
|
2988
|
-
relativeWrapper.style.display = "flex";
|
|
2989
|
-
relativeWrapper.style.alignItems = "center";
|
|
2990
|
-
relativeWrapper.style.justifyContent = "center";
|
|
2991
|
-
relativeWrapper.appendChild(paddingWrapper);
|
|
2992
|
-
rootElement.style.width = "100%";
|
|
2993
|
-
rootElement.style.height = "100%";
|
|
2994
|
-
rootElement.appendChild(relativeWrapper);
|
|
2995
|
-
getLogger20().debug("MCU readyState 1 >>", videoElement.readyState);
|
|
2996
|
-
if (videoElement.readyState === HTMLMediaElement.HAVE_NOTHING) {
|
|
2997
|
-
getLogger20().debug("Wait for the MCU to be ready");
|
|
2998
|
-
await waitForVideoReady({ element: videoElement });
|
|
2999
|
-
}
|
|
3000
|
-
getLogger20().debug("MCU is ready..");
|
|
3001
|
-
const rootElementResizeObserver = createRootElementResizeObserver({
|
|
3002
|
-
rootElement,
|
|
3003
|
-
video: videoElement,
|
|
3004
|
-
paddingWrapper
|
|
3005
|
-
});
|
|
3006
|
-
rootElementResizeObserver.start();
|
|
3007
|
-
track.addEventListener("ended", () => {
|
|
3008
|
-
if (rootElementResizeObserver) {
|
|
3009
|
-
rootElementResizeObserver.stop();
|
|
3010
|
-
}
|
|
3011
|
-
});
|
|
3012
|
-
if (layersWrapper) {
|
|
3013
|
-
layersWrapper.style.display = "block";
|
|
3014
|
-
}
|
|
3015
|
-
} catch (error) {
|
|
3016
|
-
getLogger20().error("Handle video track error", error);
|
|
3017
|
-
}
|
|
3018
|
-
};
|
|
3019
|
-
|
|
3020
|
-
// src/Client.ts
|
|
3021
|
-
var ClientAPI = class extends BaseClient {
|
|
3022
|
-
constructor() {
|
|
3023
|
-
super(...arguments);
|
|
3024
|
-
__publicField(this, "_videoManager");
|
|
3025
|
-
__publicField(this, "_chat");
|
|
3026
|
-
__publicField(this, "_pubSub");
|
|
3027
|
-
}
|
|
3028
|
-
get rooms() {
|
|
3029
|
-
return {
|
|
3030
|
-
makeRoomObject: (makeRoomOptions) => {
|
|
3031
|
-
const _a = makeRoomOptions, {
|
|
3032
|
-
rootElement,
|
|
3033
|
-
applyLocalVideoOverlay = true,
|
|
3034
|
-
applyMemberOverlay = true,
|
|
3035
|
-
mirrorLocalVideoOverlay = true,
|
|
3036
|
-
stopCameraWhileMuted = true,
|
|
3037
|
-
stopMicrophoneWhileMuted = true
|
|
3038
|
-
} = _a, options = __objRest(_a, [
|
|
3039
|
-
"rootElement",
|
|
3040
|
-
"applyLocalVideoOverlay",
|
|
3041
|
-
"applyMemberOverlay",
|
|
3042
|
-
"mirrorLocalVideoOverlay",
|
|
3043
|
-
"stopCameraWhileMuted",
|
|
3044
|
-
"stopMicrophoneWhileMuted"
|
|
3045
|
-
]);
|
|
3046
|
-
const customSagas = [];
|
|
3047
|
-
customSagas.push(
|
|
3048
|
-
makeAudioElementSaga({
|
|
3049
|
-
speakerId: options.speakerId
|
|
3050
|
-
})
|
|
3051
|
-
);
|
|
3052
|
-
const room = createVideoRoomSessionObject(__spreadProps(__spreadValues({}, options), {
|
|
3053
|
-
store: this.store,
|
|
3054
|
-
customSagas
|
|
3055
|
-
}));
|
|
3056
|
-
if (rootElement) {
|
|
3057
|
-
try {
|
|
3058
|
-
buildVideoElement({
|
|
3059
|
-
applyLocalVideoOverlay,
|
|
3060
|
-
applyMemberOverlay,
|
|
3061
|
-
mirrorLocalVideoOverlay,
|
|
3062
|
-
room,
|
|
3063
|
-
rootElement
|
|
3064
|
-
});
|
|
3065
|
-
} catch (error) {
|
|
3066
|
-
this.logger.error("Unable to build the video element automatically");
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
room.on("room.subscribed", (params) => {
|
|
3070
|
-
var _a2;
|
|
3071
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3072
|
-
(m) => m.id === room.memberId
|
|
3073
|
-
);
|
|
3074
|
-
if (member == null ? void 0 : member.audio_muted) {
|
|
3075
|
-
try {
|
|
3076
|
-
room.stopOutboundAudio();
|
|
3077
|
-
} catch (error) {
|
|
3078
|
-
this.logger.error("Error handling audio_muted", error);
|
|
3079
|
-
}
|
|
3080
|
-
}
|
|
3081
|
-
if (member == null ? void 0 : member.video_muted) {
|
|
3082
|
-
try {
|
|
3083
|
-
room.stopOutboundVideo();
|
|
3084
|
-
} catch (error) {
|
|
3085
|
-
this.logger.error("Error handling video_muted", error);
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
});
|
|
3089
|
-
if (stopMicrophoneWhileMuted) {
|
|
3090
|
-
room.on("member.updated.audio_muted", ({ member }) => {
|
|
3091
|
-
try {
|
|
3092
|
-
if (member.id === room.memberId && "audio_muted" in member) {
|
|
3093
|
-
member.audio_muted ? room.stopOutboundAudio() : room.restoreOutboundAudio();
|
|
3094
|
-
}
|
|
3095
|
-
} catch (error) {
|
|
3096
|
-
this.logger.error("Error handling audio_muted", error);
|
|
3097
|
-
}
|
|
3098
|
-
});
|
|
3099
|
-
}
|
|
3100
|
-
if (stopCameraWhileMuted) {
|
|
3101
|
-
room.on("member.updated.video_muted", ({ member }) => {
|
|
3102
|
-
try {
|
|
3103
|
-
if (member.id === room.memberId && "video_muted" in member) {
|
|
3104
|
-
member.video_muted ? room.stopOutboundVideo() : room.restoreOutboundVideo();
|
|
3105
|
-
}
|
|
3106
|
-
} catch (error) {
|
|
3107
|
-
this.logger.error("Error handling video_muted", error);
|
|
3108
|
-
}
|
|
3109
|
-
});
|
|
3110
|
-
}
|
|
3111
|
-
return room;
|
|
3112
|
-
}
|
|
3113
|
-
};
|
|
3114
|
-
}
|
|
3115
|
-
get chat() {
|
|
3116
|
-
if (!this._chat) {
|
|
3117
|
-
this._chat = ChatNamespace.createBaseChatObject({
|
|
3118
|
-
store: this.store
|
|
3119
|
-
});
|
|
3120
|
-
}
|
|
3121
|
-
return this._chat;
|
|
3122
|
-
}
|
|
3123
|
-
get pubSub() {
|
|
3124
|
-
if (!this._pubSub) {
|
|
3125
|
-
this._pubSub = PubSubNamespace.createBasePubSubObject({
|
|
3126
|
-
store: this.store
|
|
3127
|
-
});
|
|
3128
|
-
}
|
|
3129
|
-
return this._pubSub;
|
|
3130
|
-
}
|
|
3131
|
-
/** @internal */
|
|
3132
|
-
get videoManager() {
|
|
3133
|
-
if (!this._videoManager) {
|
|
3134
|
-
this._videoManager = createVideoManagerObject(this.options);
|
|
3135
|
-
}
|
|
3136
|
-
return this._videoManager;
|
|
3137
|
-
}
|
|
3138
|
-
/**
|
|
3139
|
-
* Reauthenticate with the SignalWire network using a new token
|
|
3140
|
-
* For now it returns void since with an invalid token the server
|
|
3141
|
-
* will close the connection right away so we can hook on the session
|
|
3142
|
-
* events in case. Need to improve it.
|
|
3143
|
-
*
|
|
3144
|
-
* @internal
|
|
3145
|
-
*/
|
|
3146
|
-
reauthenticate(token) {
|
|
3147
|
-
this.store.dispatch(actions3.reauthAction({ token }));
|
|
3148
|
-
}
|
|
3149
|
-
};
|
|
3150
|
-
|
|
3151
|
-
// src/JWTSession.ts
|
|
3152
|
-
import jwtDecode2 from "jwt-decode";
|
|
3153
|
-
import {
|
|
3154
|
-
BaseJWTSession,
|
|
3155
|
-
getLogger as getLogger21
|
|
3156
|
-
} from "@signalwire/core";
|
|
3157
|
-
|
|
3158
|
-
// src/utils/CloseEvent.ts
|
|
3159
|
-
import { SWCloseEvent as CoreCloseEvent } from "@signalwire/core";
|
|
3160
|
-
var SwCloseEvent = typeof CloseEvent === "function" ? CloseEvent : CoreCloseEvent;
|
|
3161
|
-
|
|
3162
|
-
// src/JWTSession.ts
|
|
3163
|
-
var JWTSession = class extends BaseJWTSession {
|
|
3164
|
-
constructor(options) {
|
|
3165
|
-
var _a;
|
|
3166
|
-
let decodedJwt = {};
|
|
3167
|
-
try {
|
|
3168
|
-
decodedJwt = jwtDecode2(options.token, {
|
|
3169
|
-
header: true
|
|
3170
|
-
});
|
|
3171
|
-
} catch (e) {
|
|
3172
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3173
|
-
getLogger21().debug("[JWTSession] error decoding the JWT");
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
super(__spreadProps(__spreadValues({}, options), {
|
|
3177
|
-
host: (decodedJwt == null ? void 0 : decodedJwt.ch) || options.host
|
|
3178
|
-
}));
|
|
3179
|
-
this.options = options;
|
|
3180
|
-
__publicField(this, "WebSocketConstructor", WebSocket);
|
|
3181
|
-
__publicField(this, "CloseEventConstructor", SwCloseEvent);
|
|
3182
|
-
__publicField(this, "agent", "@signalwire/js/browser/3.29.2");
|
|
3183
|
-
__publicField(this, "tokenTyp");
|
|
3184
|
-
this.tokenTyp = (_a = decodedJwt.typ) != null ? _a : "VRT";
|
|
3185
|
-
}
|
|
3186
|
-
get allowReattach() {
|
|
3187
|
-
var _a;
|
|
3188
|
-
return ((_a = this.options) == null ? void 0 : _a.reattach) !== false && (this.isVRT() || this.isSAT());
|
|
3189
|
-
}
|
|
3190
|
-
async retrieveRelayProtocol() {
|
|
3191
|
-
var _a, _b;
|
|
3192
|
-
if (!this.allowReattach) {
|
|
3193
|
-
return "";
|
|
3194
|
-
}
|
|
3195
|
-
const { protocolKey } = sessionStorageManager(this.options.token);
|
|
3196
|
-
if (protocolKey) {
|
|
3197
|
-
this.logger.trace("Search protocol for", protocolKey);
|
|
3198
|
-
return (_b = (_a = getStorage()) == null ? void 0 : _a.getItem(protocolKey)) != null ? _b : "";
|
|
3199
|
-
}
|
|
3200
|
-
return "";
|
|
3201
|
-
}
|
|
3202
|
-
async persistRelayProtocol() {
|
|
3203
|
-
var _a;
|
|
3204
|
-
if (!this.allowReattach) {
|
|
3205
|
-
return;
|
|
3206
|
-
}
|
|
3207
|
-
const { protocolKey } = sessionStorageManager(this.options.token);
|
|
3208
|
-
if (protocolKey) {
|
|
3209
|
-
this.logger.trace("Persist protocol", protocolKey, this.relayProtocol);
|
|
3210
|
-
(_a = getStorage()) == null ? void 0 : _a.setItem(protocolKey, this.relayProtocol);
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
removeRelayProtocol() {
|
|
3214
|
-
var _a;
|
|
3215
|
-
const { protocolKey } = sessionStorageManager(this.options.token);
|
|
3216
|
-
if (protocolKey) {
|
|
3217
|
-
this.logger.debug("Remove protocol", protocolKey, this.relayProtocol);
|
|
3218
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(protocolKey);
|
|
3219
|
-
}
|
|
3220
|
-
}
|
|
3221
|
-
removePrevCallId() {
|
|
3222
|
-
var _a;
|
|
3223
|
-
const { callIdKey } = sessionStorageManager(this.options.token);
|
|
3224
|
-
if (callIdKey) {
|
|
3225
|
-
this.logger.debug("Remove Call", callIdKey);
|
|
3226
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(callIdKey);
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
async retrieveSwAuthorizationState() {
|
|
3230
|
-
var _a, _b;
|
|
3231
|
-
const { authStateKey } = sessionStorageManager(this.options.token);
|
|
3232
|
-
if (authStateKey) {
|
|
3233
|
-
return (_b = (_a = getStorage()) == null ? void 0 : _a.getItem(authStateKey)) != null ? _b : "";
|
|
3234
|
-
}
|
|
3235
|
-
return "";
|
|
3236
|
-
}
|
|
3237
|
-
async persistSwAuthorizationState(state) {
|
|
3238
|
-
var _a;
|
|
3239
|
-
if (!this.allowReattach) {
|
|
3240
|
-
return;
|
|
3241
|
-
}
|
|
3242
|
-
const { authStateKey } = sessionStorageManager(this.options.token);
|
|
3243
|
-
if (authStateKey) {
|
|
3244
|
-
this.logger.trace("Persist auth state", authStateKey, state);
|
|
3245
|
-
(_a = getStorage()) == null ? void 0 : _a.setItem(authStateKey, state);
|
|
3246
|
-
}
|
|
3247
|
-
}
|
|
3248
|
-
removeSwAuthorizationState() {
|
|
3249
|
-
var _a;
|
|
3250
|
-
const { authStateKey } = sessionStorageManager(this.options.token);
|
|
3251
|
-
if (authStateKey) {
|
|
3252
|
-
this.logger.trace("Remove auth state", authStateKey);
|
|
3253
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(authStateKey);
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
_onSocketClose(event) {
|
|
3257
|
-
var _a, _b, _c;
|
|
3258
|
-
if (this.status === "disconnected") {
|
|
3259
|
-
const { protocolKey, authStateKey, callIdKey } = sessionStorageManager(
|
|
3260
|
-
this.options.token
|
|
3261
|
-
);
|
|
3262
|
-
this.logger.debug("Cleaning up storage");
|
|
3263
|
-
if (protocolKey) {
|
|
3264
|
-
this.logger.debug("Remove protocolKey", protocolKey);
|
|
3265
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(protocolKey);
|
|
3266
|
-
}
|
|
3267
|
-
if (authStateKey) {
|
|
3268
|
-
this.logger.debug("Remove authStateKey", authStateKey);
|
|
3269
|
-
(_b = getStorage()) == null ? void 0 : _b.removeItem(authStateKey);
|
|
3270
|
-
}
|
|
3271
|
-
if (callIdKey) {
|
|
3272
|
-
this.logger.debug("Remove callIdKey", callIdKey);
|
|
3273
|
-
(_c = getStorage()) == null ? void 0 : _c.removeItem(callIdKey);
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
super._onSocketClose(event);
|
|
3277
|
-
}
|
|
3278
|
-
isVRT() {
|
|
3279
|
-
return this.tokenTyp === "VRT";
|
|
3280
|
-
}
|
|
3281
|
-
isSAT() {
|
|
3282
|
-
return this.tokenTyp === "SAT";
|
|
3283
|
-
}
|
|
3284
|
-
};
|
|
3285
|
-
|
|
3286
|
-
// src/createClient.ts
|
|
3287
|
-
var createClient = (userOptions) => {
|
|
3288
|
-
const baseUserOptions = __spreadProps(__spreadValues({}, userOptions), {
|
|
3289
|
-
emitter: getEventEmitter()
|
|
3290
|
-
});
|
|
3291
|
-
const store = configureStore({
|
|
3292
|
-
userOptions: baseUserOptions,
|
|
3293
|
-
SessionConstructor: JWTSession
|
|
3294
|
-
});
|
|
3295
|
-
const client = connect6({
|
|
3296
|
-
store,
|
|
3297
|
-
Component: ClientAPI
|
|
3298
|
-
})(baseUserOptions);
|
|
3299
|
-
return client;
|
|
3300
|
-
};
|
|
3301
|
-
|
|
3302
|
-
// src/chat/Client.ts
|
|
3303
|
-
var INTERCEPTED_METHODS = [
|
|
3304
|
-
"subscribe",
|
|
3305
|
-
"publish",
|
|
3306
|
-
"getMessages",
|
|
3307
|
-
"getMembers",
|
|
3308
|
-
"getMemberState",
|
|
3309
|
-
"getAllowedChannels",
|
|
3310
|
-
"setMemberState"
|
|
3311
|
-
];
|
|
3312
|
-
var Client2 = function(chatOptions) {
|
|
3313
|
-
const client = createClient(chatOptions);
|
|
3314
|
-
const createInterceptor = (prop) => {
|
|
3315
|
-
return async (...params) => {
|
|
3316
|
-
await client.connect();
|
|
3317
|
-
return client.chat[prop](...params);
|
|
3318
|
-
};
|
|
3319
|
-
};
|
|
3320
|
-
const interceptors = {
|
|
3321
|
-
_session: client,
|
|
3322
|
-
disconnect: () => client.disconnect()
|
|
3323
|
-
};
|
|
3324
|
-
return new Proxy(client.chat, {
|
|
3325
|
-
get(target, prop, receiver) {
|
|
3326
|
-
if (prop in interceptors) {
|
|
3327
|
-
return interceptors[prop];
|
|
3328
|
-
}
|
|
3329
|
-
if (INTERCEPTED_METHODS.includes(prop)) {
|
|
3330
|
-
return createInterceptor(prop);
|
|
3331
|
-
}
|
|
3332
|
-
return Reflect.get(target, prop, receiver);
|
|
3333
|
-
}
|
|
3334
|
-
});
|
|
3335
|
-
};
|
|
3336
|
-
|
|
3337
|
-
// src/chat/index.ts
|
|
3338
|
-
import { ChatMember, ChatMessage } from "@signalwire/core";
|
|
3339
|
-
|
|
3340
|
-
// src/pubSub/index.ts
|
|
3341
|
-
var pubSub_exports = {};
|
|
3342
|
-
__export(pubSub_exports, {
|
|
3343
|
-
Client: () => Client3,
|
|
3344
|
-
PubSubMessage: () => PubSubMessage
|
|
3345
|
-
});
|
|
3346
|
-
import { PubSub } from "@signalwire/core";
|
|
3347
|
-
|
|
3348
|
-
// src/utils/interfaces/video.ts
|
|
3349
|
-
import { INTERNAL_MEMBER_UPDATABLE_PROPS } from "@signalwire/core";
|
|
3350
|
-
var INTERNAL_MEMBER_UPDATED_EVENTS = Object.keys(
|
|
3351
|
-
INTERNAL_MEMBER_UPDATABLE_PROPS
|
|
3352
|
-
).map((key) => {
|
|
3353
|
-
return `member.updated.${key}`;
|
|
3354
|
-
});
|
|
3355
|
-
|
|
3356
|
-
// src/pubSub/Client.ts
|
|
3357
|
-
var INTERCEPTED_METHODS2 = [
|
|
3358
|
-
"getAllowedChannels",
|
|
3359
|
-
"subscribe",
|
|
3360
|
-
"publish"
|
|
3361
|
-
];
|
|
3362
|
-
var Client3 = function(pubSubOptions) {
|
|
3363
|
-
const client = createClient(pubSubOptions);
|
|
3364
|
-
const createInterceptor = (prop) => {
|
|
3365
|
-
return async (...params) => {
|
|
3366
|
-
await client.connect();
|
|
3367
|
-
return client.pubSub[prop](...params);
|
|
3368
|
-
};
|
|
3369
|
-
};
|
|
3370
|
-
const interceptors = {
|
|
3371
|
-
_session: client,
|
|
3372
|
-
disconnect: () => client.disconnect()
|
|
3373
|
-
};
|
|
3374
|
-
return new Proxy(client.pubSub, {
|
|
3375
|
-
get(target, prop, receiver) {
|
|
3376
|
-
if (prop in interceptors) {
|
|
3377
|
-
return interceptors[prop];
|
|
3378
|
-
}
|
|
3379
|
-
if (INTERCEPTED_METHODS2.includes(prop)) {
|
|
3380
|
-
return createInterceptor(prop);
|
|
3381
|
-
}
|
|
3382
|
-
return Reflect.get(target, prop, receiver);
|
|
3383
|
-
}
|
|
3384
|
-
});
|
|
3385
|
-
};
|
|
3386
|
-
|
|
3387
|
-
// src/pubSub/index.ts
|
|
3388
|
-
var PubSubMessage = PubSub.PubSubMessage;
|
|
3389
|
-
|
|
3390
|
-
// src/fabric/index.ts
|
|
3391
|
-
var fabric_exports = {};
|
|
3392
|
-
__export(fabric_exports, {
|
|
3393
|
-
SignalWire: () => SignalWire,
|
|
3394
|
-
isFabricRoomSession: () => isFabricRoomSession
|
|
3395
|
-
});
|
|
3396
|
-
|
|
3397
|
-
// src/fabric/HTTPClient.ts
|
|
3398
|
-
import jwtDecode3 from "jwt-decode";
|
|
3399
|
-
import { getLogger as getLogger22, HttpError as HttpError2 } from "@signalwire/core";
|
|
3400
|
-
|
|
3401
|
-
// src/fabric/createHttpClient.ts
|
|
3402
|
-
import {
|
|
3403
|
-
asyncRetry,
|
|
3404
|
-
AuthError,
|
|
3405
|
-
HttpError,
|
|
3406
|
-
increasingDelay
|
|
3407
|
-
} from "@signalwire/core";
|
|
3408
|
-
var DEFAULT_MAX_RETRIES = 0;
|
|
3409
|
-
var DEFAULT_INITIAL_DELAY = 0;
|
|
3410
|
-
var DEFAULT_DELAY_VARIATION = 0;
|
|
3411
|
-
var DEFAULT_TIMEOUT = 3e4;
|
|
3412
|
-
async function http(input, init, maxRetries, retriesDelay, retriesDelayIncrement) {
|
|
3413
|
-
const response = await asyncRetry({
|
|
3414
|
-
asyncCallable: () => fetch(input, init),
|
|
3415
|
-
maxRetries,
|
|
3416
|
-
validator: (response2) => {
|
|
3417
|
-
if (!response2.ok && response2.status >= 500) {
|
|
3418
|
-
throw new HttpError(response2.status, response2.statusText);
|
|
3419
|
-
}
|
|
3420
|
-
},
|
|
3421
|
-
delayFn: increasingDelay({
|
|
3422
|
-
initialDelay: retriesDelay,
|
|
3423
|
-
variation: retriesDelayIncrement
|
|
3424
|
-
})
|
|
3425
|
-
});
|
|
3426
|
-
if (!response.ok) {
|
|
3427
|
-
if (response.status === 401) {
|
|
3428
|
-
throw new AuthError(response.status, "Unauthorized");
|
|
3429
|
-
}
|
|
3430
|
-
let errorResponse;
|
|
3431
|
-
try {
|
|
3432
|
-
errorResponse = await response.json();
|
|
3433
|
-
} catch (e) {
|
|
3434
|
-
}
|
|
3435
|
-
const errorMessage = (errorResponse == null ? void 0 : errorResponse.errors) ? JSON.stringify(errorResponse.errors) : "Not Found";
|
|
3436
|
-
throw new HttpError(response.status, errorMessage, errorResponse);
|
|
3437
|
-
}
|
|
3438
|
-
try {
|
|
3439
|
-
response.parsedBody = await response.json();
|
|
3440
|
-
} catch (e) {
|
|
3441
|
-
}
|
|
3442
|
-
return response;
|
|
3443
|
-
}
|
|
3444
|
-
var createHttpClient = (_a, fetcher = http) => {
|
|
3445
|
-
var _b = _a, {
|
|
3446
|
-
baseUrl,
|
|
3447
|
-
maxApiRequestRetries: retries = DEFAULT_MAX_RETRIES,
|
|
3448
|
-
apiRequestRetriesDelay: retriesDelay = DEFAULT_INITIAL_DELAY,
|
|
3449
|
-
apiRequestRetriesDelayIncrement: retriesDelayIncrement = DEFAULT_DELAY_VARIATION,
|
|
3450
|
-
timeout = DEFAULT_TIMEOUT
|
|
3451
|
-
} = _b, globalOptions = __objRest(_b, [
|
|
3452
|
-
"baseUrl",
|
|
3453
|
-
"maxApiRequestRetries",
|
|
3454
|
-
"apiRequestRetriesDelay",
|
|
3455
|
-
"apiRequestRetriesDelayIncrement",
|
|
3456
|
-
"timeout"
|
|
3457
|
-
]);
|
|
3458
|
-
const apiClient = async (path, options) => {
|
|
3459
|
-
const headers = __spreadValues(__spreadValues(__spreadValues({}, (options == null ? void 0 : options.body) ? { "Content-Type": "application/json" } : {}), globalOptions.headers), options == null ? void 0 : options.headers);
|
|
3460
|
-
const reqInit = getRequestInit(__spreadProps(__spreadValues(__spreadValues({}, globalOptions), options), {
|
|
3461
|
-
headers
|
|
3462
|
-
}));
|
|
3463
|
-
let timerId;
|
|
3464
|
-
if (timeout) {
|
|
3465
|
-
const controller = new AbortController();
|
|
3466
|
-
const signal = controller.signal;
|
|
3467
|
-
reqInit.signal = signal;
|
|
3468
|
-
timerId = setTimeout(() => {
|
|
3469
|
-
controller.abort();
|
|
3470
|
-
}, timeout);
|
|
3471
|
-
}
|
|
3472
|
-
try {
|
|
3473
|
-
const response = await fetcher(
|
|
3474
|
-
getUrl({
|
|
3475
|
-
path,
|
|
3476
|
-
baseUrl,
|
|
3477
|
-
searchParams: options == null ? void 0 : options.searchParams
|
|
3478
|
-
}),
|
|
3479
|
-
reqInit,
|
|
3480
|
-
retries,
|
|
3481
|
-
retriesDelay,
|
|
3482
|
-
retriesDelayIncrement
|
|
3483
|
-
);
|
|
3484
|
-
return { body: response.parsedBody };
|
|
3485
|
-
} catch (e) {
|
|
3486
|
-
throw e;
|
|
3487
|
-
} finally {
|
|
3488
|
-
timerId && clearTimeout(timerId);
|
|
3489
|
-
}
|
|
3490
|
-
};
|
|
3491
|
-
return apiClient;
|
|
3492
|
-
};
|
|
3493
|
-
var getBody = (body) => {
|
|
3494
|
-
return typeof body === "string" ? body : JSON.stringify(body);
|
|
3495
|
-
};
|
|
3496
|
-
var getRequestInit = (options) => {
|
|
3497
|
-
return Object.entries(options).reduce((reducer, [key, value]) => {
|
|
3498
|
-
if (key === "body") {
|
|
3499
|
-
return __spreadProps(__spreadValues({}, reducer), {
|
|
3500
|
-
body: getBody(value)
|
|
3501
|
-
});
|
|
3502
|
-
} else if (value != void 0) {
|
|
3503
|
-
return __spreadProps(__spreadValues({}, reducer), {
|
|
3504
|
-
[key]: value
|
|
3505
|
-
});
|
|
3506
|
-
}
|
|
3507
|
-
return reducer;
|
|
3508
|
-
}, {});
|
|
3509
|
-
};
|
|
3510
|
-
var getUrl = ({
|
|
3511
|
-
path,
|
|
3512
|
-
baseUrl,
|
|
3513
|
-
searchParams
|
|
3514
|
-
}) => {
|
|
3515
|
-
const url = new URL(path, baseUrl);
|
|
3516
|
-
if (searchParams) {
|
|
3517
|
-
Object.entries(searchParams).forEach(([key, value]) => {
|
|
3518
|
-
if (value != void 0) {
|
|
3519
|
-
url.searchParams.append(key, value);
|
|
3520
|
-
}
|
|
3521
|
-
});
|
|
3522
|
-
}
|
|
3523
|
-
return url.toString();
|
|
3524
|
-
};
|
|
3525
|
-
|
|
3526
|
-
// src/utils/paginatedResult.ts
|
|
3527
|
-
function buildPaginatedResult(body, client) {
|
|
3528
|
-
const anotherPage = async (url) => {
|
|
3529
|
-
if (!url) return Promise.resolve(void 0);
|
|
3530
|
-
const { body: body2 } = await client(url);
|
|
3531
|
-
return buildPaginatedResult(body2, client);
|
|
3532
|
-
};
|
|
3533
|
-
return {
|
|
3534
|
-
data: body.data,
|
|
3535
|
-
self: async () => {
|
|
3536
|
-
const { self } = body.links;
|
|
3537
|
-
return anotherPage(self);
|
|
3538
|
-
},
|
|
3539
|
-
nextPage: async () => {
|
|
3540
|
-
const { next } = body.links;
|
|
3541
|
-
return anotherPage(next);
|
|
3542
|
-
},
|
|
3543
|
-
prevPage: async () => {
|
|
3544
|
-
const { prev } = body.links;
|
|
3545
|
-
return anotherPage(prev);
|
|
3546
|
-
},
|
|
3547
|
-
firstPage: async () => {
|
|
3548
|
-
const { first } = body.links;
|
|
3549
|
-
return anotherPage(first);
|
|
3550
|
-
},
|
|
3551
|
-
hasNext: Boolean(body.links.next),
|
|
3552
|
-
hasPrev: Boolean(body.links.prev)
|
|
3553
|
-
};
|
|
3554
|
-
}
|
|
3555
|
-
|
|
3556
|
-
// src/utils/makeQueryParamsUrl.ts
|
|
3557
|
-
function makeQueryParamsUrls(path, queryParams) {
|
|
3558
|
-
const queryString = queryParams.toString();
|
|
3559
|
-
return queryString ? `${path}?${queryString}` : path;
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
|
-
// src/fabric/utils/typeGuard.ts
|
|
3563
|
-
var isGetAddressByNameParams = (obj) => {
|
|
3564
|
-
return obj && "name" in obj;
|
|
3565
|
-
};
|
|
3566
|
-
var isGetAddressByIdParams = (obj) => {
|
|
3567
|
-
return obj && "id" in obj;
|
|
3568
|
-
};
|
|
3569
|
-
var isGetAddressesResponse = (obj) => {
|
|
3570
|
-
return obj && "data" in obj;
|
|
3571
|
-
};
|
|
3572
|
-
|
|
3573
|
-
// src/fabric/HTTPClient.ts
|
|
3574
|
-
var HTTPClient = class {
|
|
3575
|
-
constructor(options) {
|
|
3576
|
-
this.options = options;
|
|
3577
|
-
__publicField(this, "httpClient");
|
|
3578
|
-
this.httpClient = createHttpClient({
|
|
3579
|
-
baseUrl: `https://${this.httpHost}`,
|
|
3580
|
-
headers: {
|
|
3581
|
-
Authorization: `Bearer ${this.options.token}`
|
|
3582
|
-
},
|
|
3583
|
-
maxApiRequestRetries: this.options.maxApiRequestRetries,
|
|
3584
|
-
apiRequestRetriesDelay: this.options.apiRequestRetriesDelay,
|
|
3585
|
-
apiRequestRetriesDelayIncrement: this.options.apiRequestRetriesDelayIncrement
|
|
3586
|
-
});
|
|
3587
|
-
}
|
|
3588
|
-
get fetch() {
|
|
3589
|
-
return this.httpClient;
|
|
3590
|
-
}
|
|
3591
|
-
get httpHost() {
|
|
3592
|
-
let decodedJwt = {};
|
|
3593
|
-
try {
|
|
3594
|
-
decodedJwt = jwtDecode3(this.options.token, {
|
|
3595
|
-
header: true
|
|
3596
|
-
});
|
|
3597
|
-
} catch (e) {
|
|
3598
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3599
|
-
getLogger22().debug("[JWTSession] error decoding the JWT");
|
|
3600
|
-
}
|
|
3601
|
-
}
|
|
3602
|
-
const host = this.options.host || (decodedJwt == null ? void 0 : decodedJwt.ch);
|
|
3603
|
-
if (!host) {
|
|
3604
|
-
return "fabric.signalwire.com";
|
|
3605
|
-
}
|
|
3606
|
-
return `fabric.${host.split(".").splice(1).join(".")}`;
|
|
3607
|
-
}
|
|
3608
|
-
async getAddress(params) {
|
|
3609
|
-
let path = "/api/fabric/addresses";
|
|
3610
|
-
if (isGetAddressByNameParams(params)) {
|
|
3611
|
-
path = `${path}?name=${params.name}`;
|
|
3612
|
-
} else if (isGetAddressByIdParams(params)) {
|
|
3613
|
-
path = `${path}/${params.id}`;
|
|
3614
|
-
}
|
|
3615
|
-
const { body } = await this.httpClient(path);
|
|
3616
|
-
if (isGetAddressesResponse(body)) {
|
|
3617
|
-
if (!body.data[0]) throw new HttpError2(404, "Not Found");
|
|
3618
|
-
return body.data[0];
|
|
3619
|
-
}
|
|
3620
|
-
return body;
|
|
3621
|
-
}
|
|
3622
|
-
async getAddresses(params) {
|
|
3623
|
-
const { type, displayName, pageSize, sortBy, sortOrder } = params || {};
|
|
3624
|
-
let path = "/api/fabric/addresses";
|
|
3625
|
-
const queryParams = new URLSearchParams();
|
|
3626
|
-
if (type) {
|
|
3627
|
-
queryParams.append("type", type);
|
|
3628
|
-
}
|
|
3629
|
-
if (displayName) {
|
|
3630
|
-
queryParams.append("display_name", displayName);
|
|
3631
|
-
}
|
|
3632
|
-
if (pageSize) {
|
|
3633
|
-
queryParams.append("page_size", pageSize.toString());
|
|
3634
|
-
}
|
|
3635
|
-
if (sortBy) {
|
|
3636
|
-
queryParams.append("sort_by", sortBy);
|
|
3637
|
-
}
|
|
3638
|
-
if (sortOrder) {
|
|
3639
|
-
queryParams.append("sort_order", sortOrder);
|
|
3640
|
-
}
|
|
3641
|
-
const queryUrl = makeQueryParamsUrls(path, queryParams);
|
|
3642
|
-
getLogger22().debug(`[getAddresses] query URL ${queryUrl}`);
|
|
3643
|
-
const { body } = await this.httpClient(queryUrl);
|
|
3644
|
-
return buildPaginatedResult(body, this.httpClient);
|
|
3645
|
-
}
|
|
3646
|
-
async registerDevice(params) {
|
|
3647
|
-
const { deviceType, deviceToken } = params;
|
|
3648
|
-
const path = "/subscriber/devices";
|
|
3649
|
-
const { body } = await this.httpClient(path, {
|
|
3650
|
-
method: "POST",
|
|
3651
|
-
body: {
|
|
3652
|
-
device_type: deviceType,
|
|
3653
|
-
device_token: deviceToken
|
|
3654
|
-
}
|
|
3655
|
-
});
|
|
3656
|
-
return body;
|
|
3657
|
-
}
|
|
3658
|
-
async unregisterDevice(params) {
|
|
3659
|
-
const { id } = params;
|
|
3660
|
-
const path = `/subscriber/devices/${id}`;
|
|
3661
|
-
await this.httpClient(path, {
|
|
3662
|
-
method: "DELETE"
|
|
3663
|
-
});
|
|
3664
|
-
}
|
|
3665
|
-
async getSubscriberInfo() {
|
|
3666
|
-
let path = "/api/fabric/subscriber/info";
|
|
3667
|
-
const { body } = await this.httpClient(path);
|
|
3668
|
-
return body;
|
|
3669
|
-
}
|
|
3670
|
-
};
|
|
3671
|
-
|
|
3672
|
-
// src/fabric/WSClient.ts
|
|
3673
|
-
import {
|
|
3674
|
-
actions as actions4,
|
|
3675
|
-
BaseClient as BaseClient2,
|
|
3676
|
-
VertoBye,
|
|
3677
|
-
VertoSubscribe
|
|
3678
|
-
} from "@signalwire/core";
|
|
3679
|
-
import { sessionConnectionPoolWorker } from "@signalwire/webrtc";
|
|
3680
|
-
|
|
3681
|
-
// src/fabric/IncomingCallManager.ts
|
|
3682
|
-
var IncomingCallManager = class {
|
|
3683
|
-
constructor(options) {
|
|
3684
|
-
this.options = options;
|
|
3685
|
-
__publicField(this, "_client");
|
|
3686
|
-
__publicField(this, "_pendingInvites", {});
|
|
3687
|
-
__publicField(this, "_handlers", {});
|
|
3688
|
-
this._client = options.client;
|
|
3689
|
-
}
|
|
3690
|
-
_buildNotification(invite) {
|
|
3691
|
-
const accept = async (params) => {
|
|
3692
|
-
return new Promise((resolve, reject2) => {
|
|
3693
|
-
delete this._pendingInvites[invite.callID];
|
|
3694
|
-
try {
|
|
3695
|
-
const call = this.options.buildInboundCall(invite, params);
|
|
3696
|
-
call.answer();
|
|
3697
|
-
resolve(call);
|
|
3698
|
-
} catch (e) {
|
|
3699
|
-
reject2(e);
|
|
3700
|
-
}
|
|
3701
|
-
});
|
|
3702
|
-
};
|
|
3703
|
-
const reject = () => {
|
|
3704
|
-
delete this._pendingInvites[invite.callID];
|
|
3705
|
-
return this.options.executeVertoBye(invite.callID, invite.nodeId);
|
|
3706
|
-
};
|
|
3707
|
-
return {
|
|
3708
|
-
invite: {
|
|
3709
|
-
details: invite,
|
|
3710
|
-
accept: (params) => accept(params),
|
|
3711
|
-
reject: () => reject()
|
|
3712
|
-
}
|
|
3713
|
-
};
|
|
3714
|
-
}
|
|
3715
|
-
setNotificationHandlers(handlers) {
|
|
3716
|
-
this._handlers.all = handlers.all;
|
|
3717
|
-
if (handlers.pushNotification && this._handlers.all != handlers.pushNotification || !handlers.pushNotification) {
|
|
3718
|
-
this._handlers.pushNotification = handlers.pushNotification;
|
|
3719
|
-
}
|
|
3720
|
-
if (handlers.websocket && this._handlers.all != handlers.websocket || !handlers.websocket) {
|
|
3721
|
-
this._handlers.websocket = handlers.websocket;
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
handleIncomingInvite(incomingInvite) {
|
|
3725
|
-
var _a, _b;
|
|
3726
|
-
if (incomingInvite.callID in this._pendingInvites) {
|
|
3727
|
-
this._client.logger.debug(
|
|
3728
|
-
`skiping nottification for pending invite to callID: ${incomingInvite.callID}`
|
|
3729
|
-
);
|
|
3730
|
-
return;
|
|
3731
|
-
}
|
|
3732
|
-
this._pendingInvites[incomingInvite.callID] = incomingInvite;
|
|
3733
|
-
if (!(this._handlers.all || this._handlers[incomingInvite.source])) {
|
|
3734
|
-
this._client.logger.warn("Skiping nottification due to no listeners");
|
|
3735
|
-
return;
|
|
3736
|
-
}
|
|
3737
|
-
const notification = this._buildNotification(incomingInvite);
|
|
3738
|
-
(_b = (_a = this._handlers).all) == null ? void 0 : _b.call(_a, notification);
|
|
3739
|
-
const handler = this._handlers[incomingInvite.source];
|
|
3740
|
-
handler == null ? void 0 : handler(notification);
|
|
3741
|
-
}
|
|
3742
|
-
};
|
|
3743
|
-
|
|
3744
|
-
// src/fabric/createWSClient.ts
|
|
3745
|
-
import { configureStore as configureStore2 } from "@signalwire/core";
|
|
3746
|
-
|
|
3747
|
-
// src/fabric/SATSession.ts
|
|
3748
|
-
import {
|
|
3749
|
-
asyncRetry as asyncRetry2,
|
|
3750
|
-
increasingDelay as increasingDelay2,
|
|
3751
|
-
RPCReauthenticate,
|
|
3752
|
-
UNIFIED_CONNECT_VERSION,
|
|
3753
|
-
isConnectRequest,
|
|
3754
|
-
getLogger as getLogger23,
|
|
3755
|
-
isVertoInvite,
|
|
3756
|
-
SYMBOL_EXECUTE_CONNECTION_CLOSED,
|
|
3757
|
-
SYMBOL_EXECUTE_TIMEOUT
|
|
3758
|
-
} from "@signalwire/core";
|
|
3759
|
-
var SATSession = class extends JWTSession {
|
|
3760
|
-
constructor(options) {
|
|
3761
|
-
super(options);
|
|
3762
|
-
this.options = options;
|
|
3763
|
-
__publicField(this, "connectVersion", UNIFIED_CONNECT_VERSION);
|
|
3764
|
-
}
|
|
3765
|
-
get signature() {
|
|
3766
|
-
if (this._rpcConnectResult) {
|
|
3767
|
-
const { authorization } = this._rpcConnectResult;
|
|
3768
|
-
return authorization.jti;
|
|
3769
|
-
}
|
|
3770
|
-
return void 0;
|
|
3771
|
-
}
|
|
3772
|
-
async _checkTokenExpiration() {
|
|
3773
|
-
}
|
|
3774
|
-
/**
|
|
3775
|
-
* Reauthenticate with the SignalWire Network using a newer SAT.
|
|
3776
|
-
* If the session has expired, this will reconnect it.
|
|
3777
|
-
* @return Promise<void>
|
|
3778
|
-
*/
|
|
3779
|
-
async reauthenticate() {
|
|
3780
|
-
this.logger.debug("Session Reauthenticate", {
|
|
3781
|
-
ready: this.ready,
|
|
3782
|
-
expired: this.expired
|
|
3783
|
-
});
|
|
3784
|
-
if (!this.ready || this.expired) {
|
|
3785
|
-
return this.connect();
|
|
3786
|
-
}
|
|
3787
|
-
const params = {
|
|
3788
|
-
project: this._rpcConnectResult.authorization.project_id,
|
|
3789
|
-
jwt_token: this.options.token
|
|
3790
|
-
};
|
|
3791
|
-
try {
|
|
3792
|
-
const reauthResponse = await this.execute(RPCReauthenticate(params));
|
|
3793
|
-
this._rpcConnectResult = __spreadValues(__spreadValues({}, this._rpcConnectResult), reauthResponse);
|
|
3794
|
-
} catch (error) {
|
|
3795
|
-
throw error;
|
|
3796
|
-
}
|
|
3797
|
-
}
|
|
3798
|
-
async execute(msg) {
|
|
3799
|
-
return asyncRetry2({
|
|
3800
|
-
asyncCallable: async () => {
|
|
3801
|
-
await this._waitConnected();
|
|
3802
|
-
return super.execute(msg);
|
|
3803
|
-
},
|
|
3804
|
-
maxRetries: this.options.maxApiRequestRetries,
|
|
3805
|
-
delayFn: increasingDelay2({
|
|
3806
|
-
initialDelay: this.options.apiRequestRetriesDelay,
|
|
3807
|
-
variation: this.options.apiRequestRetriesDelayIncrement
|
|
3808
|
-
}),
|
|
3809
|
-
expectedErrorHandler: (error) => {
|
|
3810
|
-
getLogger23().warn(error);
|
|
3811
|
-
if (isConnectRequest(msg)) {
|
|
3812
|
-
return true;
|
|
3813
|
-
}
|
|
3814
|
-
if (isVertoInvite(msg) && ![SYMBOL_EXECUTE_CONNECTION_CLOSED, SYMBOL_EXECUTE_TIMEOUT].includes(error)) {
|
|
3815
|
-
getLogger23().debug("skip verto.invite retry on error:", error);
|
|
3816
|
-
return true;
|
|
3817
|
-
}
|
|
3818
|
-
return false;
|
|
3819
|
-
}
|
|
3820
|
-
});
|
|
3821
|
-
}
|
|
3822
|
-
};
|
|
3823
|
-
|
|
3824
|
-
// src/fabric/createWSClient.ts
|
|
3825
|
-
var createWSClient = (options) => {
|
|
3826
|
-
const store = configureStore2({
|
|
3827
|
-
userOptions: options,
|
|
3828
|
-
SessionConstructor: SATSession
|
|
3829
|
-
});
|
|
3830
|
-
return __spreadProps(__spreadValues({}, options), { store });
|
|
3831
|
-
};
|
|
3832
|
-
|
|
3833
|
-
// src/fabric/WSClient.ts
|
|
3834
|
-
var WSClient = class extends BaseClient2 {
|
|
3835
|
-
constructor(wsClientOptions) {
|
|
3836
|
-
const client = createWSClient(wsClientOptions);
|
|
3837
|
-
super(client);
|
|
3838
|
-
this.wsClientOptions = wsClientOptions;
|
|
3839
|
-
__publicField(this, "_incomingCallManager");
|
|
3840
|
-
__publicField(this, "_disconnected", false);
|
|
3841
|
-
this._incomingCallManager = new IncomingCallManager({
|
|
3842
|
-
client: this,
|
|
3843
|
-
buildInboundCall: this.buildInboundCall.bind(this),
|
|
3844
|
-
executeVertoBye: this.executeVertoBye.bind(this)
|
|
3845
|
-
});
|
|
3846
|
-
this.runWorker("wsClientWorker", {
|
|
3847
|
-
worker: wsClientWorker,
|
|
3848
|
-
initialState: {
|
|
3849
|
-
handleIncomingInvite: (invite) => {
|
|
3850
|
-
this._incomingCallManager.handleIncomingInvite(__spreadValues({
|
|
3851
|
-
source: "websocket"
|
|
3852
|
-
}, invite));
|
|
3853
|
-
}
|
|
3854
|
-
}
|
|
3855
|
-
});
|
|
3856
|
-
this.initializeSessionConnectionPool();
|
|
3857
|
-
}
|
|
3858
|
-
makeFabricObject(makeRoomOptions) {
|
|
3859
|
-
const _a = makeRoomOptions, {
|
|
3860
|
-
rootElement,
|
|
3861
|
-
applyLocalVideoOverlay = true,
|
|
3862
|
-
applyMemberOverlay = true,
|
|
3863
|
-
stopCameraWhileMuted = true,
|
|
3864
|
-
stopMicrophoneWhileMuted = true,
|
|
3865
|
-
mirrorLocalVideoOverlay = true
|
|
3866
|
-
} = _a, options = __objRest(_a, [
|
|
3867
|
-
"rootElement",
|
|
3868
|
-
"applyLocalVideoOverlay",
|
|
3869
|
-
"applyMemberOverlay",
|
|
3870
|
-
"stopCameraWhileMuted",
|
|
3871
|
-
"stopMicrophoneWhileMuted",
|
|
3872
|
-
"mirrorLocalVideoOverlay"
|
|
3873
|
-
]);
|
|
3874
|
-
const room = createFabricRoomSessionObject(__spreadProps(__spreadValues({}, options), {
|
|
3875
|
-
store: this.store
|
|
3876
|
-
}));
|
|
3877
|
-
if (rootElement) {
|
|
3878
|
-
try {
|
|
3879
|
-
buildVideoElement({
|
|
3880
|
-
applyLocalVideoOverlay,
|
|
3881
|
-
applyMemberOverlay,
|
|
3882
|
-
mirrorLocalVideoOverlay,
|
|
3883
|
-
room,
|
|
3884
|
-
rootElement
|
|
3885
|
-
});
|
|
3886
|
-
} catch (error) {
|
|
3887
|
-
this.logger.error("Unable to build the video element automatically");
|
|
3888
|
-
}
|
|
3889
|
-
}
|
|
3890
|
-
const joinMutedHandler = (params) => {
|
|
3891
|
-
var _a2;
|
|
3892
|
-
const member = (_a2 = params.room_session.members) == null ? void 0 : _a2.find(
|
|
3893
|
-
(m) => m.member_id === room.memberId
|
|
3894
|
-
);
|
|
3895
|
-
if (member == null ? void 0 : member.audio_muted) {
|
|
3896
|
-
try {
|
|
3897
|
-
room.stopOutboundAudio();
|
|
3898
|
-
} catch (error) {
|
|
3899
|
-
this.logger.error("Error handling audio_muted", error);
|
|
3900
|
-
}
|
|
3901
|
-
}
|
|
3902
|
-
if (member == null ? void 0 : member.video_muted) {
|
|
3903
|
-
try {
|
|
3904
|
-
room.stopOutboundVideo();
|
|
3905
|
-
} catch (error) {
|
|
3906
|
-
this.logger.error("Error handling video_muted", error);
|
|
3907
|
-
}
|
|
3908
|
-
}
|
|
3909
|
-
};
|
|
3910
|
-
room.on("room.subscribed", joinMutedHandler);
|
|
3911
|
-
if (stopMicrophoneWhileMuted) {
|
|
3912
|
-
room.on("member.updated.audioMuted", ({ member }) => {
|
|
3913
|
-
try {
|
|
3914
|
-
if (member.member_id === room.memberId && "audio_muted" in member) {
|
|
3915
|
-
member.audio_muted ? room.stopOutboundAudio() : room.restoreOutboundAudio();
|
|
3916
|
-
}
|
|
3917
|
-
} catch (error) {
|
|
3918
|
-
this.logger.error("Error handling audio_muted", error);
|
|
3919
|
-
}
|
|
3920
|
-
});
|
|
3921
|
-
}
|
|
3922
|
-
if (stopCameraWhileMuted) {
|
|
3923
|
-
room.on("member.updated.videoMuted", ({ member }) => {
|
|
3924
|
-
try {
|
|
3925
|
-
if (member.member_id === room.memberId && "video_muted" in member) {
|
|
3926
|
-
member.video_muted ? room.stopOutboundVideo() : room.restoreOutboundVideo();
|
|
3927
|
-
}
|
|
3928
|
-
} catch (error) {
|
|
3929
|
-
this.logger.error("Error handling video_muted", error);
|
|
3930
|
-
}
|
|
3931
|
-
});
|
|
3932
|
-
}
|
|
3933
|
-
return room;
|
|
3934
|
-
}
|
|
3935
|
-
buildOutboundCall(params) {
|
|
3936
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3937
|
-
let video = false;
|
|
3938
|
-
let negotiateVideo = false;
|
|
3939
|
-
if (params.to) {
|
|
3940
|
-
const [pathname, query] = params.to.split("?");
|
|
3941
|
-
if (!pathname) {
|
|
3942
|
-
throw new Error("Invalid destination address");
|
|
3943
|
-
}
|
|
3944
|
-
const queryParams = new URLSearchParams(query);
|
|
3945
|
-
const channel = queryParams.get("channel");
|
|
3946
|
-
if (channel === "video") {
|
|
3947
|
-
video = true;
|
|
3948
|
-
negotiateVideo = true;
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
const call = this.makeFabricObject({
|
|
3952
|
-
audio: (_a = params.audio) != null ? _a : true,
|
|
3953
|
-
video: (_b = params.video) != null ? _b : video,
|
|
3954
|
-
negotiateAudio: (_c = params.negotiateAudio) != null ? _c : true,
|
|
3955
|
-
negotiateVideo: (_d = params.negotiateVideo) != null ? _d : negotiateVideo,
|
|
3956
|
-
rootElement: params.rootElement || this.wsClientOptions.rootElement,
|
|
3957
|
-
applyLocalVideoOverlay: params.applyLocalVideoOverlay,
|
|
3958
|
-
applyMemberOverlay: params.applyMemberOverlay,
|
|
3959
|
-
stopCameraWhileMuted: params.stopCameraWhileMuted,
|
|
3960
|
-
stopMicrophoneWhileMuted: params.stopMicrophoneWhileMuted,
|
|
3961
|
-
mirrorLocalVideoOverlay: params.mirrorLocalVideoOverlay,
|
|
3962
|
-
watchMediaPackets: false,
|
|
3963
|
-
destinationNumber: (_e = params.to) != null ? _e : "",
|
|
3964
|
-
nodeId: params.nodeId,
|
|
3965
|
-
attach: (_f = params.attach) != null ? _f : false,
|
|
3966
|
-
disableUdpIceServers: params.disableUdpIceServers || false,
|
|
3967
|
-
userVariables: params.userVariables || this.wsClientOptions.userVariables,
|
|
3968
|
-
fromFabricAddressId: params.fromFabricAddressId
|
|
3969
|
-
});
|
|
3970
|
-
call.once("destroy", () => {
|
|
3971
|
-
this.logger.debug("RTC Connection Destroyed");
|
|
3972
|
-
call.destroy();
|
|
3973
|
-
});
|
|
3974
|
-
this.session.once("session.disconnected", () => {
|
|
3975
|
-
this.logger.debug("Session Disconnected");
|
|
3976
|
-
call.destroy();
|
|
3977
|
-
this.destroy();
|
|
3978
|
-
});
|
|
3979
|
-
call.attachPreConnectWorkers();
|
|
3980
|
-
return call;
|
|
3981
|
-
}
|
|
3982
|
-
buildInboundCall(payload, params) {
|
|
3983
|
-
var _a, _b, _c, _d;
|
|
3984
|
-
const call = this.makeFabricObject({
|
|
3985
|
-
audio: (_a = params.audio) != null ? _a : true,
|
|
3986
|
-
video: (_b = params.video) != null ? _b : true,
|
|
3987
|
-
negotiateAudio: (_c = params.negotiateAudio) != null ? _c : true,
|
|
3988
|
-
negotiateVideo: (_d = params.negotiateVideo) != null ? _d : true,
|
|
3989
|
-
rootElement: params.rootElement || this.wsClientOptions.rootElement,
|
|
3990
|
-
applyLocalVideoOverlay: true,
|
|
3991
|
-
applyMemberOverlay: true,
|
|
3992
|
-
stopCameraWhileMuted: true,
|
|
3993
|
-
stopMicrophoneWhileMuted: true,
|
|
3994
|
-
watchMediaPackets: false,
|
|
3995
|
-
nodeId: payload.nodeId,
|
|
3996
|
-
remoteSdp: payload.sdp,
|
|
3997
|
-
prevCallId: payload.callID,
|
|
3998
|
-
disableUdpIceServers: params.disableUdpIceServers || false,
|
|
3999
|
-
userVariables: params.userVariables || this.wsClientOptions.userVariables
|
|
4000
|
-
});
|
|
4001
|
-
call.once("destroy", () => {
|
|
4002
|
-
this.logger.debug("RTC Connection Destroyed");
|
|
4003
|
-
call.destroy();
|
|
4004
|
-
});
|
|
4005
|
-
this.session.once("session.disconnected", () => {
|
|
4006
|
-
this.logger.debug("Session Disconnected");
|
|
4007
|
-
call.destroy();
|
|
4008
|
-
this.destroy();
|
|
4009
|
-
});
|
|
4010
|
-
call.attachPreConnectWorkers();
|
|
4011
|
-
return call;
|
|
4012
|
-
}
|
|
4013
|
-
async executeVertoBye(callId, nodeId) {
|
|
4014
|
-
try {
|
|
4015
|
-
return await this.execute({
|
|
4016
|
-
method: "webrtc.verto",
|
|
4017
|
-
params: {
|
|
4018
|
-
callID: callId,
|
|
4019
|
-
node_id: nodeId,
|
|
4020
|
-
message: VertoBye({
|
|
4021
|
-
cause: "USER_BUSY",
|
|
4022
|
-
causeCode: "17",
|
|
4023
|
-
dialogParams: { callID: callId }
|
|
4024
|
-
})
|
|
4025
|
-
}
|
|
4026
|
-
});
|
|
4027
|
-
} catch (error) {
|
|
4028
|
-
this.logger.warn("The call is not available anymore", callId);
|
|
4029
|
-
throw error;
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
async executeVertoSubscribe(callId, nodeId) {
|
|
4033
|
-
try {
|
|
4034
|
-
return await this.execute({
|
|
4035
|
-
method: "webrtc.verto",
|
|
4036
|
-
params: {
|
|
4037
|
-
callID: callId,
|
|
4038
|
-
node_id: nodeId,
|
|
4039
|
-
subscribe: [],
|
|
4040
|
-
message: VertoSubscribe({
|
|
4041
|
-
sessid: callId,
|
|
4042
|
-
eventChannel: []
|
|
4043
|
-
})
|
|
4044
|
-
}
|
|
4045
|
-
});
|
|
4046
|
-
} catch (error) {
|
|
4047
|
-
this.logger.warn("The call is not available anymore", callId);
|
|
4048
|
-
throw error;
|
|
4049
|
-
}
|
|
4050
|
-
}
|
|
4051
|
-
disconnect() {
|
|
4052
|
-
return new Promise((resolve, _reject) => {
|
|
4053
|
-
if (this._disconnected) {
|
|
4054
|
-
resolve();
|
|
4055
|
-
}
|
|
4056
|
-
this.session.once("session.disconnected", () => {
|
|
4057
|
-
this.destroy();
|
|
4058
|
-
resolve();
|
|
4059
|
-
this._disconnected = true;
|
|
4060
|
-
});
|
|
4061
|
-
super.disconnect();
|
|
4062
|
-
});
|
|
4063
|
-
}
|
|
4064
|
-
async dial(params) {
|
|
4065
|
-
return new Promise(async (resolve, reject) => {
|
|
4066
|
-
var _a;
|
|
4067
|
-
try {
|
|
4068
|
-
(_a = getStorage()) == null ? void 0 : _a.removeItem(PREVIOUS_CALLID_STORAGE_KEY);
|
|
4069
|
-
const call = this.buildOutboundCall(params);
|
|
4070
|
-
resolve(call);
|
|
4071
|
-
} catch (error) {
|
|
4072
|
-
this.logger.error("Unable to connect and dial a call", error);
|
|
4073
|
-
reject(error);
|
|
4074
|
-
}
|
|
4075
|
-
});
|
|
4076
|
-
}
|
|
4077
|
-
async reattach(params) {
|
|
4078
|
-
return new Promise(async (resolve, reject) => {
|
|
4079
|
-
try {
|
|
4080
|
-
const call = this.buildOutboundCall(__spreadProps(__spreadValues({}, params), { attach: true }));
|
|
4081
|
-
resolve(call);
|
|
4082
|
-
} catch (error) {
|
|
4083
|
-
this.logger.error("Unable to connect and reattach a call", error);
|
|
4084
|
-
reject(error);
|
|
4085
|
-
}
|
|
4086
|
-
});
|
|
4087
|
-
}
|
|
4088
|
-
handlePushNotification(params) {
|
|
4089
|
-
const { incomingCallHandler } = params;
|
|
4090
|
-
this._incomingCallManager.setNotificationHandlers({
|
|
4091
|
-
pushNotification: incomingCallHandler
|
|
4092
|
-
});
|
|
4093
|
-
return new Promise(
|
|
4094
|
-
async (resolve, reject) => {
|
|
4095
|
-
const { decrypted, type } = params;
|
|
4096
|
-
if (type !== "call_invite") {
|
|
4097
|
-
this.logger.warn("Unknown notification type", params);
|
|
4098
|
-
reject("Unknown notification type");
|
|
4099
|
-
}
|
|
4100
|
-
this.logger.debug("handlePushNotification", params);
|
|
4101
|
-
const {
|
|
4102
|
-
params: { params: payload },
|
|
4103
|
-
node_id: nodeId
|
|
4104
|
-
} = decrypted;
|
|
4105
|
-
try {
|
|
4106
|
-
try {
|
|
4107
|
-
await this.executeVertoSubscribe(payload.callID, nodeId);
|
|
4108
|
-
} catch (error) {
|
|
4109
|
-
this.logger.warn("Verto Subscribe", error);
|
|
4110
|
-
}
|
|
4111
|
-
this._incomingCallManager.handleIncomingInvite(__spreadValues({
|
|
4112
|
-
source: "pushNotification",
|
|
4113
|
-
nodeId
|
|
4114
|
-
}, payload));
|
|
4115
|
-
resolve({ resultType: "inboundCall" });
|
|
4116
|
-
} catch (error) {
|
|
4117
|
-
reject(error);
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
);
|
|
4121
|
-
}
|
|
4122
|
-
updateToken(token) {
|
|
4123
|
-
return new Promise((resolve, reject) => {
|
|
4124
|
-
this.session.once("session.auth_error", (error) => {
|
|
4125
|
-
reject(error);
|
|
4126
|
-
});
|
|
4127
|
-
this.session.once("session.connected", () => {
|
|
4128
|
-
resolve();
|
|
4129
|
-
});
|
|
4130
|
-
this.store.dispatch(actions4.reauthAction({ token }));
|
|
4131
|
-
});
|
|
4132
|
-
}
|
|
4133
|
-
/**
|
|
4134
|
-
* Mark the client as 'online' to receive calls over WebSocket
|
|
4135
|
-
*/
|
|
4136
|
-
async online({ incomingCallHandlers }) {
|
|
4137
|
-
if (incomingCallHandlers.all || incomingCallHandlers.pushNotification) {
|
|
4138
|
-
this.logger.warn(
|
|
4139
|
-
`Make sure the device is not registered to receive Push Notifications while it is online`
|
|
4140
|
-
);
|
|
4141
|
-
}
|
|
4142
|
-
this._incomingCallManager.setNotificationHandlers(incomingCallHandlers);
|
|
4143
|
-
return this.execute({
|
|
4144
|
-
method: "subscriber.online",
|
|
4145
|
-
params: {}
|
|
4146
|
-
});
|
|
4147
|
-
}
|
|
4148
|
-
/**
|
|
4149
|
-
* Mark the client as 'offline' to receive calls over WebSocket
|
|
4150
|
-
*/
|
|
4151
|
-
offline() {
|
|
4152
|
-
this._incomingCallManager.setNotificationHandlers({});
|
|
4153
|
-
return this.execute({
|
|
4154
|
-
method: "subscriber.offline",
|
|
4155
|
-
params: {}
|
|
4156
|
-
});
|
|
4157
|
-
}
|
|
4158
|
-
/**
|
|
4159
|
-
* Initialize the session-level connection pool
|
|
4160
|
-
*/
|
|
4161
|
-
initializeSessionConnectionPool() {
|
|
4162
|
-
this.runWorker("sessionConnectionPoolWorker", {
|
|
4163
|
-
worker: sessionConnectionPoolWorker,
|
|
4164
|
-
initialState: {
|
|
4165
|
-
poolSize: 1,
|
|
4166
|
-
// Only one connection per session is required
|
|
4167
|
-
iceCandidatePoolSize: 10
|
|
4168
|
-
}
|
|
4169
|
-
});
|
|
4170
|
-
}
|
|
4171
|
-
};
|
|
4172
|
-
|
|
4173
|
-
// src/fabric/SignalWire.ts
|
|
4174
|
-
var SignalWire = /* @__PURE__ */ (() => {
|
|
4175
|
-
let instance = null;
|
|
4176
|
-
return (params) => {
|
|
4177
|
-
if (!instance) {
|
|
4178
|
-
instance = new Promise(async (resolve, reject) => {
|
|
4179
|
-
try {
|
|
4180
|
-
const options = __spreadValues({
|
|
4181
|
-
maxApiRequestRetries: DEFAULT_API_REQUEST_RETRIES,
|
|
4182
|
-
apiRequestRetriesDelay: DEFAULT_API_REQUEST_RETRIES_DELAY,
|
|
4183
|
-
apiRequestRetriesDelayIncrement: DEFAULT_API_REQUEST_RETRIES_DELAY_INCREMENT
|
|
4184
|
-
}, params);
|
|
4185
|
-
const wsClient = new WSClient(options);
|
|
4186
|
-
const httpClient = new HTTPClient(options);
|
|
4187
|
-
const conversationError = (method) => {
|
|
4188
|
-
return () => {
|
|
4189
|
-
throw new Error(
|
|
4190
|
-
`This version Conversation.${method} is unsupported by the backend. Use @signalwire/client instead.`
|
|
4191
|
-
);
|
|
4192
|
-
};
|
|
4193
|
-
};
|
|
4194
|
-
await wsClient.connect();
|
|
4195
|
-
resolve({
|
|
4196
|
-
registerDevice: httpClient.registerDevice.bind(httpClient),
|
|
4197
|
-
unregisterDevice: httpClient.unregisterDevice.bind(httpClient),
|
|
4198
|
-
getSubscriberInfo: httpClient.getSubscriberInfo.bind(httpClient),
|
|
4199
|
-
disconnect: async () => {
|
|
4200
|
-
await wsClient.disconnect();
|
|
4201
|
-
instance = null;
|
|
4202
|
-
},
|
|
4203
|
-
online: wsClient.online.bind(wsClient),
|
|
4204
|
-
offline: wsClient.offline.bind(wsClient),
|
|
4205
|
-
dial: wsClient.dial.bind(wsClient),
|
|
4206
|
-
reattach: wsClient.reattach.bind(wsClient),
|
|
4207
|
-
handlePushNotification: wsClient.handlePushNotification.bind(wsClient),
|
|
4208
|
-
updateToken: wsClient.updateToken.bind(wsClient),
|
|
4209
|
-
address: {
|
|
4210
|
-
getAddresses: httpClient.getAddresses.bind(httpClient),
|
|
4211
|
-
getAddress: httpClient.getAddress.bind(httpClient)
|
|
4212
|
-
},
|
|
4213
|
-
conversation: {
|
|
4214
|
-
getConversations: conversationError(
|
|
4215
|
-
"getConversations"
|
|
4216
|
-
),
|
|
4217
|
-
getMessages: conversationError(
|
|
4218
|
-
"getMessages"
|
|
4219
|
-
),
|
|
4220
|
-
getConversationMessages: conversationError(
|
|
4221
|
-
"getConversationMessages"
|
|
4222
|
-
),
|
|
4223
|
-
subscribe: conversationError(
|
|
4224
|
-
"subscribe"
|
|
4225
|
-
),
|
|
4226
|
-
sendMessage: conversationError(
|
|
4227
|
-
"sendMessage"
|
|
4228
|
-
),
|
|
4229
|
-
join: conversationError(
|
|
4230
|
-
"join"
|
|
4231
|
-
)
|
|
4232
|
-
},
|
|
4233
|
-
chat: {
|
|
4234
|
-
getMessages: conversationError(
|
|
4235
|
-
"getMessages"
|
|
4236
|
-
),
|
|
4237
|
-
subscribe: conversationError(
|
|
4238
|
-
"subscribe"
|
|
4239
|
-
),
|
|
4240
|
-
sendMessage: conversationError(
|
|
4241
|
-
"sendMessage"
|
|
4242
|
-
),
|
|
4243
|
-
join: conversationError(
|
|
4244
|
-
"join"
|
|
4245
|
-
)
|
|
4246
|
-
},
|
|
4247
|
-
// @ts-expect-error For debugging purposes
|
|
4248
|
-
on: wsClient.on.bind(wsClient),
|
|
4249
|
-
off: wsClient.off.bind(wsClient),
|
|
4250
|
-
__httpClient: httpClient,
|
|
4251
|
-
__wsClient: wsClient
|
|
4252
|
-
});
|
|
4253
|
-
} catch (error) {
|
|
4254
|
-
reject(error);
|
|
4255
|
-
}
|
|
4256
|
-
}).catch((error) => {
|
|
4257
|
-
instance = null;
|
|
4258
|
-
throw error;
|
|
4259
|
-
});
|
|
4260
|
-
}
|
|
4261
|
-
return instance;
|
|
4262
|
-
};
|
|
4263
|
-
})();
|
|
4264
|
-
|
|
4265
|
-
// src/video/index.ts
|
|
4266
|
-
var video_exports = {};
|
|
4267
|
-
__export(video_exports, {
|
|
4268
|
-
RoomSession: () => RoomSession,
|
|
4269
|
-
createClient: () => createClient,
|
|
4270
|
-
createRoomObject: () => createRoomObject,
|
|
4271
|
-
isVideoRoomSession: () => isVideoRoomSession,
|
|
4272
|
-
joinRoom: () => joinRoom
|
|
4273
|
-
});
|
|
4274
|
-
|
|
4275
|
-
// src/createRoomObject.ts
|
|
4276
|
-
import { getLogger as getLogger24 } from "@signalwire/core";
|
|
4277
|
-
var VIDEO_CONSTRAINTS = {
|
|
4278
|
-
aspectRatio: { ideal: 16 / 9 }
|
|
4279
|
-
};
|
|
4280
|
-
var createRoomObject = (roomOptions) => {
|
|
4281
|
-
return new Promise(async (resolve, reject) => {
|
|
4282
|
-
const _a = roomOptions, {
|
|
4283
|
-
audio = true,
|
|
4284
|
-
video = true,
|
|
4285
|
-
iceServers,
|
|
4286
|
-
rootElementId,
|
|
4287
|
-
applyLocalVideoOverlay = true,
|
|
4288
|
-
autoJoin = false,
|
|
4289
|
-
stopCameraWhileMuted = true,
|
|
4290
|
-
stopMicrophoneWhileMuted = true,
|
|
4291
|
-
speakerId
|
|
4292
|
-
} = _a, userOptions = __objRest(_a, [
|
|
4293
|
-
"audio",
|
|
4294
|
-
"video",
|
|
4295
|
-
"iceServers",
|
|
4296
|
-
"rootElementId",
|
|
4297
|
-
"applyLocalVideoOverlay",
|
|
4298
|
-
"autoJoin",
|
|
4299
|
-
"stopCameraWhileMuted",
|
|
4300
|
-
"stopMicrophoneWhileMuted",
|
|
4301
|
-
"speakerId"
|
|
4302
|
-
]);
|
|
4303
|
-
const client = createClient(__spreadValues({}, userOptions));
|
|
4304
|
-
await client.connect();
|
|
4305
|
-
if (!client) {
|
|
4306
|
-
return;
|
|
4307
|
-
}
|
|
4308
|
-
let rootElement;
|
|
4309
|
-
if (rootElementId) {
|
|
4310
|
-
const el = document.getElementById(rootElementId);
|
|
4311
|
-
if (el) {
|
|
4312
|
-
rootElement = el;
|
|
4313
|
-
} else {
|
|
4314
|
-
rootElement = document.body;
|
|
4315
|
-
getLogger24().warn(
|
|
4316
|
-
`We couldn't find an element with id: ${rootElementId}: using 'document.body' instead.`
|
|
4317
|
-
);
|
|
4318
|
-
}
|
|
4319
|
-
}
|
|
4320
|
-
const roomObject = client.rooms.makeRoomObject({
|
|
4321
|
-
audio,
|
|
4322
|
-
video: video === true ? VIDEO_CONSTRAINTS : video,
|
|
4323
|
-
negotiateAudio: true,
|
|
4324
|
-
negotiateVideo: true,
|
|
4325
|
-
iceServers,
|
|
4326
|
-
rootElement,
|
|
4327
|
-
applyLocalVideoOverlay,
|
|
4328
|
-
stopCameraWhileMuted,
|
|
4329
|
-
stopMicrophoneWhileMuted,
|
|
4330
|
-
speakerId
|
|
4331
|
-
});
|
|
4332
|
-
roomObject.once("destroy", () => {
|
|
4333
|
-
roomObject.emit("room.left");
|
|
4334
|
-
client.disconnect();
|
|
4335
|
-
});
|
|
4336
|
-
const join = () => {
|
|
4337
|
-
return new Promise(async (resolve2, reject2) => {
|
|
4338
|
-
try {
|
|
4339
|
-
roomObject.once("room.subscribed", (_payload) => {
|
|
4340
|
-
resolve2(roomObject);
|
|
4341
|
-
});
|
|
4342
|
-
await roomObject.join();
|
|
4343
|
-
} catch (error) {
|
|
4344
|
-
getLogger24().error("Join", error);
|
|
4345
|
-
client.disconnect();
|
|
4346
|
-
reject2(error);
|
|
4347
|
-
}
|
|
4348
|
-
});
|
|
4349
|
-
};
|
|
4350
|
-
const room = new Proxy(roomObject, {
|
|
4351
|
-
get(target, prop, receiver) {
|
|
4352
|
-
if (prop === "join") {
|
|
4353
|
-
return join;
|
|
4354
|
-
}
|
|
4355
|
-
return Reflect.get(target, prop, receiver);
|
|
4356
|
-
}
|
|
4357
|
-
});
|
|
4358
|
-
if (autoJoin) {
|
|
4359
|
-
try {
|
|
4360
|
-
await room.join();
|
|
4361
|
-
resolve(room);
|
|
4362
|
-
} catch (error) {
|
|
4363
|
-
reject(error);
|
|
4364
|
-
}
|
|
4365
|
-
} else {
|
|
4366
|
-
resolve(room);
|
|
4367
|
-
}
|
|
4368
|
-
});
|
|
4369
|
-
};
|
|
4370
|
-
|
|
4371
|
-
// src/joinRoom.ts
|
|
4372
|
-
var joinRoom = (roomOptions) => {
|
|
4373
|
-
return createRoomObject(__spreadProps(__spreadValues({}, roomOptions), {
|
|
4374
|
-
autoJoin: true
|
|
4375
|
-
}));
|
|
4376
|
-
};
|
|
4377
|
-
|
|
4378
|
-
// src/video/RoomSession.ts
|
|
4379
|
-
import {
|
|
4380
|
-
getLogger as getLogger25
|
|
4381
|
-
} from "@signalwire/core";
|
|
4382
|
-
var UNSAFE_PROP_ACCESS = [
|
|
4383
|
-
"audioMute",
|
|
4384
|
-
"audioUnmute",
|
|
4385
|
-
"deaf",
|
|
4386
|
-
"getLayouts",
|
|
4387
|
-
"getMembers",
|
|
4388
|
-
"getRecordings",
|
|
4389
|
-
"hideVideoMuted",
|
|
4390
|
-
"leave",
|
|
4391
|
-
"removerMember",
|
|
4392
|
-
"restoreOutboundAudio",
|
|
4393
|
-
"restoreOutboundVideo",
|
|
4394
|
-
"setInputSensitivity",
|
|
4395
|
-
"setInputVolume",
|
|
4396
|
-
"setLayout",
|
|
4397
|
-
"setPositions",
|
|
4398
|
-
"setMemberPosition",
|
|
4399
|
-
"setOutputVolume",
|
|
4400
|
-
"showVideoMuted",
|
|
4401
|
-
"startRecording",
|
|
4402
|
-
"stopOutboundAudio",
|
|
4403
|
-
"stopOutboundVideo",
|
|
4404
|
-
"undeaf",
|
|
4405
|
-
"videoMute",
|
|
4406
|
-
"videoUnmute",
|
|
4407
|
-
"setMicrophoneVolume",
|
|
4408
|
-
"setSpeakerVolume",
|
|
4409
|
-
"getMeta",
|
|
4410
|
-
"setMeta",
|
|
4411
|
-
"updateMeta",
|
|
4412
|
-
"deleteMeta",
|
|
4413
|
-
"getMemberMeta",
|
|
4414
|
-
"setMemberMeta",
|
|
4415
|
-
"updateMemberMeta",
|
|
4416
|
-
"deleteMemberMeta",
|
|
4417
|
-
"promote",
|
|
4418
|
-
"demote",
|
|
4419
|
-
"lock",
|
|
4420
|
-
"unlock"
|
|
4421
|
-
];
|
|
4422
|
-
var REQUIRED_EVENTS = [
|
|
4423
|
-
"member.joined",
|
|
4424
|
-
"layout.changed"
|
|
4425
|
-
];
|
|
4426
|
-
var noop2 = () => {
|
|
4427
|
-
};
|
|
4428
|
-
var RoomSession = function(roomOptions) {
|
|
4429
|
-
const _a = roomOptions, {
|
|
4430
|
-
audio: audioFromConstructor = true,
|
|
4431
|
-
video: videoFromConstructor = true,
|
|
4432
|
-
iceServers,
|
|
4433
|
-
rootElement,
|
|
4434
|
-
applyLocalVideoOverlay = true,
|
|
4435
|
-
mirrorLocalVideoOverlay = false,
|
|
4436
|
-
stopCameraWhileMuted = true,
|
|
4437
|
-
stopMicrophoneWhileMuted = true,
|
|
4438
|
-
speakerId,
|
|
4439
|
-
destinationNumber,
|
|
4440
|
-
localStream,
|
|
4441
|
-
watchMediaPackets,
|
|
4442
|
-
watchMediaPacketsTimeout,
|
|
4443
|
-
disableUdpIceServers = false
|
|
4444
|
-
} = _a, userOptions = __objRest(_a, [
|
|
4445
|
-
"audio",
|
|
4446
|
-
"video",
|
|
4447
|
-
"iceServers",
|
|
4448
|
-
"rootElement",
|
|
4449
|
-
"applyLocalVideoOverlay",
|
|
4450
|
-
"mirrorLocalVideoOverlay",
|
|
4451
|
-
"stopCameraWhileMuted",
|
|
4452
|
-
"stopMicrophoneWhileMuted",
|
|
4453
|
-
"speakerId",
|
|
4454
|
-
"destinationNumber",
|
|
4455
|
-
"localStream",
|
|
4456
|
-
"watchMediaPackets",
|
|
4457
|
-
"watchMediaPacketsTimeout",
|
|
4458
|
-
"disableUdpIceServers"
|
|
4459
|
-
]);
|
|
4460
|
-
const deprecatedParams = ["audio", "video"];
|
|
4461
|
-
deprecatedParams.forEach((param) => {
|
|
4462
|
-
if (param in roomOptions) {
|
|
4463
|
-
getLogger25().warn(
|
|
4464
|
-
`The '${param}' parameter on the RoomSession constructor is deprecated. Set it on the '.join()' function instead.`
|
|
4465
|
-
);
|
|
4466
|
-
}
|
|
4467
|
-
});
|
|
4468
|
-
const allowReattach = (roomOptions == null ? void 0 : roomOptions.reattach) !== false;
|
|
4469
|
-
const { callIdKey } = sessionStorageManager(userOptions.token);
|
|
4470
|
-
const reattachManager = {
|
|
4471
|
-
joined: ({ call_id }) => {
|
|
4472
|
-
var _a2;
|
|
4473
|
-
if (allowReattach && callIdKey) {
|
|
4474
|
-
(_a2 = getStorage()) == null ? void 0 : _a2.setItem(callIdKey, call_id);
|
|
4475
|
-
}
|
|
4476
|
-
},
|
|
4477
|
-
init: () => {
|
|
4478
|
-
if (allowReattach) {
|
|
4479
|
-
room.on("room.subscribed", reattachManager.joined);
|
|
4480
|
-
}
|
|
4481
|
-
room.options.prevCallId = reattachManager.getPrevCallId();
|
|
4482
|
-
},
|
|
4483
|
-
destroy: () => {
|
|
4484
|
-
var _a2;
|
|
4485
|
-
if (!allowReattach) {
|
|
4486
|
-
return;
|
|
4487
|
-
}
|
|
4488
|
-
room.off("room.subscribed", reattachManager.joined);
|
|
4489
|
-
if (callIdKey) {
|
|
4490
|
-
(_a2 = getStorage()) == null ? void 0 : _a2.removeItem(callIdKey);
|
|
4491
|
-
}
|
|
4492
|
-
},
|
|
4493
|
-
getPrevCallId: () => {
|
|
4494
|
-
var _a2, _b;
|
|
4495
|
-
if (!allowReattach || !callIdKey) {
|
|
4496
|
-
return;
|
|
4497
|
-
}
|
|
4498
|
-
return (_b = (_a2 = getStorage()) == null ? void 0 : _a2.getItem(callIdKey)) != null ? _b : void 0;
|
|
4499
|
-
}
|
|
4500
|
-
};
|
|
4501
|
-
const client = createClient(userOptions);
|
|
4502
|
-
const room = client.rooms.makeRoomObject({
|
|
4503
|
-
// audio,
|
|
4504
|
-
// video: video === true ? VIDEO_CONSTRAINTS : video,
|
|
4505
|
-
negotiateAudio: true,
|
|
4506
|
-
negotiateVideo: true,
|
|
4507
|
-
iceServers,
|
|
4508
|
-
rootElement,
|
|
4509
|
-
applyLocalVideoOverlay,
|
|
4510
|
-
mirrorLocalVideoOverlay,
|
|
4511
|
-
stopCameraWhileMuted,
|
|
4512
|
-
stopMicrophoneWhileMuted,
|
|
4513
|
-
speakerId,
|
|
4514
|
-
destinationNumber,
|
|
4515
|
-
localStream,
|
|
4516
|
-
watchMediaPackets,
|
|
4517
|
-
watchMediaPacketsTimeout,
|
|
4518
|
-
prevCallId: reattachManager.getPrevCallId(),
|
|
4519
|
-
disableUdpIceServers
|
|
4520
|
-
});
|
|
4521
|
-
room.once("destroy", () => {
|
|
4522
|
-
room.emit("room.left", { reason: room.leaveReason });
|
|
4523
|
-
reattachManager.destroy();
|
|
4524
|
-
client.disconnect();
|
|
4525
|
-
});
|
|
4526
|
-
client.session.once("session.disconnected", () => {
|
|
4527
|
-
room.destroy();
|
|
4528
|
-
});
|
|
4529
|
-
const join = (params) => {
|
|
4530
|
-
return new Promise(async (resolve, reject) => {
|
|
4531
|
-
var _a2, _b;
|
|
4532
|
-
try {
|
|
4533
|
-
room.attachPreConnectWorkers();
|
|
4534
|
-
await client.connect();
|
|
4535
|
-
const audio = (_a2 = params == null ? void 0 : params.audio) != null ? _a2 : audioFromConstructor;
|
|
4536
|
-
const video = (_b = params == null ? void 0 : params.video) != null ? _b : videoFromConstructor;
|
|
4537
|
-
const authorization = client._sessionAuthorization;
|
|
4538
|
-
getLogger25().debug("getJoinMediaParams authorization?", authorization);
|
|
4539
|
-
if (authorization && authorization.type === "video") {
|
|
4540
|
-
const mediaOptions = getJoinMediaParams(__spreadValues({
|
|
4541
|
-
authorization,
|
|
4542
|
-
// constructor values override the send
|
|
4543
|
-
sendAudio: Boolean(audio),
|
|
4544
|
-
sendVideo: Boolean(video)
|
|
4545
|
-
}, params));
|
|
4546
|
-
if (!checkMediaParams(mediaOptions)) {
|
|
4547
|
-
client.disconnect();
|
|
4548
|
-
return reject(
|
|
4549
|
-
new Error(
|
|
4550
|
-
`Invalid arguments to join the room. The token used has join_as: '${authorization.join_as}'.
|
|
4551
|
-
${JSON.stringify(params, null, 2)}
|
|
4552
|
-
`
|
|
4553
|
-
)
|
|
4554
|
-
);
|
|
4555
|
-
}
|
|
4556
|
-
getLogger25().debug("Set mediaOptions", mediaOptions);
|
|
4557
|
-
room.updateMediaOptions({
|
|
4558
|
-
audio: mediaOptions.mustSendAudio ? audio || true : false,
|
|
4559
|
-
video: mediaOptions.mustSendVideo ? video || true : false,
|
|
4560
|
-
negotiateAudio: mediaOptions.mustRecvAudio,
|
|
4561
|
-
negotiateVideo: mediaOptions.mustRecvVideo
|
|
4562
|
-
});
|
|
4563
|
-
}
|
|
4564
|
-
room.once("room.subscribed", () => {
|
|
4565
|
-
resolve(room);
|
|
4566
|
-
});
|
|
4567
|
-
reattachManager.init();
|
|
4568
|
-
REQUIRED_EVENTS.forEach((event) => room.once(event, noop2));
|
|
4569
|
-
await room.join();
|
|
4570
|
-
} catch (error) {
|
|
4571
|
-
getLogger25().error("RoomSession Join", error);
|
|
4572
|
-
client.disconnect();
|
|
4573
|
-
reject(error);
|
|
4574
|
-
}
|
|
4575
|
-
});
|
|
4576
|
-
};
|
|
4577
|
-
const interceptors = {
|
|
4578
|
-
join
|
|
4579
|
-
};
|
|
4580
|
-
return new Proxy(room, {
|
|
4581
|
-
get(target, prop, receiver) {
|
|
4582
|
-
if (prop in interceptors) {
|
|
4583
|
-
return interceptors[prop];
|
|
4584
|
-
}
|
|
4585
|
-
if (!target.active && UNSAFE_PROP_ACCESS.includes(prop)) {
|
|
4586
|
-
throw new Error(
|
|
4587
|
-
`Tried to access the property/method "${prop}" before the room was connected. Please call roomSession.join() first.`
|
|
4588
|
-
);
|
|
4589
|
-
}
|
|
4590
|
-
return Reflect.get(target, prop, receiver);
|
|
4591
|
-
}
|
|
4592
|
-
});
|
|
4593
|
-
};
|
|
4594
|
-
|
|
4595
|
-
// src/webrtc.ts
|
|
4596
|
-
var webrtc_exports = {};
|
|
4597
|
-
__export(webrtc_exports, {
|
|
4598
|
-
checkCameraPermissions: () => checkCameraPermissions,
|
|
4599
|
-
checkMicrophonePermissions: () => checkMicrophonePermissions,
|
|
4600
|
-
checkPermissions: () => checkPermissions,
|
|
4601
|
-
checkSpeakerPermissions: () => checkSpeakerPermissions,
|
|
4602
|
-
createCameraDeviceWatcher: () => createCameraDeviceWatcher,
|
|
4603
|
-
createDeviceWatcher: () => createDeviceWatcher,
|
|
4604
|
-
createMicrophoneAnalyzer: () => createMicrophoneAnalyzer,
|
|
4605
|
-
createMicrophoneDeviceWatcher: () => createMicrophoneDeviceWatcher,
|
|
4606
|
-
createSpeakerDeviceWatcher: () => createSpeakerDeviceWatcher2,
|
|
4607
|
-
enumerateDevices: () => enumerateDevices,
|
|
4608
|
-
enumerateDevicesByKind: () => enumerateDevicesByKind,
|
|
4609
|
-
getCameraDevices: () => getCameraDevices,
|
|
4610
|
-
getCameraDevicesWithPermissions: () => getCameraDevicesWithPermissions,
|
|
4611
|
-
getDevices: () => getDevices,
|
|
4612
|
-
getDevicesWithPermissions: () => getDevicesWithPermissions,
|
|
4613
|
-
getDisplayMedia: () => getDisplayMedia2,
|
|
4614
|
-
getMicrophoneDevices: () => getMicrophoneDevices,
|
|
4615
|
-
getMicrophoneDevicesWithPermissions: () => getMicrophoneDevicesWithPermissions,
|
|
4616
|
-
getSpeakerDevices: () => getSpeakerDevices,
|
|
4617
|
-
getSpeakerDevicesWithPermissions: () => getSpeakerDevicesWithPermissions,
|
|
4618
|
-
getSupportedConstraints: () => getSupportedConstraints,
|
|
4619
|
-
getUserMedia: () => getUserMedia,
|
|
4620
|
-
requestPermissions: () => requestPermissions,
|
|
4621
|
-
setMediaElementSinkId: () => setMediaElementSinkId2,
|
|
4622
|
-
stopStream: () => stopStream,
|
|
4623
|
-
stopTrack: () => stopTrack,
|
|
4624
|
-
supportsGetDisplayMedia: () => supportsGetDisplayMedia,
|
|
4625
|
-
supportsGetUserMedia: () => supportsGetUserMedia,
|
|
4626
|
-
supportsMediaDevices: () => supportsMediaDevices,
|
|
4627
|
-
supportsMediaOutput: () => supportsMediaOutput2
|
|
4628
|
-
});
|
|
4629
|
-
import {
|
|
4630
|
-
getDevices,
|
|
4631
|
-
getCameraDevices,
|
|
4632
|
-
getMicrophoneDevices,
|
|
4633
|
-
getSpeakerDevices,
|
|
4634
|
-
getDevicesWithPermissions,
|
|
4635
|
-
getCameraDevicesWithPermissions,
|
|
4636
|
-
getMicrophoneDevicesWithPermissions,
|
|
4637
|
-
getSpeakerDevicesWithPermissions,
|
|
4638
|
-
checkPermissions,
|
|
4639
|
-
checkCameraPermissions,
|
|
4640
|
-
checkMicrophonePermissions,
|
|
4641
|
-
checkSpeakerPermissions,
|
|
4642
|
-
requestPermissions,
|
|
4643
|
-
createDeviceWatcher,
|
|
4644
|
-
createCameraDeviceWatcher,
|
|
4645
|
-
createMicrophoneDeviceWatcher,
|
|
4646
|
-
createSpeakerDeviceWatcher as createSpeakerDeviceWatcher2,
|
|
4647
|
-
supportsMediaDevices,
|
|
4648
|
-
supportsGetUserMedia,
|
|
4649
|
-
supportsGetDisplayMedia,
|
|
4650
|
-
getUserMedia,
|
|
4651
|
-
getDisplayMedia as getDisplayMedia2,
|
|
4652
|
-
enumerateDevices,
|
|
4653
|
-
enumerateDevicesByKind,
|
|
4654
|
-
getSupportedConstraints,
|
|
4655
|
-
supportsMediaOutput as supportsMediaOutput2,
|
|
4656
|
-
setMediaElementSinkId as setMediaElementSinkId2,
|
|
4657
|
-
stopStream,
|
|
4658
|
-
stopTrack,
|
|
4659
|
-
createMicrophoneAnalyzer
|
|
4660
|
-
} from "@signalwire/webrtc";
|
|
4661
|
-
export {
|
|
4662
|
-
chat_exports as Chat,
|
|
4663
|
-
fabric_exports as Fabric,
|
|
4664
|
-
LocalVideoOverlay,
|
|
4665
|
-
pubSub_exports as PubSub,
|
|
4666
|
-
SignalWire,
|
|
4667
|
-
UserOverlay,
|
|
4668
|
-
video_exports as Video,
|
|
4669
|
-
webrtc_exports as WebRTC,
|
|
4670
|
-
buildVideoElement,
|
|
4671
|
-
isFabricRoomSession
|
|
4672
|
-
};
|
|
4673
|
-
//# sourceMappingURL=index.esm.js.map
|