@whereby.com/browser-sdk 3.8.1 → 3.9.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.
@@ -114,12 +114,14 @@ interface RoomConnectionActions {
114
114
  toggleLowDataMode: (enabled?: boolean) => void;
115
115
  toggleRaiseHand: (enabled?: boolean) => void;
116
116
  askToSpeak: (participantId: string) => void;
117
+ askToTurnOnCamera: (participantId: string) => void;
117
118
  acceptWaitingParticipant: (participantId: string) => void;
118
119
  knock: () => void;
119
120
  joinRoom: () => void;
120
121
  leaveRoom: () => void;
121
122
  lockRoom: (locked: boolean) => void;
122
123
  muteParticipants: (clientIds: string[]) => void;
124
+ turnOffParticipantCameras: (clientIds: string[]) => void;
123
125
  kickParticipant: (clientId: string) => void;
124
126
  endMeeting: (stayBehind?: boolean) => void;
125
127
  rejectWaitingParticipant: (participantId: string) => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Provider as Provider$1, useDispatch, useSelector } from 'react-redux';
3
- import { createServices, createStore, selectCurrentSpeakerDeviceId, debounce, doRtcReportStreamResolution, selectChatMessages, selectCloudRecordingRaw, selectLocalParticipantRaw, selectLocalMediaStream, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, doAppStop, doSendChatMessage, doKnockRoom, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, doSetLocalStickyReaction, doRequestAudioEnable, doAcceptWaitingParticipant, doRejectWaitingParticipant, doStartCloudRecording, doStartScreenshare, doStopCloudRecording, doStopScreenshare, doAppStart, doLockRoom, doSpotlightParticipant, doRemoveSpotlight, doKickParticipant, doEndMeeting, doSetDisplayName, selectCameraDeviceError, selectCameraDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsLocalMediaStarting, selectMicrophoneDeviceError, selectMicrophoneDevices, selectSpeakerDevices, selectLocalMediaStartError, doStartLocalMedia, doStopLocalMedia, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, selectAllClientViews, selectNumParticipants } from '@whereby.com/core';
3
+ import { createServices, createStore, selectCurrentSpeakerDeviceId, debounce, doRtcReportStreamResolution, selectChatMessages, selectCloudRecordingRaw, selectLocalParticipantRaw, selectLocalMediaStream, selectRemoteParticipants, selectScreenshares, selectRoomConnectionStatus, selectStreamingRaw, selectWaitingParticipants, selectNotificationsEmitter, selectSpotlightedClientViews, doAppStop, doSendChatMessage, doKnockRoom, doSetDisplayName, toggleCameraEnabled, toggleMicrophoneEnabled, toggleLowDataModeEnabled, doSetLocalStickyReaction, doRequestAudioEnable, doRequestVideoEnable, doAcceptWaitingParticipant, doRejectWaitingParticipant, doStartCloudRecording, doStartScreenshare, doStopCloudRecording, doStopScreenshare, doAppStart, doLockRoom, doSpotlightParticipant, doRemoveSpotlight, doKickParticipant, doEndMeeting, selectCameraDeviceError, selectCameraDevices, selectCurrentCameraDeviceId, selectCurrentMicrophoneDeviceId, selectIsSettingCameraDevice, selectIsSettingMicrophoneDevice, selectIsLocalMediaStarting, selectMicrophoneDeviceError, selectMicrophoneDevices, selectSpeakerDevices, selectLocalMediaStartError, doStartLocalMedia, doStopLocalMedia, setCurrentCameraDeviceId, setCurrentMicrophoneDeviceId, setCurrentSpeakerDeviceId, selectAllClientViews, selectNumParticipants } from '@whereby.com/core';
4
4
  import { createSelector } from '@reduxjs/toolkit';
5
5
  import runes from 'runes';
6
6
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -146,7 +146,7 @@ const selectRoomConnectionState = createSelector(selectChatMessages, selectCloud
146
146
  return state;
147
147
  });
148
148
 
149
- const browserSdkVersion = "3.8.1";
149
+ const browserSdkVersion = "3.9.0";
150
150
 
