@whereby.com/core 1.2.9 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +180 -6
- package/dist/index.d.cts +26 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +181 -7
- package/dist/legacy-esm.js +181 -7
- package/dist/redux/index.cjs +161 -7
- package/dist/redux/index.d.cts +154 -1
- package/dist/redux/index.d.mts +154 -1
- package/dist/redux/index.d.ts +154 -1
- package/dist/redux/index.js +160 -8
- package/dist/redux/index.mjs +160 -8
- package/package.json +10 -2
package/dist/redux/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createAsyncThunk, createListenerMiddleware, addListener, createSlice, createAction, createSelector, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import nodeBtoa from 'btoa';
|
|
5
5
|
import axios from 'axios';
|
|
@@ -73,9 +73,9 @@ const createReactor = (selectors, callback) => {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const coreVersion = "1.
|
|
76
|
+
const coreVersion = "1.3.0";
|
|
77
77
|
|
|
78
|
-
const initialState = {
|
|
78
|
+
const initialState$1 = {
|
|
79
79
|
isNodeSdk: false,
|
|
80
80
|
isActive: false,
|
|
81
81
|
isDialIn: false,
|
|
@@ -89,7 +89,7 @@ const initialState = {
|
|
|
89
89
|
};
|
|
90
90
|
const appSlice = createSlice({
|
|
91
91
|
name: "app",
|
|
92
|
-
initialState,
|
|
92
|
+
initialState: initialState$1,
|
|
93
93
|
reducers: {
|
|
94
94
|
doAppStart: (state, action) => {
|
|
95
95
|
const url = new URL(action.payload.roomUrl);
|
|
@@ -590,6 +590,12 @@ const localMediaSlice = createSlice({
|
|
|
590
590
|
builder.addCase(doSwitchLocalStream.rejected, (state) => {
|
|
591
591
|
return Object.assign(Object.assign({}, state), { isSwitchingStream: false });
|
|
592
592
|
});
|
|
593
|
+
builder.addCase(doLocalStreamEffect.fulfilled, (state, { payload }) => {
|
|
594
|
+
if (!payload) {
|
|
595
|
+
return state;
|
|
596
|
+
}
|
|
597
|
+
return Object.assign(Object.assign({}, state), { beforeEffectTracks: Object.assign(Object.assign({}, state.beforeEffectTracks), payload.beforeEffectTracks) });
|
|
598
|
+
});
|
|
593
599
|
},
|
|
594
600
|
});
|
|
595
601
|
const { deviceBusy, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, setLocalMediaOptions, setLocalMediaStream, localMediaStopped, localStreamMetadataUpdated, } = localMediaSlice.actions;
|
|
@@ -719,6 +725,15 @@ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream"
|
|
|
719
725
|
if (!replaceStream) {
|
|
720
726
|
return;
|
|
721
727
|
}
|
|
728
|
+
const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
|
|
729
|
+
if (audioId !== undefined && (beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks.audio)) {
|
|
730
|
+
beforeEffectTracks.audio.stop();
|
|
731
|
+
beforeEffectTracks.audio = undefined;
|
|
732
|
+
}
|
|
733
|
+
if (videoId !== undefined && (beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks.video)) {
|
|
734
|
+
beforeEffectTracks.video.stop();
|
|
735
|
+
beforeEffectTracks.video = undefined;
|
|
736
|
+
}
|
|
722
737
|
try {
|
|
723
738
|
const { replacedTracks } = yield getStream(Object.assign(Object.assign({}, constraintsOptions), { audioId: audioId === undefined ? false : audioId, videoId: videoId === undefined ? false : videoId, type: "exact" }), { replaceStream });
|
|
724
739
|
const deviceId = audioId || videoId;
|
|
@@ -727,7 +742,7 @@ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream"
|
|
|
727
742
|
deviceId,
|
|
728
743
|
}));
|
|
729
744
|
}
|
|
730
|
-
return { replacedTracks };
|
|
745
|
+
return { replacedTracks, beforeEffectTracks };
|
|
731
746
|
}
|
|
732
747
|
catch (error) {
|
|
733
748
|
console.error(error);
|
|
@@ -778,6 +793,46 @@ const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
|
|
|
778
793
|
}
|
|
779
794
|
dispatch(localMediaStopped());
|
|
780
795
|
});
|
|
796
|
+
const doLocalStreamEffect = createAppAsyncThunk("localMedia/doLocalStreamEffect", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ effectStream, only, stopBeforeTrack, }, { getState }) {
|
|
797
|
+
var _c;
|
|
798
|
+
const state = getState();
|
|
799
|
+
let beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
|
|
800
|
+
const beforeTrack = beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks[only];
|
|
801
|
+
if (!effectStream && !beforeTrack)
|
|
802
|
+
return;
|
|
803
|
+
try {
|
|
804
|
+
const stream = selectLocalMediaStream(state);
|
|
805
|
+
let replacedTracks = null;
|
|
806
|
+
if (!stream) {
|
|
807
|
+
throw new Error("No local media stream");
|
|
808
|
+
}
|
|
809
|
+
if (effectStream) {
|
|
810
|
+
if (!beforeTrack) {
|
|
811
|
+
beforeEffectTracks = {
|
|
812
|
+
[only]: (_c = (only === "audio" ? stream === null || stream === void 0 ? void 0 : stream.getAudioTracks() : stream === null || stream === void 0 ? void 0 : stream.getVideoTracks())) === null || _c === void 0 ? void 0 : _c[0],
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
replacedTracks = replaceTracksInStream(stream, effectStream, only);
|
|
816
|
+
}
|
|
817
|
+
else if (!stopBeforeTrack) {
|
|
818
|
+
replacedTracks = replaceTracksInStream(stream, beforeTrack ? new MediaStream([beforeTrack]) : new MediaStream(), only);
|
|
819
|
+
beforeEffectTracks = {
|
|
820
|
+
[only]: undefined,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
else if (beforeTrack) {
|
|
824
|
+
beforeEffectTracks = {
|
|
825
|
+
[only]: undefined,
|
|
826
|
+
};
|
|
827
|
+
beforeTrack.stop();
|
|
828
|
+
}
|
|
829
|
+
return { effectStream, beforeEffectTracks, replacedTracks };
|
|
830
|
+
}
|
|
831
|
+
catch (error) {
|
|
832
|
+
console.error("Error applying local stream effect", error);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
}));
|
|
781
836
|
const selectBusyDeviceIds = (state) => state.localMedia.busyDeviceIds;
|
|
782
837
|
const selectCameraDeviceError = (state) => state.localMedia.cameraDeviceError;
|
|
783
838
|
const selectCurrentCameraDeviceId = (state) => state.localMedia.currentCameraDeviceId;
|
|
@@ -798,6 +853,7 @@ const selectLocalMediaStream = (state) => state.localMedia.stream;
|
|
|
798
853
|
const selectMicrophoneDeviceError = (state) => state.localMedia.microphoneDeviceError;
|
|
799
854
|
const selectLocalMediaStartError = (state) => state.localMedia.startError;
|
|
800
855
|
const selectLocalMediaIsSwitchingStream = (state) => state.localMedia.isSwitchingStream;
|
|
856
|
+
const selectLocalMediaBeforeEffectTracks = (state) => state.localMedia.beforeEffectTracks;
|
|
801
857
|
const selectLocalMediaConstraintsOptions = createSelector(selectLocalMediaDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectIsLowDataModeEnabled, (devices, videoId, audioId, lowDataMode) => ({
|
|
802
858
|
devices,
|
|
803
859
|
videoId,
|
|
@@ -894,7 +950,7 @@ startAppListening({
|
|
|
894
950
|
},
|
|
895
951
|
});
|
|
896
952
|
startAppListening({
|
|
897
|
-
matcher: isAnyOf(doStartLocalMedia.fulfilled, doUpdateDeviceList.fulfilled, doSwitchLocalStream.fulfilled, doSwitchLocalStream.rejected),
|
|
953
|
+
matcher: isAnyOf(doStartLocalMedia.fulfilled, doUpdateDeviceList.fulfilled, doSwitchLocalStream.fulfilled, doSwitchLocalStream.rejected, doLocalStreamEffect.fulfilled),
|
|
898
954
|
effect: (_action, { dispatch, getState }) => {
|
|
899
955
|
const state = getState();
|
|
900
956
|
const stream = selectLocalMediaStream(state);
|
|
@@ -1958,7 +2014,7 @@ startAppListening({
|
|
|
1958
2014
|
},
|
|
1959
2015
|
});
|
|
1960
2016
|
startAppListening({
|
|
1961
|
-
|
|
2017
|
+
matcher: isAnyOf(doSwitchLocalStream.fulfilled, doLocalStreamEffect.fulfilled),
|
|
1962
2018
|
effect: ({ payload }, { getState }) => {
|
|
1963
2019
|
var _a;
|
|
1964
2020
|
const stream = selectLocalMediaStream(getState());
|
|
@@ -2986,11 +3042,107 @@ const doRejectWaitingParticipant = createRoomConnectedThunk((payload) => (dispat
|
|
|
2986
3042
|
const selectWaitingParticipantsRaw = (state) => state.waitingParticipants;
|
|
2987
3043
|
const selectWaitingParticipants = (state) => state.waitingParticipants.waitingParticipants;
|
|
2988
3044
|
|
|
3045
|
+
const initialState = {
|
|
3046
|
+
isSwitching: false,
|
|
3047
|
+
raw: {},
|
|
3048
|
+
};
|
|
3049
|
+
const cameraEffectsSlice = createSlice({
|
|
3050
|
+
name: "cameraEffects",
|
|
3051
|
+
initialState,
|
|
3052
|
+
reducers: {
|
|
3053
|
+
cameraEffectsSwitching(state, action) {
|
|
3054
|
+
state.isSwitching = action.payload.isSwitching;
|
|
3055
|
+
},
|
|
3056
|
+
cameraEffectsCleared(state) {
|
|
3057
|
+
state.currentEffectId = null;
|
|
3058
|
+
state.setup = undefined;
|
|
3059
|
+
state.params = undefined;
|
|
3060
|
+
state.raw = {};
|
|
3061
|
+
state.error = undefined;
|
|
3062
|
+
state.isSwitching = false;
|
|
3063
|
+
},
|
|
3064
|
+
cameraEffectsUpdated(state, action) {
|
|
3065
|
+
const { effectId, setup, params, raw } = action.payload;
|
|
3066
|
+
state.currentEffectId = effectId;
|
|
3067
|
+
state.setup = setup;
|
|
3068
|
+
state.params = params;
|
|
3069
|
+
if (raw)
|
|
3070
|
+
state.raw = raw;
|
|
3071
|
+
state.error = undefined;
|
|
3072
|
+
state.isSwitching = false;
|
|
3073
|
+
},
|
|
3074
|
+
cameraEffectsError(state, action) {
|
|
3075
|
+
state.error = action.payload.error;
|
|
3076
|
+
state.isSwitching = false;
|
|
3077
|
+
},
|
|
3078
|
+
},
|
|
3079
|
+
});
|
|
3080
|
+
const { cameraEffectsSwitching, cameraEffectsCleared, cameraEffectsUpdated, cameraEffectsError } = cameraEffectsSlice.actions;
|
|
3081
|
+
const selectCameraEffectsRaw = (state) => state.cameraEffects.raw;
|
|
3082
|
+
const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPreset", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ effectId, setup, params, allowSafari, }, { getState, dispatch, rejectWithValue }) {
|
|
3083
|
+
var _c, _d, _e;
|
|
3084
|
+
const state = getState();
|
|
3085
|
+
if (selectLocalMediaIsSwitchingStream(state)) {
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
dispatch(cameraEffectsSwitching({ isSwitching: true }));
|
|
3089
|
+
try {
|
|
3090
|
+
const raw = selectCameraEffectsRaw(state);
|
|
3091
|
+
const localStream = selectLocalMediaStream(state);
|
|
3092
|
+
if (!((_c = localStream === null || localStream === void 0 ? void 0 : localStream.getVideoTracks()) === null || _c === void 0 ? void 0 : _c[0])) {
|
|
3093
|
+
dispatch(cameraEffectsCleared());
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3096
|
+
if (!effectId) {
|
|
3097
|
+
if (raw.effectStream) {
|
|
3098
|
+
yield dispatch(doLocalStreamEffect({ effectStream: undefined, only: "video" }));
|
|
3099
|
+
}
|
|
3100
|
+
(_d = raw.stop) === null || _d === void 0 ? void 0 : _d.call(raw);
|
|
3101
|
+
dispatch(cameraEffectsCleared());
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
if (raw.tryUpdate) {
|
|
3105
|
+
const ok = yield raw.tryUpdate(effectId, Object.assign({}, (setup || {})), Object.assign({}, (params || {})));
|
|
3106
|
+
if (ok) {
|
|
3107
|
+
dispatch(cameraEffectsUpdated({ effectId, setup, params }));
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
if (raw.effectStream) {
|
|
3112
|
+
yield dispatch(doLocalStreamEffect({ effectStream: undefined, only: "video" }));
|
|
3113
|
+
(_e = raw.stop) === null || _e === void 0 ? void 0 : _e.call(raw);
|
|
3114
|
+
}
|
|
3115
|
+
let mod;
|
|
3116
|
+
try {
|
|
3117
|
+
mod = yield import('@whereby.com/camera-effects');
|
|
3118
|
+
}
|
|
3119
|
+
catch (_f) {
|
|
3120
|
+
throw new Error("@whereby.com/camera-effects is not installed. Add it as a dependency to enable camera effects.");
|
|
3121
|
+
}
|
|
3122
|
+
const { createEffectStream, getUsablePresets } = mod;
|
|
3123
|
+
const usable = getUsablePresets({ filter: () => true, options: { allowSafari } });
|
|
3124
|
+
if (!usable.includes(effectId)) {
|
|
3125
|
+
throw new Error(`Unknown or unsupported effect preset: ${effectId}`);
|
|
3126
|
+
}
|
|
3127
|
+
const { stream: effectStream, stop, tryUpdate, } = yield createEffectStream(localStream, effectId, setup, params);
|
|
3128
|
+
yield dispatch(doLocalStreamEffect({ effectStream, only: "video" }));
|
|
3129
|
+
dispatch(cameraEffectsUpdated({ effectId, setup, params, raw: { stop, tryUpdate, effectStream } }));
|
|
3130
|
+
}
|
|
3131
|
+
catch (error) {
|
|
3132
|
+
dispatch(cameraEffectsError({ error }));
|
|
3133
|
+
return rejectWithValue(error);
|
|
3134
|
+
}
|
|
3135
|
+
}));
|
|
3136
|
+
createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
|
|
3137
|
+
yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
|
|
3138
|
+
}));
|
|
3139
|
+
|
|
2989
3140
|
const IS_DEV = undefined === "true";
|
|
2990
3141
|
const appReducer = combineReducers({
|
|
2991
3142
|
app: appSlice.reducer,
|
|
2992
3143
|
authorization: authorizationSlice.reducer,
|
|
2993
3144
|
breakout: breakoutSlice.reducer,
|
|
3145
|
+
cameraEffects: cameraEffectsSlice.reducer,
|
|
2994
3146
|
chat: chatSlice.reducer,
|
|
2995
3147
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
2996
3148
|
connectionMonitor: connectionMonitorSlice.reducer,
|
|
@@ -3768,4 +3920,4 @@ function createServices() {
|
|
|
3768
3920
|
};
|
|
3769
3921
|
}
|
|
3770
3922
|
|
|
3771
|
-
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doToggleLowDataMode, doUpdateDeviceList, initialCloudRecordingState, initialLocalMediaState, initialNotificationsState, initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
|
3923
|
+
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doToggleLowDataMode, doUpdateDeviceList, initialCloudRecordingState, initialLocalMediaState, initialNotificationsState, initialState$1 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
package/dist/redux/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createAsyncThunk, createListenerMiddleware, addListener, createSlice, createAction, createSelector, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
import nodeBtoa from 'btoa';
|
|
5
5
|
import axios from 'axios';
|
|
@@ -73,9 +73,9 @@ const createReactor = (selectors, callback) => {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const coreVersion = "1.
|
|
76
|
+
const coreVersion = "1.3.0";
|
|
77
77
|
|
|
78
|
-
const initialState = {
|
|
78
|
+
const initialState$1 = {
|
|
79
79
|
isNodeSdk: false,
|
|
80
80
|
isActive: false,
|
|
81
81
|
isDialIn: false,
|
|
@@ -89,7 +89,7 @@ const initialState = {
|
|
|
89
89
|
};
|
|
90
90
|
const appSlice = createSlice({
|
|
91
91
|
name: "app",
|
|
92
|
-
initialState,
|
|
92
|
+
initialState: initialState$1,
|
|
93
93
|
reducers: {
|
|
94
94
|
doAppStart: (state, action) => {
|
|
95
95
|
const url = new URL(action.payload.roomUrl);
|
|
@@ -590,6 +590,12 @@ const localMediaSlice = createSlice({
|
|
|
590
590
|
builder.addCase(doSwitchLocalStream.rejected, (state) => {
|
|
591
591
|
return Object.assign(Object.assign({}, state), { isSwitchingStream: false });
|
|
592
592
|
});
|
|
593
|
+
builder.addCase(doLocalStreamEffect.fulfilled, (state, { payload }) => {
|
|
594
|
+
if (!payload) {
|
|
595
|
+
return state;
|
|
596
|
+
}
|
|
597
|
+
return Object.assign(Object.assign({}, state), { beforeEffectTracks: Object.assign(Object.assign({}, state.beforeEffectTracks), payload.beforeEffectTracks) });
|
|
598
|
+
});
|
|
593
599
|
},
|
|
594
600
|
});
|
|
595
601
|
const { deviceBusy, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, setLocalMediaOptions, setLocalMediaStream, localMediaStopped, localStreamMetadataUpdated, } = localMediaSlice.actions;
|
|
@@ -719,6 +725,15 @@ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream"
|
|
|
719
725
|
if (!replaceStream) {
|
|
720
726
|
return;
|
|
721
727
|
}
|
|
728
|
+
const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
|
|
729
|
+
if (audioId !== undefined && (beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks.audio)) {
|
|
730
|
+
beforeEffectTracks.audio.stop();
|
|
731
|
+
beforeEffectTracks.audio = undefined;
|
|
732
|
+
}
|
|
733
|
+
if (videoId !== undefined && (beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks.video)) {
|
|
734
|
+
beforeEffectTracks.video.stop();
|
|
735
|
+
beforeEffectTracks.video = undefined;
|
|
736
|
+
}
|
|
722
737
|
try {
|
|
723
738
|
const { replacedTracks } = yield getStream(Object.assign(Object.assign({}, constraintsOptions), { audioId: audioId === undefined ? false : audioId, videoId: videoId === undefined ? false : videoId, type: "exact" }), { replaceStream });
|
|
724
739
|
const deviceId = audioId || videoId;
|
|
@@ -727,7 +742,7 @@ const doSwitchLocalStream = createAppAsyncThunk("localMedia/doSwitchLocalStream"
|
|
|
727
742
|
deviceId,
|
|
728
743
|
}));
|
|
729
744
|
}
|
|
730
|
-
return { replacedTracks };
|
|
745
|
+
return { replacedTracks, beforeEffectTracks };
|
|
731
746
|
}
|
|
732
747
|
catch (error) {
|
|
733
748
|
console.error(error);
|
|
@@ -778,6 +793,46 @@ const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
|
|
|
778
793
|
}
|
|
779
794
|
dispatch(localMediaStopped());
|
|
780
795
|
});
|
|
796
|
+
const doLocalStreamEffect = createAppAsyncThunk("localMedia/doLocalStreamEffect", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ effectStream, only, stopBeforeTrack, }, { getState }) {
|
|
797
|
+
var _c;
|
|
798
|
+
const state = getState();
|
|
799
|
+
let beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
|
|
800
|
+
const beforeTrack = beforeEffectTracks === null || beforeEffectTracks === void 0 ? void 0 : beforeEffectTracks[only];
|
|
801
|
+
if (!effectStream && !beforeTrack)
|
|
802
|
+
return;
|
|
803
|
+
try {
|
|
804
|
+
const stream = selectLocalMediaStream(state);
|
|
805
|
+
let replacedTracks = null;
|
|
806
|
+
if (!stream) {
|
|
807
|
+
throw new Error("No local media stream");
|
|
808
|
+
}
|
|
809
|
+
if (effectStream) {
|
|
810
|
+
if (!beforeTrack) {
|
|
811
|
+
beforeEffectTracks = {
|
|
812
|
+
[only]: (_c = (only === "audio" ? stream === null || stream === void 0 ? void 0 : stream.getAudioTracks() : stream === null || stream === void 0 ? void 0 : stream.getVideoTracks())) === null || _c === void 0 ? void 0 : _c[0],
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
replacedTracks = replaceTracksInStream(stream, effectStream, only);
|
|
816
|
+
}
|
|
817
|
+
else if (!stopBeforeTrack) {
|
|
818
|
+
replacedTracks = replaceTracksInStream(stream, beforeTrack ? new MediaStream([beforeTrack]) : new MediaStream(), only);
|
|
819
|
+
beforeEffectTracks = {
|
|
820
|
+
[only]: undefined,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
else if (beforeTrack) {
|
|
824
|
+
beforeEffectTracks = {
|
|
825
|
+
[only]: undefined,
|
|
826
|
+
};
|
|
827
|
+
beforeTrack.stop();
|
|
828
|
+
}
|
|
829
|
+
return { effectStream, beforeEffectTracks, replacedTracks };
|
|
830
|
+
}
|
|
831
|
+
catch (error) {
|
|
832
|
+
console.error("Error applying local stream effect", error);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
}));
|
|
781
836
|
const selectBusyDeviceIds = (state) => state.localMedia.busyDeviceIds;
|
|
782
837
|
const selectCameraDeviceError = (state) => state.localMedia.cameraDeviceError;
|
|
783
838
|
const selectCurrentCameraDeviceId = (state) => state.localMedia.currentCameraDeviceId;
|
|
@@ -798,6 +853,7 @@ const selectLocalMediaStream = (state) => state.localMedia.stream;
|
|
|
798
853
|
const selectMicrophoneDeviceError = (state) => state.localMedia.microphoneDeviceError;
|
|
799
854
|
const selectLocalMediaStartError = (state) => state.localMedia.startError;
|
|
800
855
|
const selectLocalMediaIsSwitchingStream = (state) => state.localMedia.isSwitchingStream;
|
|
856
|
+
const selectLocalMediaBeforeEffectTracks = (state) => state.localMedia.beforeEffectTracks;
|
|
801
857
|
const selectLocalMediaConstraintsOptions = createSelector(selectLocalMediaDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectIsLowDataModeEnabled, (devices, videoId, audioId, lowDataMode) => ({
|
|
802
858
|
devices,
|
|
803
859
|
videoId,
|
|
@@ -894,7 +950,7 @@ startAppListening({
|
|
|
894
950
|
},
|
|
895
951
|
});
|
|
896
952
|
startAppListening({
|
|
897
|
-
matcher: isAnyOf(doStartLocalMedia.fulfilled, doUpdateDeviceList.fulfilled, doSwitchLocalStream.fulfilled, doSwitchLocalStream.rejected),
|
|
953
|
+
matcher: isAnyOf(doStartLocalMedia.fulfilled, doUpdateDeviceList.fulfilled, doSwitchLocalStream.fulfilled, doSwitchLocalStream.rejected, doLocalStreamEffect.fulfilled),
|
|
898
954
|
effect: (_action, { dispatch, getState }) => {
|
|
899
955
|
const state = getState();
|
|
900
956
|
const stream = selectLocalMediaStream(state);
|
|
@@ -1958,7 +2014,7 @@ startAppListening({
|
|
|
1958
2014
|
},
|
|
1959
2015
|
});
|
|
1960
2016
|
startAppListening({
|
|
1961
|
-
|
|
2017
|
+
matcher: isAnyOf(doSwitchLocalStream.fulfilled, doLocalStreamEffect.fulfilled),
|
|
1962
2018
|
effect: ({ payload }, { getState }) => {
|
|
1963
2019
|
var _a;
|
|
1964
2020
|
const stream = selectLocalMediaStream(getState());
|
|
@@ -2986,11 +3042,107 @@ const doRejectWaitingParticipant = createRoomConnectedThunk((payload) => (dispat
|
|
|
2986
3042
|
const selectWaitingParticipantsRaw = (state) => state.waitingParticipants;
|
|
2987
3043
|
const selectWaitingParticipants = (state) => state.waitingParticipants.waitingParticipants;
|
|
2988
3044
|
|
|
3045
|
+
const initialState = {
|
|
3046
|
+
isSwitching: false,
|
|
3047
|
+
raw: {},
|
|
3048
|
+
};
|
|
3049
|
+
const cameraEffectsSlice = createSlice({
|
|
3050
|
+
name: "cameraEffects",
|
|
3051
|
+
initialState,
|
|
3052
|
+
reducers: {
|
|
3053
|
+
cameraEffectsSwitching(state, action) {
|
|
3054
|
+
state.isSwitching = action.payload.isSwitching;
|
|
3055
|
+
},
|
|
3056
|
+
cameraEffectsCleared(state) {
|
|
3057
|
+
state.currentEffectId = null;
|
|
3058
|
+
state.setup = undefined;
|
|
3059
|
+
state.params = undefined;
|
|
3060
|
+
state.raw = {};
|
|
3061
|
+
state.error = undefined;
|
|
3062
|
+
state.isSwitching = false;
|
|
3063
|
+
},
|
|
3064
|
+
cameraEffectsUpdated(state, action) {
|
|
3065
|
+
const { effectId, setup, params, raw } = action.payload;
|
|
3066
|
+
state.currentEffectId = effectId;
|
|
3067
|
+
state.setup = setup;
|
|
3068
|
+
state.params = params;
|
|
3069
|
+
if (raw)
|
|
3070
|
+
state.raw = raw;
|
|
3071
|
+
state.error = undefined;
|
|
3072
|
+
state.isSwitching = false;
|
|
3073
|
+
},
|
|
3074
|
+
cameraEffectsError(state, action) {
|
|
3075
|
+
state.error = action.payload.error;
|
|
3076
|
+
state.isSwitching = false;
|
|
3077
|
+
},
|
|
3078
|
+
},
|
|
3079
|
+
});
|
|
3080
|
+
const { cameraEffectsSwitching, cameraEffectsCleared, cameraEffectsUpdated, cameraEffectsError } = cameraEffectsSlice.actions;
|
|
3081
|
+
const selectCameraEffectsRaw = (state) => state.cameraEffects.raw;
|
|
3082
|
+
const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPreset", (_a, _b) => __awaiter(void 0, [_a, _b], void 0, function* ({ effectId, setup, params, allowSafari, }, { getState, dispatch, rejectWithValue }) {
|
|
3083
|
+
var _c, _d, _e;
|
|
3084
|
+
const state = getState();
|
|
3085
|
+
if (selectLocalMediaIsSwitchingStream(state)) {
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
dispatch(cameraEffectsSwitching({ isSwitching: true }));
|
|
3089
|
+
try {
|
|
3090
|
+
const raw = selectCameraEffectsRaw(state);
|
|
3091
|
+
const localStream = selectLocalMediaStream(state);
|
|
3092
|
+
if (!((_c = localStream === null || localStream === void 0 ? void 0 : localStream.getVideoTracks()) === null || _c === void 0 ? void 0 : _c[0])) {
|
|
3093
|
+
dispatch(cameraEffectsCleared());
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3096
|
+
if (!effectId) {
|
|
3097
|
+
if (raw.effectStream) {
|
|
3098
|
+
yield dispatch(doLocalStreamEffect({ effectStream: undefined, only: "video" }));
|
|
3099
|
+
}
|
|
3100
|
+
(_d = raw.stop) === null || _d === void 0 ? void 0 : _d.call(raw);
|
|
3101
|
+
dispatch(cameraEffectsCleared());
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
if (raw.tryUpdate) {
|
|
3105
|
+
const ok = yield raw.tryUpdate(effectId, Object.assign({}, (setup || {})), Object.assign({}, (params || {})));
|
|
3106
|
+
if (ok) {
|
|
3107
|
+
dispatch(cameraEffectsUpdated({ effectId, setup, params }));
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
if (raw.effectStream) {
|
|
3112
|
+
yield dispatch(doLocalStreamEffect({ effectStream: undefined, only: "video" }));
|
|
3113
|
+
(_e = raw.stop) === null || _e === void 0 ? void 0 : _e.call(raw);
|
|
3114
|
+
}
|
|
3115
|
+
let mod;
|
|
3116
|
+
try {
|
|
3117
|
+
mod = yield import('@whereby.com/camera-effects');
|
|
3118
|
+
}
|
|
3119
|
+
catch (_f) {
|
|
3120
|
+
throw new Error("@whereby.com/camera-effects is not installed. Add it as a dependency to enable camera effects.");
|
|
3121
|
+
}
|
|
3122
|
+
const { createEffectStream, getUsablePresets } = mod;
|
|
3123
|
+
const usable = getUsablePresets({ filter: () => true, options: { allowSafari } });
|
|
3124
|
+
if (!usable.includes(effectId)) {
|
|
3125
|
+
throw new Error(`Unknown or unsupported effect preset: ${effectId}`);
|
|
3126
|
+
}
|
|
3127
|
+
const { stream: effectStream, stop, tryUpdate, } = yield createEffectStream(localStream, effectId, setup, params);
|
|
3128
|
+
yield dispatch(doLocalStreamEffect({ effectStream, only: "video" }));
|
|
3129
|
+
dispatch(cameraEffectsUpdated({ effectId, setup, params, raw: { stop, tryUpdate, effectStream } }));
|
|
3130
|
+
}
|
|
3131
|
+
catch (error) {
|
|
3132
|
+
dispatch(cameraEffectsError({ error }));
|
|
3133
|
+
return rejectWithValue(error);
|
|
3134
|
+
}
|
|
3135
|
+
}));
|
|
3136
|
+
createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
|
|
3137
|
+
yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
|
|
3138
|
+
}));
|
|
3139
|
+
|
|
2989
3140
|
const IS_DEV = undefined === "true";
|
|
2990
3141
|
const appReducer = combineReducers({
|
|
2991
3142
|
app: appSlice.reducer,
|
|
2992
3143
|
authorization: authorizationSlice.reducer,
|
|
2993
3144
|
breakout: breakoutSlice.reducer,
|
|
3145
|
+
cameraEffects: cameraEffectsSlice.reducer,
|
|
2994
3146
|
chat: chatSlice.reducer,
|
|
2995
3147
|
cloudRecording: cloudRecordingSlice.reducer,
|
|
2996
3148
|
connectionMonitor: connectionMonitorSlice.reducer,
|
|
@@ -3768,4 +3920,4 @@ function createServices() {
|
|
|
3768
3920
|
};
|
|
3769
3921
|
}
|
|
3770
3922
|
|
|
3771
|
-
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doToggleLowDataMode, doUpdateDeviceList, initialCloudRecordingState, initialLocalMediaState, initialNotificationsState, initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
|
3923
|
+
export { addAppListener, addSpotlight, appSlice, authorizationSlice, authorizationSliceInitialState, breakoutSlice, breakoutSliceInitialState, chatSlice, chatSliceInitialState, cloudRecordingSlice, connectionMonitorSlice, connectionMonitorSliceInitialState, connectionMonitorStarted, connectionMonitorStopped, createAppAsyncThunk, createAppAuthorizedThunk, createAppThunk, createAsyncRoomConnectedThunk, createAuthorizedRoomConnectedThunk, createReactor, createRemoteParticipant, createRoomConnectedThunk, createServices, createStore, createWebRtcEmitter, deviceBusy, deviceCredentialsSlice, deviceCredentialsSliceInitialState, deviceIdentified, deviceIdentifying, doAcceptWaitingParticipant, doAppStart, doAppStop, doBreakoutJoin, doClearNotifications, doConnectRoom, doConnectRtc, doDisconnectRtc, doEnableAudio, doEnableVideo, doEndMeeting, doGetDeviceCredentials, doHandleAcceptStreams, doHandleStreamingStarted, doHandleStreamingStopped, doKickParticipant, doKnockRoom, doLocalStreamEffect, doLockRoom, doOrganizationFetch, doRejectWaitingParticipant, doRemoveSpotlight, doRequestAudioEnable, doRequestVideoEnable, doRtcAnalyticsCustomEventsInitialize, doRtcManagerCreated, doRtcManagerInitialize, doRtcReportStreamResolution, doSendChatMessage, doSendClientMetadata, doSetDevice, doSetDisplayName, doSetLocalStickyReaction, doSetNotification, doSignalConnect, doSignalDisconnect, doSignalIdentifyDevice, doSpotlightParticipant, doStartCloudRecording, doStartConnectionMonitor, doStartLocalMedia, doStartScreenshare, doStopCloudRecording, doStopConnectionMonitor, doStopLocalMedia, doStopScreenshare, doSwitchLocalStream, doToggleCamera, doToggleLowDataMode, doUpdateDeviceList, initialCloudRecordingState, initialLocalMediaState, initialNotificationsState, initialState$1 as initialState, isAcceptingStreams, isClientSpotlighted, listenerMiddleware, localMediaSlice, localMediaStopped, localParticipantSlice, localParticipantSliceInitialState, localScreenshareSlice, localScreenshareSliceInitialState, localStreamMetadataUpdated, notificationsSlice, observeStore, organizationSlice, organizationSliceInitialState, participantStreamAdded, participantStreamIdAdded, recordingRequestStarted, remoteParticipantsSlice, remoteParticipantsSliceInitialState, removeSpotlight, resolutionReported, roomConnectionSlice, roomConnectionSliceInitialState, roomSlice, roomSliceInitialState, rootReducer, rtcAnalyticsCustomEvents, rtcAnalyticsSlice, rtcAnalyticsSliceInitialState, rtcClientConnectionStatusChanged, rtcConnectionSlice, rtcConnectionSliceInitialState, rtcDisconnected, rtcDispatcherCreated, rtcEvents, rtcManagerCreated, rtcManagerDestroyed, rtcManagerInitialized, selectAllClientViews, selectAllClientViewsInCurrentGroup, selectAppDisplayName, selectAppExternalId, selectAppIgnoreBreakoutGroups, selectAppInitialConfig, selectAppIsActive, selectAppIsAssistant, selectAppIsDialIn, selectAppIsNodeSdk, selectAppRaw, selectAppRoomName, selectAppRoomUrl, selectAppUserAgent, selectAssistantKey, selectAuthorizationRoleName, selectBreakoutActive, selectBreakoutAssignments, selectBreakoutCurrentGroup, selectBreakoutCurrentId, selectBreakoutGroupedParticipants, selectBreakoutGroups, selectBreakoutInitiatedBy, selectBreakoutRaw, selectBusyDeviceIds, selectCameraDeviceError, selectCameraDevices, selectChatMessages, selectChatRaw, selectCloudRecordingError, selectCloudRecordingIsInitiator, selectCloudRecordingRaw, selectCloudRecordingStartedAt, selectCloudRecordingStatus, selectConnectionMonitorIsRunning, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectCurrentSpeakerDeviceId, selectDeviceCredentialsRaw, selectDeviceId, selectHasFetchedDeviceCredentials, selectIsAcceptingStreams, selectIsAuthorizedToAskToSpeak, selectIsAuthorizedToEndMeeting, selectIsAuthorizedToKickClient, selectIsAuthorizedToLockRoom, selectIsAuthorizedToRequestAudioEnable, selectIsAuthorizedToRequestVideoEnable, selectIsAuthorizedToSpotlight, selectIsCameraEnabled, selectIsCloudRecording, selectIsLocalMediaStarting, selectIsLocalParticipantSpotlighted, selectIsLowDataModeEnabled, selectIsMicrophoneEnabled, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsToggleCamera, selectLocalMediaBeforeEffectTracks, selectLocalMediaConstraintsOptions, selectLocalMediaDevices, selectLocalMediaIsSwitchingStream, selectLocalMediaOptions, selectLocalMediaOwnsStream, selectLocalMediaRaw, selectLocalMediaShouldStartWithOptions, selectLocalMediaShouldStop, selectLocalMediaStartError, selectLocalMediaStatus, selectLocalMediaStream, selectLocalParticipantBreakoutAssigned, selectLocalParticipantBreakoutGroup, selectLocalParticipantClientClaim, selectLocalParticipantDisplayName, selectLocalParticipantIsScreenSharing, selectLocalParticipantRaw, selectLocalParticipantStickyReaction, selectLocalParticipantView, selectLocalScreenshareRaw, selectLocalScreenshareStatus, selectLocalScreenshareStream, selectMicrophoneDeviceError, selectMicrophoneDevices, selectNotificationsEmitter, selectNotificationsEvents, selectNotificationsRaw, selectNumClients, selectNumParticipants, selectOrganizationId, selectOrganizationPreferences, selectOrganizationRaw, selectRemoteClientViews, selectRemoteClients, selectRemoteParticipants, selectRemoteParticipantsRaw, selectRoomConnectionError, selectRoomConnectionRaw, selectRoomConnectionSession, selectRoomConnectionSessionId, selectRoomConnectionStatus, selectRoomIsLocked, selectRoomKey, selectRtcConnectionRaw, selectRtcDispatcherCreated, selectRtcIsCreatingDispatcher, selectRtcManager, selectRtcManagerInitialized, selectRtcStatus, selectScreenshares, selectSelfId, selectShouldConnectRoom, selectShouldConnectRtc, selectShouldConnectSignal, selectShouldDisconnectRtc, selectShouldFetchDeviceCredentials, selectShouldFetchOrganization, selectShouldIdentifyDevice, selectShouldInitializeRtc, selectShouldStartConnectionMonitor, selectShouldStopConnectionMonitor, selectSignalConnectionDeviceIdentified, selectSignalConnectionRaw, selectSignalConnectionSocket, selectSignalIsIdentifyingDevice, selectSignalStatus, selectSpeakerDevices, selectSpotlightedClientViews, selectSpotlights, selectSpotlightsRaw, selectStopCallbackFunction, selectStreamingRaw, selectStreamsToAccept, selectWaitingParticipants, selectWaitingParticipantsRaw, setBreakoutGroupAssigned, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, setDisplayName, setLocalMediaOptions, setLocalMediaStream, setRoomKey, signalConnectionSlice, signalConnectionSliceInitialState, signalEvents, socketConnected, socketConnecting, socketDisconnected, socketReconnecting, spotlightsSlice, spotlightsSliceInitialState, startAppListening, stopScreenshare, streamIdForClient, streamStatusUpdated, streamingSlice, streamingSliceInitialState, toggleCameraEnabled, toggleLowDataModeEnabled, toggleMicrophoneEnabled, updateReportedValues, waitingParticipantsSlice, waitingParticipantsSliceInitialState };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@whereby.com/core",
|
|
3
3
|
"description": "Core library for whereby.com sdk",
|
|
4
4
|
"author": "Whereby AS",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.3.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@whereby.com/eslint-config": "0.1.0",
|
|
62
62
|
"@whereby.com/jest-config": "0.1.0",
|
|
63
63
|
"@whereby.com/prettier-config": "0.1.0",
|
|
64
|
-
"@whereby.com/rollup-config": "0.1.
|
|
64
|
+
"@whereby.com/rollup-config": "0.1.1",
|
|
65
65
|
"@whereby.com/tsconfig": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
@@ -71,6 +71,14 @@
|
|
|
71
71
|
"btoa": "^1.2.1",
|
|
72
72
|
"events": "^3.3.0"
|
|
73
73
|
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@whereby.com/camera-effects": "*"
|
|
76
|
+
},
|
|
77
|
+
"peerDependenciesMeta": {
|
|
78
|
+
"@whereby.com/camera-effects": {
|
|
79
|
+
"optional": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
74
82
|
"prettier": "@whereby.com/prettier-config",
|
|
75
83
|
"scripts": {
|
|
76
84
|
"clean": "rimraf dist node_modules .turbo",
|