@stream-io/video-react-sdk 1.7.4 → 1.7.6

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.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { hasAudio, hasScreenShareAudio, CallingState, hasVideo, hasScreenShare, OwnCapability, Browsers, VisibilityState, getLogger, disposeOfMediaStream, isPinned, name, NoiseCancellationSettingsModeEnum, SfuModels, paginatedLayoutSortPreset, combineComparators, screenSharing, speakerLayoutSortPreset, CallTypes, defaultSortPreset, setSdkInfo } from '@stream-io/video-client';
2
2
  export * from '@stream-io/video-client';
3
- import { useCall, useCallStateHooks, useI18n, Restricted, useConnectedUser, StreamCallProvider, StreamVideoProvider, useStreamVideoClient } from '@stream-io/video-react-bindings';
3
+ import { useCall, useCallStateHooks, useI18n, Restricted, useToggleCallRecording, useConnectedUser, StreamCallProvider, StreamVideoProvider, useStreamVideoClient } from '@stream-io/video-react-bindings';
4
4
  export * from '@stream-io/video-react-bindings';
5
5
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
6
6
  import { useState, useEffect, Fragment as Fragment$1, createContext, useContext, useCallback, useRef, useMemo, isValidElement, forwardRef, useLayoutEffect, lazy, Suspense } from 'react';
@@ -245,39 +245,6 @@ const useHorizontalScrollPosition = (scrollElement, threshold = SCROLL_THRESHOLD
245
245
  return scrollPosition;
246
246
  };
247
247
 
248
- const useToggleCallRecording = () => {
249
- const call = useCall();
250
- const { useIsCallRecordingInProgress } = useCallStateHooks();
251
- const isCallRecordingInProgress = useIsCallRecordingInProgress();
252
- const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);
253
- // TODO: add permissions
254
- useEffect(() => {
255
- // we wait until call.recording_started/stopped event to flips the
256
- // `isCallRecordingInProgress` state variable.
257
- // Once the flip happens, we remove the loading indicator
258
- setIsAwaitingResponse((isAwaiting) => {
259
- if (isAwaiting)
260
- return false;
261
- return isAwaiting;
262
- });
263
- }, [isCallRecordingInProgress]);
264
- const toggleCallRecording = useCallback(async () => {
265
- try {
266
- setIsAwaitingResponse(true);
267
- if (isCallRecordingInProgress) {
268
- await call?.stopRecording();
269
- }
270
- else {
271
- await call?.startRecording();
272
- }
273
- }
274
- catch (e) {
275
- console.error(`Failed start recording`, e);
276
- }
277
- }, [call, isCallRecordingInProgress]);
278
- return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };
279
- };
280
-
281
248
  const useRequestPermission = (permission) => {
282
249
  const call = useCall();
283
250
  const { useHasPermissions } = useCallStateHooks();
@@ -1234,17 +1201,10 @@ const DeviceSelectorOption = ({ disabled, id, label, onChange, name, selected, d
1234
1201
  }), htmlFor: id, children: [jsx("input", { type: "radio", name: name, onChange: onChange, value: value, id: id, checked: selected, defaultChecked: defaultChecked, disabled: disabled }), label] }));
1235
1202
  };