151
151
  const defaultRoomConnectionOptions = {
152
152
  localMediaOptions: {
@@ -175,36 +175,30 @@ function useRoomConnection(roomUrl, roomConnectionOptions = defaultRoomConnectio
175
175
  dispatch(doAppStop());
176
176
  };
177
177
  }, []);
178
- const whenConnectedToRoom = React.useCallback((actionCreator) => {
179
- if (roomConnectionState.connectionStatus === "connected") {
180
- dispatch(actionCreator());
181
- }
182
- else {
183
- console.warn("Action cannot be performed outside of a connected room");
184
- }
185
- }, [roomConnectionState.connectionStatus, dispatch]);
186
- const sendChatMessage = React.useCallback((text) => whenConnectedToRoom(() => doSendChatMessage({ text })), [whenConnectedToRoom]);
178
+ const sendChatMessage = React.useCallback((text) => dispatch(doSendChatMessage({ text })), [dispatch]);
187
179
  const knock = React.useCallback(() => dispatch(doKnockRoom()), [dispatch]);
188
- const setDisplayName = (displayName) => whenConnectedToRoom(() => doSetDisplayName({ displayName }));
189
- const toggleCamera = React.useCallback((enabled) => whenConnectedToRoom(() => toggleCameraEnabled({ enabled })), [whenConnectedToRoom]);
190
- const toggleMicrophone = React.useCallback((enabled) => whenConnectedToRoom(() => toggleMicrophoneEnabled({ enabled })), [whenConnectedToRoom]);
191
- const toggleLowDataMode = React.useCallback((enabled) => whenConnectedToRoom(() => toggleLowDataModeEnabled({ enabled })), [whenConnectedToRoom]);
192
- const toggleRaiseHand = React.useCallback((enabled) => whenConnectedToRoom(() => doSetLocalStickyReaction({ enabled })), [whenConnectedToRoom]);
193
- const askToSpeak = React.useCallback((participantId) => whenConnectedToRoom(() => doRequestAudioEnable({ clientIds: [participantId], enable: true })), [whenConnectedToRoom]);
194
- const acceptWaitingParticipant = React.useCallback((participantId) => whenConnectedToRoom(() => doAcceptWaitingParticipant({ participantId })), [whenConnectedToRoom]);
195
- const rejectWaitingParticipant = React.useCallback((participantId) => whenConnectedToRoom(() => doRejectWaitingParticipant({ participantId })), [whenConnectedToRoom]);
196
- const startCloudRecording = React.useCallback(() => whenConnectedToRoom(() => doStartCloudRecording()), [whenConnectedToRoom]);
197
- const startScreenshare = React.useCallback(() => whenConnectedToRoom(() => doStartScreenshare()), [whenConnectedToRoom]);
198
- const stopCloudRecording = React.useCallback(() => whenConnectedToRoom(() => doStopCloudRecording()), [whenConnectedToRoom]);
199
- const stopScreenshare = React.useCallback(() => whenConnectedToRoom(() => doStopScreenshare()), [whenConnectedToRoom]);
180
+ const setDisplayName = React.useCallback((displayName) => dispatch(doSetDisplayName({ displayName })), [dispatch]);
181
+ const toggleCamera = React.useCallback((enabled) => dispatch(toggleCameraEnabled({ enabled })), [dispatch]);
182
+ const toggleMicrophone = React.useCallback((enabled) => dispatch(toggleMicrophoneEnabled({ enabled })), [dispatch]);
183
+ const toggleLowDataMode = React.useCallback((enabled) => dispatch(toggleLowDataModeEnabled({ enabled })), [dispatch]);
184
+ const toggleRaiseHand = React.useCallback((enabled) => dispatch(doSetLocalStickyReaction({ enabled })), [dispatch]);
185
+ const askToSpeak = React.useCallback((participantId) => dispatch(doRequestAudioEnable({ clientIds: [participantId], enable: true })), [dispatch]);
186
+ const askToTurnOnCamera = React.useCallback((participantId) => dispatch(doRequestVideoEnable({ clientIds: [participantId], enable: true })), [dispatch]);
187
+ const acceptWaitingParticipant = React.useCallback((participantId) => dispatch(doAcceptWaitingParticipant({ participantId })), [dispatch]);
188
+ const rejectWaitingParticipant = React.useCallback((participantId) => dispatch(doRejectWaitingParticipant({ participantId })), [dispatch]);
189
+ const startCloudRecording = React.useCallback(() => dispatch(doStartCloudRecording()), [dispatch]);
190
+ const startScreenshare = React.useCallback(() => dispatch(doStartScreenshare()), [dispatch]);
191
+ const stopCloudRecording = React.useCallback(() => dispatch(doStopCloudRecording()), [dispatch]);
192
+ const stopScreenshare = React.useCallback(() => dispatch(doStopScreenshare()), [dispatch]);
200
193
  const joinRoom = React.useCallback(() => dispatch(doAppStart(roomConfig)), [dispatch]);
