@stream-io/video-react-sdk 1.25.1 → 1.26.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.js CHANGED
@@ -1409,7 +1409,7 @@ const DeviceSelectorOption = ({ disabled, id, label, onChange, name, selected, d
1409
1409
  }), htmlFor: id, children: [jsxRuntime.jsx("input", { type: "radio", name: name, onChange: onChange, value: value, id: id, checked: selected, defaultChecked: defaultChecked, disabled: disabled }), label] }));
1410
1410
  };
1411
1411
  const DeviceSelectorList = (props) => {
1412
- const { devices = [], selectedDeviceId, title, type, onChange } = props;
1412
+ const { devices = [], selectedDeviceId, title, type, onChange, children, } = props;
1413
1413
  const { close } = useMenuContext();
1414
1414
  const { deviceList } = useDeviceList(devices, selectedDeviceId);
1415
1415
  return (jsxRuntime.jsxs("div", { className: "str-video__device-settings__device-kind", children: [title && (jsxRuntime.jsx("div", { className: "str-video__device-settings__device-selector-title", children: title })), deviceList.map((device) => {
@@ -1420,7 +1420,7 @@ const DeviceSelectorList = (props) => {
1420
1420
  }
1421
1421
  close?.();
1422
1422
  }, name: type, selected: device.isSelected }, device.deviceId));
1423
- })] }));
1423
+ }), children] }));
1424
1424
  };
1425
1425
  const DeviceSelectorDropdown = (props) => {
1426
1426
  const { devices = [], selectedDeviceId, title, onChange, icon } = props;
@@ -1441,12 +1441,27 @@ const DeviceSelector = (props) => {
1441
1441
  return jsxRuntime.jsx(DeviceSelectorDropdown, { ...rest, icon: icon });
1442
1442
  };
1443
1443
 
1444
- const DeviceSelectorAudioInput = ({ title, visualType, }) => {
1444
+ const AudioVolumeIndicator = () => {
1445
+ const { useMicrophoneState } = videoReactBindings.useCallStateHooks();
1446
+ const { isEnabled, mediaStream } = useMicrophoneState();
1447
+ const [audioLevel, setAudioLevel] = react.useState(0);
1448
+ react.useEffect(() => {
1449
+ if (!isEnabled || !mediaStream)
1450
+ return;
1451
+ const disposeSoundDetector = videoClient.createSoundDetector(mediaStream, ({ audioLevel: al }) => setAudioLevel(al), { detectionFrequencyInMs: 80, destroyStreamOnStop: false });
1452
+ return () => {
1453
+ disposeSoundDetector().catch(console.error);
1454
+ };
1455
+ }, [isEnabled, mediaStream]);
1456
+ return (jsxRuntime.jsxs("div", { className: "str-video__audio-volume-indicator", children: [jsxRuntime.jsx(Icon, { icon: isEnabled ? 'mic' : 'mic-off' }), jsxRuntime.jsx("div", { className: "str-video__audio-volume-indicator__bar", children: jsxRuntime.jsx("div", { className: "str-video__audio-volume-indicator__bar-value", style: { transform: `scaleX(${audioLevel / 100})` } }) })] }));
1457
+ };
1458
+
1459
+ const DeviceSelectorAudioInput = ({ title, visualType, volumeIndicatorVisible = true, }) => {
1445
1460
  const { useMicrophoneState } = videoReactBindings.useCallStateHooks();
1446
1461
  const { microphone, selectedDevice, devices } = useMicrophoneState();
1447
1462
  return (jsxRuntime.jsx(DeviceSelector, { devices: devices || [], selectedDeviceId: selectedDevice, type: "audioinput", onChange: async (deviceId) => {
1448
1463
  await microphone.select(deviceId);
1449
- }, title: title, visualType: visualType, icon: "mic" }));
1464
+ }, title: title, visualType: visualType, icon: "mic", children: volumeIndicatorVisible && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("hr", { className: "str-video__device-settings__separator" }), jsxRuntime.jsx(AudioVolumeIndicator, {})] })) }));
1450
1465
  };
1451
1466
  const DeviceSelectorAudioOutput = ({ title, visualType, }) => {
1452
1467
  const { useSpeakerState } = videoReactBindings.useCallStateHooks();
@@ -3005,7 +3020,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
3005
3020
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
3006
3021
  };
3007
3022
 
3008
- const [major, minor, patch] = ("1.25.1").split('.');
3023
+ const [major, minor, patch] = ("1.26.0").split('.');
3009
3024
  videoClient.setSdkInfo({
3010
3025
  type: videoClient.SfuModels.SdkType.REACT,
3011
3026
  major,