1236
1203
  const DeviceSelectorList = (props) => {
1237
- const { devices = [], selectedDeviceId: selectedDeviceFromProps, title, type, onChange, } = props;
1204
+ const { devices = [], selectedDeviceId, title, type, onChange } = props;
1238
1205
  const { close } = useMenuContext();
1239
- // sometimes the browser (Chrome) will report the system-default device
1240
- // with an id of 'default'. In case when it doesn't, we'll select the first
1241
- // available device.
1242
- let selectedDeviceId = selectedDeviceFromProps;
1243
- if (devices.length > 0 &&
1244
- !devices.find((d) => d.deviceId === selectedDeviceId)) {
1245
- selectedDeviceId = devices[0].deviceId;
1246
- }
1247
- return (jsxs("div", { className: "str-video__device-settings__device-kind", children: [title && (jsx("div", { className: "str-video__device-settings__device-selector-title", children: title })), !devices.length ? (jsx(DeviceSelectorOption, { id: `${type}--default`, label: "Default", name: type, defaultChecked: true, value: "default" })) : (devices.map((device) => {
1206
+ const { t } = useI18n();
1207
+ return (jsxs("div", { className: "str-video__device-settings__device-kind", children: [title && (jsx("div", { className: "str-video__device-settings__device-selector-title", children: title })), devices.length === 0 ? (jsx(DeviceSelectorOption, { id: `${type}--default`, label: t('Default'), name: type, defaultChecked: true, value: "default" })) : (devices.map((device) => {
1248
1208
  return (jsx(DeviceSelectorOption, { id: `${type}--${device.deviceId}`, value: device.deviceId, label: device.label, onChange: (e) => {
1249
1209
  onChange?.(e.target.value);
1250
1210
  close?.();
@@ -1252,29 +1212,20 @@ const DeviceSelectorList = (props) => {
1252
1212
  }))] }));
1253
1213
  };
1254
1214
  const DeviceSelectorDropdown = (props) => {
1255
- const { devices = [], selectedDeviceId: selectedDeviceFromProps, title, onChange, icon, } = props;
1256
- // sometimes the browser (Chrome) will report the system-default device
1257
- // with an id of 'default'. In case when it doesn't, we'll select the first
1258
- // available device.
1259
- let selectedDeviceId = selectedDeviceFromProps;
1260
- if (devices.length > 0 &&
1261
- !devices.find((d) => d.deviceId === selectedDeviceId)) {
1262
- selectedDeviceId = devices[0].deviceId;
1263
- }
1215
+ const { devices = [], selectedDeviceId, title, onChange, icon } = props;
1216
+ const { t } = useI18n();
1264
1217
  const selectedIndex = devices.findIndex((d) => d.deviceId === selectedDeviceId);
1265
1218
  const handleSelect = useCallback((index) => {
1266
1219
  onChange?.(devices[index].deviceId);
1267
1220
  }, [devices, onChange]);
1268
- return (jsxs("div", { className: "str-video__device-settings__device-kind", children: [jsx("div", { className: "str-video__device-settings__device-selector-title", children: title }), jsx(DropDownSelect, { icon: icon, defaultSelectedIndex: selectedIndex, defaultSelectedLabel: devices[selectedIndex]?.label, handleSelect: handleSelect, children: devices.map((device) => {
1269
- return (jsx(DropDownSelectOption, { icon: icon, label: device.label, selected: device.deviceId === selectedDeviceId || devices.length === 1 }, device.deviceId));
1270
- }) })] }));
1221
+ return (jsxs("div", { className: "str-video__device-settings__device-kind", children: [jsx("div", { className: "str-video__device-settings__device-selector-title", children: title }), jsx(DropDownSelect, { icon: icon, defaultSelectedIndex: selectedIndex, defaultSelectedLabel: devices[selectedIndex]?.label ?? t('Default'), handleSelect: handleSelect, children: devices.length === 0 ? (jsx(DropDownSelectOption, { icon: icon, label: t('Default'), selected: true })) : (devices.map((device) => (jsx(DropDownSelectOption, { icon: icon, label: device.label, selected: device.deviceId === selectedDeviceId || devices.length === 1 }, device.deviceId)))) })] }));
1271
1222
  };
1272
1223
  const DeviceSelector = (props) => {
1273
1224
  const { visualType = 'list', icon, placeholder, ...rest } = props;
1274
1225
  if (visualType === 'list') {
1275
1226
  return jsx(DeviceSelectorList, { ...rest });
1276
1227
  }
1277
- return (jsx(DeviceSelectorDropdown, { ...rest, icon: icon, placeholder: placeholder }));
1228
+ return jsx(DeviceSelectorDropdown, { ...rest, icon: icon });
1278
1229
  };
1279
1230
 
1280
1231
  const DeviceSelectorAudioInput = ({ title, visualType, }) => {
@@ -2163,6 +2114,7 @@ var Join = "Join";
2163
2114
  var You = "You";
2164
2115
  var Me = "Me";
2165
2116
  var Unknown = "Unknown";
2117
+ var Default = "Default";
2166
2118
  var Refresh = "Refresh";
2167
2119
  var Allow = "Allow";
2168
2120
  var Revoke = "Revoke";
@@ -2213,6 +2165,7 @@ var en = {
2213
2165
  Me: Me,
2214
2166
  Unknown: Unknown,
2215
2167
  "Toggle device menu": "Toggle device menu",
2168
+ Default: Default,
2216
2169
  "Call Recordings": "Call Recordings",
2217
2170
  Refresh: Refresh,
2218
2171
  "Check your browser video permissions": "Check your browser video permissions",
@@ -2576,7 +2529,7 @@ const LivestreamPlayer = (props) => {
2576
2529
  return (jsx(StreamCall, { call: call, children: jsx(LivestreamLayout, { ...layoutProps }) }));
2577
2530
  };
2578
2531
 
2579
- const [major, minor, patch] = ("1.7.4").split('.');
2532
+ const [major, minor, patch] = ("1.7.6").split('.');
2580
2533
  setSdkInfo({
2581
2534
  type: SfuModels.SdkType.REACT,
2582
2535
  major,