201
194
  const leaveRoom = React.useCallback(() => dispatch(doAppStop()), [dispatch]);
202
- const lockRoom = React.useCallback((locked) => whenConnectedToRoom(() => doLockRoom({ locked })), [whenConnectedToRoom]);
203
- const muteParticipants = React.useCallback((participantIds) => whenConnectedToRoom(() => doRequestAudioEnable({ clientIds: participantIds, enable: false })), [whenConnectedToRoom]);
204
- const spotlightParticipant = React.useCallback((participantId) => whenConnectedToRoom(() => doSpotlightParticipant({ id: participantId })), [whenConnectedToRoom]);
205
- const removeSpotlight = React.useCallback((participantId) => whenConnectedToRoom(() => doRemoveSpotlight({ id: participantId })), [whenConnectedToRoom]);
206
- const kickParticipant = React.useCallback((participantId) => whenConnectedToRoom(() => doKickParticipant({ clientId: participantId })), [whenConnectedToRoom]);
207
- const endMeeting = React.useCallback((stayBehind) => whenConnectedToRoom(() => doEndMeeting({ stayBehind })), [whenConnectedToRoom]);
195
+ const lockRoom = React.useCallback((locked) => dispatch(doLockRoom({ locked })), [dispatch]);
196
+ const muteParticipants = React.useCallback((participantIds) => dispatch(doRequestAudioEnable({ clientIds: participantIds, enable: false })), [dispatch]);
197
+ const turnOffParticipantCameras = React.useCallback((participantIds) => dispatch(doRequestVideoEnable({ clientIds: participantIds, enable: false })), [dispatch]);
198
+ const spotlightParticipant = React.useCallback((participantId) => dispatch(doSpotlightParticipant({ id: participantId })), [dispatch]);
199
+ const removeSpotlight = React.useCallback((participantId) => dispatch(doRemoveSpotlight({ id: participantId })), [dispatch]);
200
+ const kickParticipant = React.useCallback((participantId) => dispatch(doKickParticipant({ clientId: participantId })), [dispatch]);
201
+ const endMeeting = React.useCallback((stayBehind) => dispatch(doEndMeeting({ stayBehind })), [dispatch]);
208
202
  const { events } = roomConnectionState, state = __rest(roomConnectionState, ["events"]);
209
203
  return {
210
204
  state,
@@ -213,12 +207,14 @@ function useRoomConnection(roomUrl, roomConnectionOptions = defaultRoomConnectio
213
207
  toggleLowDataMode,
214
208
  toggleRaiseHand,
215
209
  askToSpeak,
210
+ askToTurnOnCamera,
216
211
  acceptWaitingParticipant,
217
212
  knock,
218
213
  joinRoom,
219
214
  leaveRoom,
220
215
  lockRoom,
221
216
  muteParticipants,
217
+ turnOffParticipantCameras,
222
218
  kickParticipant,
223
219
  endMeeting,
224
220
  rejectWaitingParticipant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -79,7 +79,7 @@
79
79
  "dependencies": {
80
80
  "@radix-ui/react-popover": "^1.0.7",
81
81
  "@reduxjs/toolkit": "^2.2.3",
82
- "@whereby.com/core": "0.25.1",
82
+ "@whereby.com/core": "0.27.0",
83
83
  "clsx": "^2.1.1",
84
84
  "heresy": "^1.0.4",
85
85
  "react-redux": "^9.1.1",