@stream-io/video-react-sdk 0.3.29 → 0.3.30

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +7 -5
  3. package/dist/css/styles.css +100 -0
  4. package/dist/css/styles.css.map +1 -1
  5. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +2 -1
  6. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -1
  7. package/dist/src/core/components/Audio/ParticipantsAudio.d.ts +14 -0
  8. package/dist/src/core/components/Audio/ParticipantsAudio.js +11 -0
  9. package/dist/src/core/components/Audio/ParticipantsAudio.js.map +1 -0
  10. package/dist/src/core/components/Audio/index.d.ts +1 -0
  11. package/dist/src/core/components/Audio/index.js +1 -0
  12. package/dist/src/core/components/Audio/index.js.map +1 -1
  13. package/dist/src/core/components/CallLayout/LivestreamLayout.d.ts +39 -0
  14. package/dist/src/core/components/CallLayout/LivestreamLayout.js +91 -0
  15. package/dist/src/core/components/CallLayout/LivestreamLayout.js.map +1 -0
  16. package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +4 -2
  17. package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -1
  18. package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +1 -1
  19. package/dist/src/core/components/CallLayout/SpeakerLayout.js +7 -28
  20. package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -1
  21. package/dist/src/core/components/CallLayout/hooks.d.ts +3 -0
  22. package/dist/src/core/components/CallLayout/hooks.js +41 -0
  23. package/dist/src/core/components/CallLayout/hooks.js.map +1 -0
  24. package/dist/src/core/components/CallLayout/index.d.ts +1 -0
  25. package/dist/src/core/components/CallLayout/index.js +1 -0
  26. package/dist/src/core/components/CallLayout/index.js.map +1 -1
  27. package/dist/src/translations/en.json +1 -0
  28. package/dist/src/translations/index.d.ts +1 -0
  29. package/dist/version.d.ts +1 -1
  30. package/dist/version.js +1 -1
  31. package/package.json +4 -4
  32. package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +2 -1
  33. package/src/core/components/Audio/ParticipantsAudio.tsx +35 -0
  34. package/src/core/components/Audio/index.ts +1 -0
  35. package/src/core/components/CallLayout/LivestreamLayout.tsx +231 -0
  36. package/src/core/components/CallLayout/PaginatedGridLayout.tsx +5 -4
  37. package/src/core/components/CallLayout/SpeakerLayout.tsx +8 -40
  38. package/src/core/components/CallLayout/hooks.ts +54 -0
  39. package/src/core/components/CallLayout/index.ts +1 -0
  40. package/src/translations/en.json +2 -0
@@ -0,0 +1,54 @@
1
+ import { useEffect } from 'react';
2
+ import {
3
+ Call,
4
+ CallTypes,
5
+ combineComparators,
6
+ Comparator,
7
+ defaultSortPreset,
8
+ paginatedLayoutSortPreset,
9
+ screenSharing,
10
+ speakerLayoutSortPreset,
11
+ StreamVideoParticipant,
12
+ } from '@stream-io/video-client';
13
+
14
+ export const usePaginatedLayoutSortPreset = (call: Call | undefined) => {
15
+ useEffect(() => {
16
+ if (!call) return;
17
+ call.setSortParticipantsBy(paginatedLayoutSortPreset);
18
+ return () => {
19
+ resetSortPreset(call);
20
+ };
21
+ }, [call]);
22
+ };
23
+
24
+ export const useSpeakerLayoutSortPreset = (
25
+ call: Call | undefined,
26
+ isOneOnOneCall: boolean,
27
+ ) => {
28
+ useEffect(() => {
29
+ if (!call) return;
30
+ // always show the remote participant in the spotlight
31
+ if (isOneOnOneCall) {
32
+ call.setSortParticipantsBy(combineComparators(screenSharing, loggedIn));
33
+ } else {
34
+ call.setSortParticipantsBy(speakerLayoutSortPreset);
35
+ }
36
+ return () => {
37
+ resetSortPreset(call);
38
+ };
39
+ }, [call, isOneOnOneCall]);
40
+ };
41
+
42
+ const resetSortPreset = (call: Call) => {
43
+ // reset the sorting to the default for the call type
44
+ const callConfig = CallTypes.get(call.type);
45
+ call.setSortParticipantsBy(
46
+ callConfig.options.sortParticipantsBy || defaultSortPreset,
47
+ );
48
+ };
49
+
50
+ const loggedIn: Comparator<StreamVideoParticipant> = (a, b) => {
51
+ if (a.isLocalParticipant) return 1;
52
+ if (b.isLocalParticipant) return -1;
53
+ return 0;
54
+ };
@@ -1,2 +1,3 @@
1
+ export * from './LivestreamLayout';
1
2
  export * from './PaginatedGridLayout';
2
3
  export * from './SpeakerLayout';
@@ -12,6 +12,8 @@
12
12
  "Video": "Video",
13
13
  "You are muted. Unmute to speak.": "You are muted. Unmute to speak.",
14
14
 
15
+ "Live": "Live",
16
+
15
17
  "You can now speak.": "You can now speak.",
16
18
  "Awaiting for an approval to speak.": "Awaiting for an approval to speak.",
17
19
  "You can no longer speak.": "You can no longer speak.",