@whereby.com/core 1.6.1 → 1.6.3
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 +12 -16
- package/dist/index.mjs +13 -17
- package/dist/legacy-esm.js +13 -17
- package/dist/redux/index.cjs +12 -16
- package/dist/redux/index.js +13 -17
- package/dist/redux/index.mjs +13 -17
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1158,7 +1158,7 @@ const createReactor = (selectors, callback) => {
|
|
|
1158
1158
|
});
|
|
1159
1159
|
};
|
|
1160
1160
|
|
|
1161
|
-
const coreVersion = "1.6.
|
|
1161
|
+
const coreVersion = "1.6.3";
|
|
1162
1162
|
|
|
1163
1163
|
const initialState$1 = {
|
|
1164
1164
|
displayName: null,
|
|
@@ -2745,7 +2745,7 @@ const selectBreakoutGroupedParticipants = toolkit.createSelector(selectAllClient
|
|
|
2745
2745
|
|
|
2746
2746
|
function streamIdForClient({ isPresentation, stream }) {
|
|
2747
2747
|
var _a, _b;
|
|
2748
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
2748
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : media.CAMERA_STREAM_ID;
|
|
2749
2749
|
}
|
|
2750
2750
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
2751
2751
|
return !!spotlights.find((s) => {
|
|
@@ -2820,7 +2820,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
2820
2820
|
}
|
|
2821
2821
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2822
2822
|
const streamId = streamIdForClient(clientView);
|
|
2823
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2823
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : media.CAMERA_STREAM_ID };
|
|
2824
2824
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
2825
2825
|
});
|
|
2826
2826
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -2831,7 +2831,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
2831
2831
|
}
|
|
2832
2832
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2833
2833
|
const streamId = streamIdForClient(clientView);
|
|
2834
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2834
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : media.CAMERA_STREAM_ID };
|
|
2835
2835
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
2836
2836
|
});
|
|
2837
2837
|
const selectSpotlights = (state) => state.spotlights.sorted;
|
|
@@ -3004,7 +3004,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
3004
3004
|
dispatch(rtcDisconnected());
|
|
3005
3005
|
});
|
|
3006
3006
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
3007
|
-
var _a;
|
|
3008
3007
|
dispatch(isAcceptingStreams(true));
|
|
3009
3008
|
const state = getState();
|
|
3010
3009
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -3012,8 +3011,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3012
3011
|
if (!rtcManager) {
|
|
3013
3012
|
throw new Error("No rtc manager");
|
|
3014
3013
|
}
|
|
3015
|
-
const
|
|
3016
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
3014
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
3017
3015
|
const updates = [];
|
|
3018
3016
|
for (const { clientId, streamId, state } of payload) {
|
|
3019
3017
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -3023,15 +3021,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3023
3021
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
3024
3022
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
3025
3023
|
rtcManager.acceptNewStream({
|
|
3026
|
-
streamId: streamId ===
|
|
3024
|
+
streamId: streamId === media.CAMERA_STREAM_ID ? clientId : streamId,
|
|
3027
3025
|
clientId,
|
|
3028
|
-
shouldAddLocalVideo: streamId === "0",
|
|
3029
|
-
activeBreakout,
|
|
3030
3026
|
});
|
|
3031
3027
|
}
|
|
3032
3028
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
3033
3029
|
else if (state === "to_unaccept") {
|
|
3034
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
3030
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === media.CAMERA_STREAM_ID ? clientId : streamId);
|
|
3035
3031
|
}
|
|
3036
3032
|
else if (state !== "done_accept") {
|
|
3037
3033
|
continue;
|
|
@@ -3064,7 +3060,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
3064
3060
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
3065
3061
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3066
3062
|
if (localMediaStream && rtcManager) {
|
|
3067
|
-
rtcManager.addNewStream(
|
|
3063
|
+
rtcManager.addNewStream(media.CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3068
3064
|
}
|
|
3069
3065
|
dispatch(rtcManagerInitialized());
|
|
3070
3066
|
});
|
|
@@ -3147,7 +3143,7 @@ startAppListening({
|
|
|
3147
3143
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3148
3144
|
const { stream } = payload;
|
|
3149
3145
|
if (stream) {
|
|
3150
|
-
rtcManager.addNewStream(
|
|
3146
|
+
rtcManager.addNewStream(media.CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3151
3147
|
}
|
|
3152
3148
|
},
|
|
3153
3149
|
});
|
|
@@ -3191,11 +3187,11 @@ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemo
|
|
|
3191
3187
|
const upd = [];
|
|
3192
3188
|
for (const client of remoteParticipants) {
|
|
3193
3189
|
const { streams, id: clientId, newJoiner } = client;
|
|
3194
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
3190
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === media.CAMERA_STREAM_ID);
|
|
3195
3191
|
for (let i = 0; i < streams.length; i++) {
|
|
3196
3192
|
let streamId = streams[i].id;
|
|
3197
3193
|
let state = streams[i].state;
|
|
3198
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
3194
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === media.CAMERA_STREAM_ID) {
|
|
3199
3195
|
if (i === 0) {
|
|
3200
3196
|
streamId = streams[1].id;
|
|
3201
3197
|
state = streams[1].state;
|
|
@@ -3214,7 +3210,7 @@ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemo
|
|
|
3214
3210
|
upd.push({
|
|
3215
3211
|
clientId,
|
|
3216
3212
|
streamId,
|
|
3217
|
-
state: `${newJoiner && streamId ===
|
|
3213
|
+
state: `${newJoiner && streamId === media.CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
3218
3214
|
});
|
|
3219
3215
|
}
|
|
3220
3216
|
else {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nodeBtoa from 'btoa';
|
|
2
|
-
import { assert, fromLocation, ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, RtcManagerDispatcher, setClientProvider, subscribeIssues } from '@whereby.com/media';
|
|
2
|
+
import { assert, fromLocation, ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues } from '@whereby.com/media';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { createListenerMiddleware, createSlice, createAction, createSelector, createAsyncThunk, isAnyOf, combineReducers, configureStore, addListener } from '@reduxjs/toolkit';
|
|
@@ -1156,7 +1156,7 @@ const createReactor = (selectors, callback) => {
|
|
|
1156
1156
|
});
|
|
1157
1157
|
};
|
|
1158
1158
|
|
|
1159
|
-
const coreVersion = "1.6.
|
|
1159
|
+
const coreVersion = "1.6.3";
|
|
1160
1160
|
|
|
1161
1161
|
const initialState$1 = {
|
|
1162
1162
|
displayName: null,
|
|
@@ -2743,7 +2743,7 @@ const selectBreakoutGroupedParticipants = createSelector(selectAllClientViews, s
|
|
|
2743
2743
|
|
|
2744
2744
|
function streamIdForClient({ isPresentation, stream }) {
|
|
2745
2745
|
var _a, _b;
|
|
2746
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
2746
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : CAMERA_STREAM_ID;
|
|
2747
2747
|
}
|
|
2748
2748
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
2749
2749
|
return !!spotlights.find((s) => {
|
|
@@ -2818,7 +2818,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
2818
2818
|
}
|
|
2819
2819
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2820
2820
|
const streamId = streamIdForClient(clientView);
|
|
2821
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2821
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
2822
2822
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
2823
2823
|
});
|
|
2824
2824
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -2829,7 +2829,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
2829
2829
|
}
|
|
2830
2830
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2831
2831
|
const streamId = streamIdForClient(clientView);
|
|
2832
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2832
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
2833
2833
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
2834
2834
|
});
|
|
2835
2835
|
const selectSpotlights = (state) => state.spotlights.sorted;
|
|
@@ -3002,7 +3002,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
3002
3002
|
dispatch(rtcDisconnected());
|
|
3003
3003
|
});
|
|
3004
3004
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
3005
|
-
var _a;
|
|
3006
3005
|
dispatch(isAcceptingStreams(true));
|
|
3007
3006
|
const state = getState();
|
|
3008
3007
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -3010,8 +3009,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3010
3009
|
if (!rtcManager) {
|
|
3011
3010
|
throw new Error("No rtc manager");
|
|
3012
3011
|
}
|
|
3013
|
-
const
|
|
3014
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
3012
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
3015
3013
|
const updates = [];
|
|
3016
3014
|
for (const { clientId, streamId, state } of payload) {
|
|
3017
3015
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -3021,15 +3019,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3021
3019
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
3022
3020
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
3023
3021
|
rtcManager.acceptNewStream({
|
|
3024
|
-
streamId: streamId ===
|
|
3022
|
+
streamId: streamId === CAMERA_STREAM_ID ? clientId : streamId,
|
|
3025
3023
|
clientId,
|
|
3026
|
-
shouldAddLocalVideo: streamId === "0",
|
|
3027
|
-
activeBreakout,
|
|
3028
3024
|
});
|
|
3029
3025
|
}
|
|
3030
3026
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
3031
3027
|
else if (state === "to_unaccept") {
|
|
3032
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
3028
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === CAMERA_STREAM_ID ? clientId : streamId);
|
|
3033
3029
|
}
|
|
3034
3030
|
else if (state !== "done_accept") {
|
|
3035
3031
|
continue;
|
|
@@ -3062,7 +3058,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
3062
3058
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
3063
3059
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3064
3060
|
if (localMediaStream && rtcManager) {
|
|
3065
|
-
rtcManager.addNewStream(
|
|
3061
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3066
3062
|
}
|
|
3067
3063
|
dispatch(rtcManagerInitialized());
|
|
3068
3064
|
});
|
|
@@ -3145,7 +3141,7 @@ startAppListening({
|
|
|
3145
3141
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3146
3142
|
const { stream } = payload;
|
|
3147
3143
|
if (stream) {
|
|
3148
|
-
rtcManager.addNewStream(
|
|
3144
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3149
3145
|
}
|
|
3150
3146
|
},
|
|
3151
3147
|
});
|
|
@@ -3189,11 +3185,11 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
3189
3185
|
const upd = [];
|
|
3190
3186
|
for (const client of remoteParticipants) {
|
|
3191
3187
|
const { streams, id: clientId, newJoiner } = client;
|
|
3192
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
3188
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === CAMERA_STREAM_ID);
|
|
3193
3189
|
for (let i = 0; i < streams.length; i++) {
|
|
3194
3190
|
let streamId = streams[i].id;
|
|
3195
3191
|
let state = streams[i].state;
|
|
3196
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
3192
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === CAMERA_STREAM_ID) {
|
|
3197
3193
|
if (i === 0) {
|
|
3198
3194
|
streamId = streams[1].id;
|
|
3199
3195
|
state = streams[1].state;
|
|
@@ -3212,7 +3208,7 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
3212
3208
|
upd.push({
|
|
3213
3209
|
clientId,
|
|
3214
3210
|
streamId,
|
|
3215
|
-
state: `${newJoiner && streamId ===
|
|
3211
|
+
state: `${newJoiner && streamId === CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
3216
3212
|
});
|
|
3217
3213
|
}
|
|
3218
3214
|
else {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import nodeBtoa from 'btoa';
|
|
2
|
-
import { assert, fromLocation, ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, RtcManagerDispatcher, setClientProvider, subscribeIssues } from '@whereby.com/media';
|
|
2
|
+
import { assert, fromLocation, ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, RtcManagerDispatcher, setClientProvider, subscribeIssues } from '@whereby.com/media';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { createListenerMiddleware, createSlice, createAction, createSelector, createAsyncThunk, isAnyOf, combineReducers, configureStore, addListener } from '@reduxjs/toolkit';
|
|
@@ -1156,7 +1156,7 @@ const createReactor = (selectors, callback) => {
|
|
|
1156
1156
|
});
|
|
1157
1157
|
};
|
|
1158
1158
|
|
|
1159
|
-
const coreVersion = "1.6.
|
|
1159
|
+
const coreVersion = "1.6.3";
|
|
1160
1160
|
|
|
1161
1161
|
const initialState$1 = {
|
|
1162
1162
|
displayName: null,
|
|
@@ -2743,7 +2743,7 @@ const selectBreakoutGroupedParticipants = createSelector(selectAllClientViews, s
|
|
|
2743
2743
|
|
|
2744
2744
|
function streamIdForClient({ isPresentation, stream }) {
|
|
2745
2745
|
var _a, _b;
|
|
2746
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
2746
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : CAMERA_STREAM_ID;
|
|
2747
2747
|
}
|
|
2748
2748
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
2749
2749
|
return !!spotlights.find((s) => {
|
|
@@ -2818,7 +2818,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
2818
2818
|
}
|
|
2819
2819
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2820
2820
|
const streamId = streamIdForClient(clientView);
|
|
2821
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2821
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
2822
2822
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
2823
2823
|
});
|
|
2824
2824
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -2829,7 +2829,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
2829
2829
|
}
|
|
2830
2830
|
const { socket } = selectSignalConnectionRaw(state);
|
|
2831
2831
|
const streamId = streamIdForClient(clientView);
|
|
2832
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
2832
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
2833
2833
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
2834
2834
|
});
|
|
2835
2835
|
const selectSpotlights = (state) => state.spotlights.sorted;
|
|
@@ -3002,7 +3002,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
3002
3002
|
dispatch(rtcDisconnected());
|
|
3003
3003
|
});
|
|
3004
3004
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
3005
|
-
var _a;
|
|
3006
3005
|
dispatch(isAcceptingStreams(true));
|
|
3007
3006
|
const state = getState();
|
|
3008
3007
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -3010,8 +3009,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3010
3009
|
if (!rtcManager) {
|
|
3011
3010
|
throw new Error("No rtc manager");
|
|
3012
3011
|
}
|
|
3013
|
-
const
|
|
3014
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
3012
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
3015
3013
|
const updates = [];
|
|
3016
3014
|
for (const { clientId, streamId, state } of payload) {
|
|
3017
3015
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -3021,15 +3019,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
3021
3019
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
3022
3020
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
3023
3021
|
rtcManager.acceptNewStream({
|
|
3024
|
-
streamId: streamId ===
|
|
3022
|
+
streamId: streamId === CAMERA_STREAM_ID ? clientId : streamId,
|
|
3025
3023
|
clientId,
|
|
3026
|
-
shouldAddLocalVideo: streamId === "0",
|
|
3027
|
-
activeBreakout,
|
|
3028
3024
|
});
|
|
3029
3025
|
}
|
|
3030
3026
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
3031
3027
|
else if (state === "to_unaccept") {
|
|
3032
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
3028
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === CAMERA_STREAM_ID ? clientId : streamId);
|
|
3033
3029
|
}
|
|
3034
3030
|
else if (state !== "done_accept") {
|
|
3035
3031
|
continue;
|
|
@@ -3062,7 +3058,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
3062
3058
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
3063
3059
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3064
3060
|
if (localMediaStream && rtcManager) {
|
|
3065
|
-
rtcManager.addNewStream(
|
|
3061
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3066
3062
|
}
|
|
3067
3063
|
dispatch(rtcManagerInitialized());
|
|
3068
3064
|
});
|
|
@@ -3145,7 +3141,7 @@ startAppListening({
|
|
|
3145
3141
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
3146
3142
|
const { stream } = payload;
|
|
3147
3143
|
if (stream) {
|
|
3148
|
-
rtcManager.addNewStream(
|
|
3144
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
3149
3145
|
}
|
|
3150
3146
|
},
|
|
3151
3147
|
});
|
|
@@ -3189,11 +3185,11 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
3189
3185
|
const upd = [];
|
|
3190
3186
|
for (const client of remoteParticipants) {
|
|
3191
3187
|
const { streams, id: clientId, newJoiner } = client;
|
|
3192
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
3188
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === CAMERA_STREAM_ID);
|
|
3193
3189
|
for (let i = 0; i < streams.length; i++) {
|
|
3194
3190
|
let streamId = streams[i].id;
|
|
3195
3191
|
let state = streams[i].state;
|
|
3196
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
3192
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === CAMERA_STREAM_ID) {
|
|
3197
3193
|
if (i === 0) {
|
|
3198
3194
|
streamId = streams[1].id;
|
|
3199
3195
|
state = streams[1].state;
|
|
@@ -3212,7 +3208,7 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
3212
3208
|
upd.push({
|
|
3213
3209
|
clientId,
|
|
3214
3210
|
streamId,
|
|
3215
|
-
state: `${newJoiner && streamId ===
|
|
3211
|
+
state: `${newJoiner && streamId === CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
3216
3212
|
});
|
|
3217
3213
|
}
|
|
3218
3214
|
else {
|
package/dist/redux/index.cjs
CHANGED
|
@@ -75,7 +75,7 @@ const createReactor = (selectors, callback) => {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
const coreVersion = "1.6.
|
|
78
|
+
const coreVersion = "1.6.3";
|
|
79
79
|
|
|
80
80
|
const initialState$1 = {
|
|
81
81
|
displayName: null,
|
|
@@ -1648,7 +1648,7 @@ const selectBreakoutGroupedParticipants = toolkit.createSelector(selectAllClient
|
|
|
1648
1648
|
|
|
1649
1649
|
function streamIdForClient({ isPresentation, stream }) {
|
|
1650
1650
|
var _a, _b;
|
|
1651
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
1651
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : media.CAMERA_STREAM_ID;
|
|
1652
1652
|
}
|
|
1653
1653
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
1654
1654
|
return !!spotlights.find((s) => {
|
|
@@ -1723,7 +1723,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
1723
1723
|
}
|
|
1724
1724
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1725
1725
|
const streamId = streamIdForClient(clientView);
|
|
1726
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1726
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : media.CAMERA_STREAM_ID };
|
|
1727
1727
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
1728
1728
|
});
|
|
1729
1729
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -1734,7 +1734,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
1734
1734
|
}
|
|
1735
1735
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1736
1736
|
const streamId = streamIdForClient(clientView);
|
|
1737
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1737
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : media.CAMERA_STREAM_ID };
|
|
1738
1738
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
1739
1739
|
});
|
|
1740
1740
|
const selectSpotlightsRaw = (state) => state.spotlights;
|
|
@@ -1908,7 +1908,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
1908
1908
|
dispatch(rtcDisconnected());
|
|
1909
1909
|
});
|
|
1910
1910
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
1911
|
-
var _a;
|
|
1912
1911
|
dispatch(isAcceptingStreams(true));
|
|
1913
1912
|
const state = getState();
|
|
1914
1913
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -1916,8 +1915,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1916
1915
|
if (!rtcManager) {
|
|
1917
1916
|
throw new Error("No rtc manager");
|
|
1918
1917
|
}
|
|
1919
|
-
const
|
|
1920
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
1918
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
1921
1919
|
const updates = [];
|
|
1922
1920
|
for (const { clientId, streamId, state } of payload) {
|
|
1923
1921
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -1927,15 +1925,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1927
1925
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
1928
1926
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
1929
1927
|
rtcManager.acceptNewStream({
|
|
1930
|
-
streamId: streamId ===
|
|
1928
|
+
streamId: streamId === media.CAMERA_STREAM_ID ? clientId : streamId,
|
|
1931
1929
|
clientId,
|
|
1932
|
-
shouldAddLocalVideo: streamId === "0",
|
|
1933
|
-
activeBreakout,
|
|
1934
1930
|
});
|
|
1935
1931
|
}
|
|
1936
1932
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
1937
1933
|
else if (state === "to_unaccept") {
|
|
1938
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
1934
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === media.CAMERA_STREAM_ID ? clientId : streamId);
|
|
1939
1935
|
}
|
|
1940
1936
|
else if (state !== "done_accept") {
|
|
1941
1937
|
continue;
|
|
@@ -1968,7 +1964,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
1968
1964
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
1969
1965
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
1970
1966
|
if (localMediaStream && rtcManager) {
|
|
1971
|
-
rtcManager.addNewStream(
|
|
1967
|
+
rtcManager.addNewStream(media.CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
1972
1968
|
}
|
|
1973
1969
|
dispatch(rtcManagerInitialized());
|
|
1974
1970
|
});
|
|
@@ -2051,7 +2047,7 @@ startAppListening({
|
|
|
2051
2047
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
2052
2048
|
const { stream } = payload;
|
|
2053
2049
|
if (stream) {
|
|
2054
|
-
rtcManager.addNewStream(
|
|
2050
|
+
rtcManager.addNewStream(media.CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
2055
2051
|
}
|
|
2056
2052
|
},
|
|
2057
2053
|
});
|
|
@@ -2095,11 +2091,11 @@ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemo
|
|
|
2095
2091
|
const upd = [];
|
|
2096
2092
|
for (const client of remoteParticipants) {
|
|
2097
2093
|
const { streams, id: clientId, newJoiner } = client;
|
|
2098
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
2094
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === media.CAMERA_STREAM_ID);
|
|
2099
2095
|
for (let i = 0; i < streams.length; i++) {
|
|
2100
2096
|
let streamId = streams[i].id;
|
|
2101
2097
|
let state = streams[i].state;
|
|
2102
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
2098
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === media.CAMERA_STREAM_ID) {
|
|
2103
2099
|
if (i === 0) {
|
|
2104
2100
|
streamId = streams[1].id;
|
|
2105
2101
|
state = streams[1].state;
|
|
@@ -2118,7 +2114,7 @@ const selectStreamsToAccept = toolkit.createSelector(selectRtcStatus, selectRemo
|
|
|
2118
2114
|
upd.push({
|
|
2119
2115
|
clientId,
|
|
2120
2116
|
streamId,
|
|
2121
|
-
state: `${newJoiner && streamId ===
|
|
2117
|
+
state: `${newJoiner && streamId === media.CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
2122
2118
|
});
|
|
2123
2119
|
}
|
|
2124
2120
|
else {
|
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, replaceTracksInStream, getDisplayMedia, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, 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,7 +73,7 @@ const createReactor = (selectors, callback) => {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const coreVersion = "1.6.
|
|
76
|
+
const coreVersion = "1.6.3";
|
|
77
77
|
|
|
78
78
|
const initialState$1 = {
|
|
79
79
|
displayName: null,
|
|
@@ -1646,7 +1646,7 @@ const selectBreakoutGroupedParticipants = createSelector(selectAllClientViews, s
|
|
|
1646
1646
|
|
|
1647
1647
|
function streamIdForClient({ isPresentation, stream }) {
|
|
1648
1648
|
var _a, _b;
|
|
1649
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
1649
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : CAMERA_STREAM_ID;
|
|
1650
1650
|
}
|
|
1651
1651
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
1652
1652
|
return !!spotlights.find((s) => {
|
|
@@ -1721,7 +1721,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
1721
1721
|
}
|
|
1722
1722
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1723
1723
|
const streamId = streamIdForClient(clientView);
|
|
1724
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1724
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
1725
1725
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
1726
1726
|
});
|
|
1727
1727
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -1732,7 +1732,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
1732
1732
|
}
|
|
1733
1733
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1734
1734
|
const streamId = streamIdForClient(clientView);
|
|
1735
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1735
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
1736
1736
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
1737
1737
|
});
|
|
1738
1738
|
const selectSpotlightsRaw = (state) => state.spotlights;
|
|
@@ -1906,7 +1906,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
1906
1906
|
dispatch(rtcDisconnected());
|
|
1907
1907
|
});
|
|
1908
1908
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
1909
|
-
var _a;
|
|
1910
1909
|
dispatch(isAcceptingStreams(true));
|
|
1911
1910
|
const state = getState();
|
|
1912
1911
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -1914,8 +1913,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1914
1913
|
if (!rtcManager) {
|
|
1915
1914
|
throw new Error("No rtc manager");
|
|
1916
1915
|
}
|
|
1917
|
-
const
|
|
1918
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
1916
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
1919
1917
|
const updates = [];
|
|
1920
1918
|
for (const { clientId, streamId, state } of payload) {
|
|
1921
1919
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -1925,15 +1923,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1925
1923
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
1926
1924
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
1927
1925
|
rtcManager.acceptNewStream({
|
|
1928
|
-
streamId: streamId ===
|
|
1926
|
+
streamId: streamId === CAMERA_STREAM_ID ? clientId : streamId,
|
|
1929
1927
|
clientId,
|
|
1930
|
-
shouldAddLocalVideo: streamId === "0",
|
|
1931
|
-
activeBreakout,
|
|
1932
1928
|
});
|
|
1933
1929
|
}
|
|
1934
1930
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
1935
1931
|
else if (state === "to_unaccept") {
|
|
1936
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
1932
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === CAMERA_STREAM_ID ? clientId : streamId);
|
|
1937
1933
|
}
|
|
1938
1934
|
else if (state !== "done_accept") {
|
|
1939
1935
|
continue;
|
|
@@ -1966,7 +1962,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
1966
1962
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
1967
1963
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
1968
1964
|
if (localMediaStream && rtcManager) {
|
|
1969
|
-
rtcManager.addNewStream(
|
|
1965
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
1970
1966
|
}
|
|
1971
1967
|
dispatch(rtcManagerInitialized());
|
|
1972
1968
|
});
|
|
@@ -2049,7 +2045,7 @@ startAppListening({
|
|
|
2049
2045
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
2050
2046
|
const { stream } = payload;
|
|
2051
2047
|
if (stream) {
|
|
2052
|
-
rtcManager.addNewStream(
|
|
2048
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
2053
2049
|
}
|
|
2054
2050
|
},
|
|
2055
2051
|
});
|
|
@@ -2093,11 +2089,11 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
2093
2089
|
const upd = [];
|
|
2094
2090
|
for (const client of remoteParticipants) {
|
|
2095
2091
|
const { streams, id: clientId, newJoiner } = client;
|
|
2096
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
2092
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === CAMERA_STREAM_ID);
|
|
2097
2093
|
for (let i = 0; i < streams.length; i++) {
|
|
2098
2094
|
let streamId = streams[i].id;
|
|
2099
2095
|
let state = streams[i].state;
|
|
2100
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
2096
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === CAMERA_STREAM_ID) {
|
|
2101
2097
|
if (i === 0) {
|
|
2102
2098
|
streamId = streams[1].id;
|
|
2103
2099
|
state = streams[1].state;
|
|
@@ -2116,7 +2112,7 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
2116
2112
|
upd.push({
|
|
2117
2113
|
clientId,
|
|
2118
2114
|
streamId,
|
|
2119
|
-
state: `${newJoiner && streamId ===
|
|
2115
|
+
state: `${newJoiner && streamId === CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
2120
2116
|
});
|
|
2121
2117
|
}
|
|
2122
2118
|
else {
|
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, replaceTracksInStream, getDisplayMedia, RtcManagerDispatcher, setClientProvider, subscribeIssues, assert, fromLocation } from '@whereby.com/media';
|
|
2
|
+
import { ServerSocket, getDeviceData, getStream, getUpdatedDevices, replaceTracksInStream, getDisplayMedia, CAMERA_STREAM_ID, 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,7 +73,7 @@ const createReactor = (selectors, callback) => {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const coreVersion = "1.6.
|
|
76
|
+
const coreVersion = "1.6.3";
|
|
77
77
|
|
|
78
78
|
const initialState$1 = {
|
|
79
79
|
displayName: null,
|
|
@@ -1646,7 +1646,7 @@ const selectBreakoutGroupedParticipants = createSelector(selectAllClientViews, s
|
|
|
1646
1646
|
|
|
1647
1647
|
function streamIdForClient({ isPresentation, stream }) {
|
|
1648
1648
|
var _a, _b;
|
|
1649
|
-
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id :
|
|
1649
|
+
return isPresentation ? (_b = (_a = stream === null || stream === void 0 ? void 0 : stream.outboundId) !== null && _a !== void 0 ? _a : stream === null || stream === void 0 ? void 0 : stream.inboundId) !== null && _b !== void 0 ? _b : stream === null || stream === void 0 ? void 0 : stream.id : CAMERA_STREAM_ID;
|
|
1650
1650
|
}
|
|
1651
1651
|
function isClientSpotlighted({ spotlights, isPresentation, clientId, stream, }) {
|
|
1652
1652
|
return !!spotlights.find((s) => {
|
|
@@ -1721,7 +1721,7 @@ const doSpotlightParticipant = createAppAuthorizedThunk((state) => selectIsAutho
|
|
|
1721
1721
|
}
|
|
1722
1722
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1723
1723
|
const streamId = streamIdForClient(clientView);
|
|
1724
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1724
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
1725
1725
|
socket === null || socket === void 0 ? void 0 : socket.emit("add_spotlight", payload);
|
|
1726
1726
|
});
|
|
1727
1727
|
const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorizedToSpotlight(state), ({ id }) => (_, getState) => {
|
|
@@ -1732,7 +1732,7 @@ const doRemoveSpotlight = createAppAuthorizedThunk((state) => selectIsAuthorized
|
|
|
1732
1732
|
}
|
|
1733
1733
|
const { socket } = selectSignalConnectionRaw(state);
|
|
1734
1734
|
const streamId = streamIdForClient(clientView);
|
|
1735
|
-
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId :
|
|
1735
|
+
const payload = { clientId: clientView.id, streamId: streamId !== null && streamId !== void 0 ? streamId : CAMERA_STREAM_ID };
|
|
1736
1736
|
socket === null || socket === void 0 ? void 0 : socket.emit("remove_spotlight", payload);
|
|
1737
1737
|
});
|
|
1738
1738
|
const selectSpotlightsRaw = (state) => state.spotlights;
|
|
@@ -1906,7 +1906,6 @@ const doDisconnectRtc = createAppThunk(() => (dispatch, getState) => {
|
|
|
1906
1906
|
dispatch(rtcDisconnected());
|
|
1907
1907
|
});
|
|
1908
1908
|
const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) => {
|
|
1909
|
-
var _a;
|
|
1910
1909
|
dispatch(isAcceptingStreams(true));
|
|
1911
1910
|
const state = getState();
|
|
1912
1911
|
const rtcManager = selectRtcConnectionRaw(state).rtcManager;
|
|
@@ -1914,8 +1913,7 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1914
1913
|
if (!rtcManager) {
|
|
1915
1914
|
throw new Error("No rtc manager");
|
|
1916
1915
|
}
|
|
1917
|
-
const
|
|
1918
|
-
const shouldAcceptNewClients = (_a = rtcManager.shouldAcceptStreamsFromBothSides) === null || _a === void 0 ? void 0 : _a.call(rtcManager);
|
|
1916
|
+
const shouldAcceptNewClients = rtcManager.shouldAcceptStreamsFromBothSides();
|
|
1919
1917
|
const updates = [];
|
|
1920
1918
|
for (const { clientId, streamId, state } of payload) {
|
|
1921
1919
|
const participant = remoteClients.find((p) => p.id === clientId);
|
|
@@ -1925,15 +1923,13 @@ const doHandleAcceptStreams = createAppThunk((payload) => (dispatch, getState) =
|
|
|
1925
1923
|
(state === "new_accept" && shouldAcceptNewClients) ||
|
|
1926
1924
|
(state === "old_accept" && !shouldAcceptNewClients)) {
|
|
1927
1925
|
rtcManager.acceptNewStream({
|
|
1928
|
-
streamId: streamId ===
|
|
1926
|
+
streamId: streamId === CAMERA_STREAM_ID ? clientId : streamId,
|
|
1929
1927
|
clientId,
|
|
1930
|
-
shouldAddLocalVideo: streamId === "0",
|
|
1931
|
-
activeBreakout,
|
|
1932
1928
|
});
|
|
1933
1929
|
}
|
|
1934
1930
|
else if (state === "new_accept" || state === "old_accept") ;
|
|
1935
1931
|
else if (state === "to_unaccept") {
|
|
1936
|
-
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId ===
|
|
1932
|
+
rtcManager === null || rtcManager === void 0 ? void 0 : rtcManager.disconnect(streamId === CAMERA_STREAM_ID ? clientId : streamId);
|
|
1937
1933
|
}
|
|
1938
1934
|
else if (state !== "done_accept") {
|
|
1939
1935
|
continue;
|
|
@@ -1966,7 +1962,7 @@ const doRtcManagerInitialize = createAppThunk(() => (dispatch, getState) => {
|
|
|
1966
1962
|
const isCameraEnabled = selectIsCameraEnabled(getState());
|
|
1967
1963
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
1968
1964
|
if (localMediaStream && rtcManager) {
|
|
1969
|
-
rtcManager.addNewStream(
|
|
1965
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, localMediaStream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
1970
1966
|
}
|
|
1971
1967
|
dispatch(rtcManagerInitialized());
|
|
1972
1968
|
});
|
|
@@ -2049,7 +2045,7 @@ startAppListening({
|
|
|
2049
2045
|
const isMicrophoneEnabled = selectIsMicrophoneEnabled(getState());
|
|
2050
2046
|
const { stream } = payload;
|
|
2051
2047
|
if (stream) {
|
|
2052
|
-
rtcManager.addNewStream(
|
|
2048
|
+
rtcManager.addNewStream(CAMERA_STREAM_ID, payload.stream, !isMicrophoneEnabled, !isCameraEnabled);
|
|
2053
2049
|
}
|
|
2054
2050
|
},
|
|
2055
2051
|
});
|
|
@@ -2093,11 +2089,11 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
2093
2089
|
const upd = [];
|
|
2094
2090
|
for (const client of remoteParticipants) {
|
|
2095
2091
|
const { streams, id: clientId, newJoiner } = client;
|
|
2096
|
-
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId ===
|
|
2092
|
+
const clientSpotlight = spotlights.find((s) => s.clientId === client.id && s.streamId === CAMERA_STREAM_ID);
|
|
2097
2093
|
for (let i = 0; i < streams.length; i++) {
|
|
2098
2094
|
let streamId = streams[i].id;
|
|
2099
2095
|
let state = streams[i].state;
|
|
2100
|
-
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id ===
|
|
2096
|
+
if ((streams === null || streams === void 0 ? void 0 : streams.length) > 1 && streams[1].id === CAMERA_STREAM_ID) {
|
|
2101
2097
|
if (i === 0) {
|
|
2102
2098
|
streamId = streams[1].id;
|
|
2103
2099
|
state = streams[1].state;
|
|
@@ -2116,7 +2112,7 @@ const selectStreamsToAccept = createSelector(selectRtcStatus, selectRemoteClient
|
|
|
2116
2112
|
upd.push({
|
|
2117
2113
|
clientId,
|
|
2118
2114
|
streamId,
|
|
2119
|
-
state: `${newJoiner && streamId ===
|
|
2115
|
+
state: `${newJoiner && streamId === CAMERA_STREAM_ID ? "new" : "to"}_accept`,
|
|
2120
2116
|
});
|
|
2121
2117
|
}
|
|
2122
2118
|
else {
|
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.6.
|
|
5
|
+
"version": "1.6.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"typescript": "^5.8.3",
|
|
61
61
|
"@whereby.com/eslint-config": "0.1.0",
|
|
62
62
|
"@whereby.com/jest-config": "0.1.0",
|
|
63
|
+
"@whereby.com/prettier-config": "0.1.0",
|
|
63
64
|
"@whereby.com/rollup-config": "0.1.1",
|
|
64
|
-
"@whereby.com/tsconfig": "0.1.0"
|
|
65
|
-
"@whereby.com/prettier-config": "0.1.0"
|
|
65
|
+
"@whereby.com/tsconfig": "0.1.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@reduxjs/toolkit": "^2.2.3",
|
|
69
|
-
"@whereby.com/media": "2.8.
|
|
69
|
+
"@whereby.com/media": "2.8.3",
|
|
70
70
|
"axios": "^1.11.0",
|
|
71
71
|
"btoa": "^1.2.1",
|
|
72
72
|
"events": "^3.3.0"
|