@100mslive/roomkit-react 0.2.7-alpha.0 → 0.2.7-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/README.md +30 -33
  2. package/dist/{HLSView-E65JZSU4.js → HLSView-DQJBCEW4.js} +2 -2
  3. package/dist/Prebuilt/common/constants.d.ts +4 -3
  4. package/dist/Prebuilt/components/AudioVideoToggle.d.ts +9 -0
  5. package/dist/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.d.ts +11 -0
  6. package/dist/Prebuilt/components/hooks/useAudioOutputTest.d.ts +8 -0
  7. package/dist/{chunk-DWLYDCFC.js → chunk-GEXL6KL2.js} +4355 -3936
  8. package/dist/chunk-GEXL6KL2.js.map +7 -0
  9. package/dist/index.cjs.js +5991 -5566
  10. package/dist/index.cjs.js.map +4 -4
  11. package/dist/index.js +1 -1
  12. package/dist/meta.cjs.json +668 -599
  13. package/dist/meta.esbuild.json +675 -606
  14. package/package.json +7 -6
  15. package/src/Prebuilt/common/constants.ts +7 -4
  16. package/src/Prebuilt/components/AppData/useUISettings.js +1 -1
  17. package/src/Prebuilt/components/AudioVideoToggle.tsx +308 -0
  18. package/src/Prebuilt/components/Chat/ChatFooter.tsx +0 -1
  19. package/src/Prebuilt/components/Footer/RoleOptions.tsx +1 -0
  20. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +159 -0
  21. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +0 -2
  22. package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +13 -2
  23. package/src/Prebuilt/components/Notifications/Notifications.tsx +1 -18
  24. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +10 -17
  25. package/src/Prebuilt/components/hooks/useAudioOutputTest.tsx +20 -0
  26. package/dist/chunk-DWLYDCFC.js.map +0 -7
  27. package/src/Prebuilt/components/AudioVideoToggle.jsx +0 -171
  28. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +0 -121
  29. /package/dist/{HLSView-E65JZSU4.js.map → HLSView-DQJBCEW4.js.map} +0 -0
@@ -14,9 +14,10 @@ import { Box, Button, Dropdown, Flex, StyledVideoTile, Text, Video } from '../..
14
14
  import { config as cssConfig } from '../../../Theme';
15
15
  import { DialogDropdownTrigger } from '../../primitives/DropdownTrigger';
16
16
  import { useUISettings } from '../AppData/useUISettings';
17
+ import { useAudioOutputTest } from '../hooks/useAudioOutputTest';
17
18
  import { useDropdownSelection } from '../hooks/useDropdownSelection';
18
19
  import { settingOverflow } from './common';
19
- import { UI_SETTINGS } from '../../common/constants';
20
+ import { TEST_AUDIO_URL, UI_SETTINGS } from '../../common/constants';
20
21
 
21
22
  /**
22
23
  * wrap the button on click of whom settings should open, this component will take care of the rest,
@@ -182,22 +183,8 @@ const DeviceSelector = ({ title, devices, selection, onChange, icon, children =
182
183
  );
183
184
  };
184
185
 
185
- const TEST_AUDIO_URL = 'https://100ms.live/test-audio.wav';
186
-
187
186
  const TestAudio = ({ id }) => {
188
- const audioRef = useRef(null);
189
- const [playing, setPlaying] = useState(false);
190
- useEffect(() => {
191
- if (audioRef.current && id) {
192
- try {
193
- if (typeof audioRef.current.setSinkId !== 'undefined') {
194
- audioRef.current.setSinkId(id);
195
- }
196
- } catch (error) {
197
- console.log(error);
198
- }
199
- }
200
- }, [id]);
187
+ const { playing, setPlaying, audioRef } = useAudioOutputTest({ deviceId: id });
201
188
  return (
202
189
  <>
203
190
  <Button
@@ -218,7 +205,13 @@ const TestAudio = ({ id }) => {
218
205
  &nbsp; speaker
219
206
  </Text>
220
207
  </Button>
221
- <audio ref={audioRef} src={TEST_AUDIO_URL} onEnded={() => setPlaying(false)} onPlay={() => setPlaying(true)} />
208
+ <audio
209
+ ref={audioRef}
210
+ src={TEST_AUDIO_URL}
211
+ onEnded={() => setPlaying(false)}
212
+ onPlay={() => setPlaying(true)}
213
+ css={{ display: 'none' }}
214
+ />
222
215
  </>
223
216
  );
224
217
  };
@@ -0,0 +1,20 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+
3
+ export const useAudioOutputTest = ({ deviceId }: { deviceId: string }) => {
4
+ const audioRef = useRef<HTMLAudioElement | null>(null);
5
+ const [playing, setPlaying] = useState(false);
6
+ useEffect(() => {
7
+ if (audioRef.current && deviceId) {
8
+ try {
9
+ // @ts-ignore
10
+ if (typeof audioRef.current.setSinkId !== 'undefined') {
11
+ // @ts-ignore
12
+ audioRef.current.setSinkId(deviceId);
13
+ }
14
+ } catch (error) {
15
+ console.log(error);
16
+ }
17
+ }
18
+ }, [deviceId]);
19
+ return { playing, setPlaying, audioRef };
20
+ };