@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.
- package/CHANGELOG.md +12 -0
- package/README.md +7 -5
- package/dist/css/styles.css +100 -0
- package/dist/css/styles.css.map +1 -1
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +2 -1
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -1
- package/dist/src/core/components/Audio/ParticipantsAudio.d.ts +14 -0
- package/dist/src/core/components/Audio/ParticipantsAudio.js +11 -0
- package/dist/src/core/components/Audio/ParticipantsAudio.js.map +1 -0
- package/dist/src/core/components/Audio/index.d.ts +1 -0
- package/dist/src/core/components/Audio/index.js +1 -0
- package/dist/src/core/components/Audio/index.js.map +1 -1
- package/dist/src/core/components/CallLayout/LivestreamLayout.d.ts +39 -0
- package/dist/src/core/components/CallLayout/LivestreamLayout.js +91 -0
- package/dist/src/core/components/CallLayout/LivestreamLayout.js.map +1 -0
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +4 -2
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +1 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +7 -28
- package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -1
- package/dist/src/core/components/CallLayout/hooks.d.ts +3 -0
- package/dist/src/core/components/CallLayout/hooks.js +41 -0
- package/dist/src/core/components/CallLayout/hooks.js.map +1 -0
- package/dist/src/core/components/CallLayout/index.d.ts +1 -0
- package/dist/src/core/components/CallLayout/index.js +1 -0
- package/dist/src/core/components/CallLayout/index.js.map +1 -1
- package/dist/src/translations/en.json +1 -0
- package/dist/src/translations/index.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +2 -1
- package/src/core/components/Audio/ParticipantsAudio.tsx +35 -0
- package/src/core/components/Audio/index.ts +1 -0
- package/src/core/components/CallLayout/LivestreamLayout.tsx +231 -0
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +5 -4
- package/src/core/components/CallLayout/SpeakerLayout.tsx +8 -40
- package/src/core/components/CallLayout/hooks.ts +54 -0
- package/src/core/components/CallLayout/index.ts +1 -0
- 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
|
+
};
|
package/src/translations/en.json
CHANGED
|
@@ -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.",
|