@stream-io/video-react-sdk 0.0.1-alpha.9 → 0.0.1-alpha.90
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 +21 -153
- package/README.md +1 -1
- package/dist/css/styles.css +273 -407
- package/dist/css/styles.css.map +1 -1
- package/dist/src/components/Button/CompositeButton.js +2 -4
- package/dist/src/components/Button/CompositeButton.js.map +1 -1
- package/dist/src/components/CallControls/AcceptCallButton.d.ts +7 -0
- package/dist/src/components/CallControls/AcceptCallButton.js +27 -0
- package/dist/src/components/CallControls/AcceptCallButton.js.map +1 -0
- package/dist/src/components/CallControls/CallControls.d.ts +1 -3
- package/dist/src/components/CallControls/CallControls.js +2 -5
- package/dist/src/components/CallControls/CallControls.js.map +1 -1
- package/dist/src/components/CallControls/CallStatsButton.d.ts +1 -5
- package/dist/src/components/CallControls/CallStatsButton.js +2 -4
- package/dist/src/components/CallControls/CallStatsButton.js.map +1 -1
- package/dist/src/components/CallControls/CancelCallButton.d.ts +2 -3
- package/dist/src/components/CallControls/CancelCallButton.js +4 -2
- package/dist/src/components/CallControls/CancelCallButton.js.map +1 -1
- package/dist/src/components/CallControls/ReactionsButton.js +1 -2
- package/dist/src/components/CallControls/ReactionsButton.js.map +1 -1
- package/dist/src/components/CallControls/RecordCallButton.d.ts +1 -3
- package/dist/src/components/CallControls/RecordCallButton.js +10 -6
- package/dist/src/components/CallControls/RecordCallButton.js.map +1 -1
- package/dist/src/components/CallControls/ScreenShareButton.d.ts +1 -3
- package/dist/src/components/CallControls/ScreenShareButton.js +7 -7
- package/dist/src/components/CallControls/ScreenShareButton.js.map +1 -1
- package/dist/src/components/CallControls/ToggleAudioButton.d.ts +1 -1
- package/dist/src/components/CallControls/ToggleAudioButton.js +17 -10
- package/dist/src/components/CallControls/ToggleAudioButton.js.map +1 -1
- package/dist/src/components/CallControls/ToggleVideoButton.d.ts +10 -0
- package/dist/src/components/CallControls/{ToggleCameraButton.js → ToggleVideoButton.js} +17 -11
- package/dist/src/components/CallControls/ToggleVideoButton.js.map +1 -0
- package/dist/src/components/CallControls/index.d.ts +2 -2
- package/dist/src/components/CallControls/index.js +2 -2
- package/dist/src/components/CallControls/index.js.map +1 -1
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js +1 -2
- package/dist/src/components/CallParticipantsList/BlockedUserListing.js.map +1 -1
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +2 -1
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js +13 -5
- package/dist/src/components/CallParticipantsList/CallParticipantListingItem.js.map +1 -1
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js +1 -2
- package/dist/src/components/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/src/components/CallStats/CallStats.d.ts +6 -0
- package/dist/src/components/{StreamCall → CallStats}/CallStats.js +3 -3
- package/dist/src/components/CallStats/CallStats.js.map +1 -0
- package/dist/src/components/CallStats/CallStatsLatencyChart.js.map +1 -0
- package/dist/src/components/CallStats/index.d.ts +2 -0
- package/dist/src/components/CallStats/index.js +3 -0
- package/dist/src/components/CallStats/index.js.map +1 -0
- package/dist/src/components/Debug/DebugStatsView.d.ts +1 -1
- package/dist/src/components/Debug/DebugStatsView.js +32 -7
- package/dist/src/components/Debug/DebugStatsView.js.map +1 -1
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js +5 -3
- package/dist/src/components/DeviceSettings/DeviceSelectorAudio.js.map +1 -1
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js +3 -2
- package/dist/src/components/DeviceSettings/DeviceSelectorVideo.js.map +1 -1
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js +4 -2
- package/dist/src/components/Notification/SpeakingWhileMutedNotification.js.map +1 -1
- package/dist/src/components/PendingCallPanel/PendingCallControls.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js +13 -0
- package/dist/src/components/PendingCallPanel/PendingCallControls.js.map +1 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js +34 -0
- package/dist/src/components/PendingCallPanel/PendingCallPanel.js.map +1 -0
- package/dist/src/components/PendingCallPanel/index.d.ts +2 -0
- package/dist/src/components/PendingCallPanel/index.js +3 -0
- package/dist/src/components/PendingCallPanel/index.js.map +1 -0
- package/dist/src/components/Permissions/PermissionRequests.js +2 -8
- package/dist/src/components/Permissions/PermissionRequests.js.map +1 -1
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js +3 -3
- package/dist/src/components/StreamCall/CallParticipantsScreenView.js.map +1 -1
- package/dist/src/components/StreamCall/CallParticipantsView.js +2 -3
- package/dist/src/components/StreamCall/CallParticipantsView.js.map +1 -1
- package/dist/src/components/StreamTheme/StreamTheme.d.ts +5 -0
- package/dist/src/components/StreamTheme/StreamTheme.js +18 -0
- package/dist/src/components/StreamTheme/StreamTheme.js.map +1 -0
- package/dist/src/components/StreamTheme/index.d.ts +1 -0
- package/dist/src/components/StreamTheme/index.js +2 -0
- package/dist/src/components/StreamTheme/index.js.map +1 -0
- package/dist/src/components/Video/VideoPreview.js +10 -5
- package/dist/src/components/Video/VideoPreview.js.map +1 -1
- package/dist/src/components/Video/index.d.ts +1 -1
- package/dist/src/components/Video/index.js +1 -1
- package/dist/src/components/Video/index.js.map +1 -1
- package/dist/src/components/index.d.ts +2 -2
- package/dist/src/components/index.js +2 -2
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.d.ts +3 -7
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js +13 -14
- package/dist/src/core/components/CallLayout/PaginatedGridLayout.js.map +1 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.d.ts +6 -1
- package/dist/src/core/components/CallLayout/SpeakerLayout.js +13 -7
- package/dist/src/core/components/CallLayout/SpeakerLayout.js.map +1 -1
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +18 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js +36 -0
- package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.js.map +1 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.d.ts +79 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js +33 -0
- package/dist/src/core/components/ParticipantView/ParticipantView.js.map +1 -0
- package/dist/src/core/components/ParticipantView/index.d.ts +2 -0
- package/dist/src/core/components/ParticipantView/index.js +3 -0
- package/dist/src/core/components/ParticipantView/index.js.map +1 -0
- package/dist/src/core/components/StreamCall/StreamCall.d.ts +73 -0
- package/dist/src/core/components/StreamCall/StreamCall.js +60 -0
- package/dist/src/core/components/StreamCall/StreamCall.js.map +1 -0
- package/dist/src/core/components/StreamCall/index.d.ts +1 -0
- package/dist/src/core/components/StreamCall/index.js +2 -0
- package/dist/src/core/components/StreamCall/index.js.map +1 -0
- package/dist/src/core/components/Video/BaseVideo.d.ts +3 -3
- package/dist/src/core/components/Video/BaseVideo.js +6 -12
- package/dist/src/core/components/Video/BaseVideo.js.map +1 -1
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.d.ts +6 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js +9 -0
- package/dist/src/core/components/Video/DefaultVideoPlaceholder.js.map +1 -0
- package/dist/src/core/components/Video/Video.d.ts +11 -6
- package/dist/src/core/components/Video/Video.js +31 -28
- package/dist/src/core/components/Video/Video.js.map +1 -1
- package/dist/src/core/components/index.d.ts +3 -2
- package/dist/src/core/components/index.js +2 -1
- package/dist/src/core/components/index.js.map +1 -1
- package/dist/src/core/contexts/MediaDevicesContext.d.ts +117 -19
- package/dist/src/core/contexts/MediaDevicesContext.js +52 -90
- package/dist/src/core/contexts/MediaDevicesContext.js.map +1 -1
- package/dist/src/core/hooks/index.d.ts +2 -0
- package/dist/src/core/hooks/index.js +2 -0
- package/dist/src/core/hooks/index.js.map +1 -1
- package/dist/src/core/hooks/useAudioPublisher.js +9 -3
- package/dist/src/core/hooks/useAudioPublisher.js.map +1 -1
- package/dist/src/core/hooks/useDevices.d.ts +80 -0
- package/dist/src/core/hooks/useDevices.js +113 -0
- package/dist/src/core/hooks/useDevices.js.map +1 -0
- package/dist/src/core/hooks/useTrackElementVisibility.d.ts +6 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js +27 -0
- package/dist/src/core/hooks/useTrackElementVisibility.js.map +1 -0
- package/dist/src/core/hooks/useVideoPublisher.js +35 -6
- package/dist/src/core/hooks/useVideoPublisher.js.map +1 -1
- package/dist/src/hooks/index.d.ts +0 -1
- package/dist/src/hooks/index.js +0 -1
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/utilities/applyElementToRef.d.ts +2 -0
- package/dist/src/utilities/applyElementToRef.js +8 -0
- package/dist/src/utilities/applyElementToRef.js.map +1 -0
- package/dist/src/utilities/chunk.d.ts +1 -0
- package/dist/src/utilities/chunk.js +5 -0
- package/dist/src/utilities/chunk.js.map +1 -0
- package/dist/src/utilities/index.d.ts +3 -0
- package/dist/src/utilities/index.js +4 -0
- package/dist/src/utilities/index.js.map +1 -0
- package/dist/src/utilities/isComponentType.d.ts +2 -0
- package/dist/src/utilities/isComponentType.js +7 -0
- package/dist/src/utilities/isComponentType.js.map +1 -0
- package/package.json +12 -10
- package/src/components/Button/CompositeButton.tsx +4 -13
- package/src/components/CallControls/AcceptCallButton.tsx +36 -0
- package/src/components/CallControls/CallControls.tsx +13 -19
- package/src/components/CallControls/CallStatsButton.tsx +6 -14
- package/src/components/CallControls/CancelCallButton.tsx +12 -4
- package/src/components/CallControls/ReactionsButton.tsx +1 -2
- package/src/components/CallControls/RecordCallButton.tsx +12 -7
- package/src/components/CallControls/ScreenShareButton.tsx +7 -8
- package/src/components/CallControls/ToggleAudioButton.tsx +23 -12
- package/src/components/CallControls/{ToggleCameraButton.tsx → ToggleVideoButton.tsx} +20 -13
- package/src/components/CallControls/index.ts +2 -2
- package/src/components/CallParticipantsList/BlockedUserListing.tsx +1 -2
- package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +27 -3
- package/src/components/CallParticipantsList/CallParticipantsList.tsx +1 -1
- package/src/components/{StreamCall → CallStats}/CallStats.tsx +3 -3
- package/src/components/CallStats/index.ts +2 -0
- package/src/components/Debug/DebugStatsView.tsx +60 -7
- package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +9 -4
- package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +3 -3
- package/src/components/Notification/SpeakingWhileMutedNotification.tsx +9 -8
- package/src/components/PendingCallPanel/PendingCallControls.tsx +27 -0
- package/src/components/PendingCallPanel/PendingCallPanel.tsx +71 -0
- package/src/components/PendingCallPanel/index.ts +2 -0
- package/src/components/Permissions/PermissionRequests.tsx +2 -8
- package/src/components/StreamCall/CallParticipantsScreenView.tsx +3 -4
- package/src/components/StreamCall/CallParticipantsView.tsx +3 -4
- package/src/components/StreamTheme/StreamTheme.tsx +19 -0
- package/src/components/StreamTheme/index.ts +1 -0
- package/src/components/Video/VideoPreview.tsx +16 -6
- package/src/components/Video/index.ts +1 -1
- package/src/components/index.ts +2 -2
- package/src/core/components/CallLayout/PaginatedGridLayout.tsx +32 -36
- package/src/core/components/CallLayout/SpeakerLayout.tsx +48 -25
- package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +160 -0
- package/src/core/components/ParticipantView/ParticipantView.tsx +156 -0
- package/src/core/components/ParticipantView/index.ts +2 -0
- package/src/core/components/StreamCall/StreamCall.tsx +157 -0
- package/src/core/components/StreamCall/index.ts +1 -0
- package/src/core/components/Video/BaseVideo.tsx +9 -24
- package/src/core/components/Video/DefaultVideoPlaceholder.tsx +36 -0
- package/src/core/components/Video/Video.tsx +62 -48
- package/src/core/components/index.ts +3 -2
- package/src/core/contexts/MediaDevicesContext.tsx +179 -136
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/useAudioPublisher.ts +9 -3
- package/src/core/hooks/useDevices.ts +161 -0
- package/src/core/hooks/useTrackElementVisibility.ts +44 -0
- package/src/core/hooks/useVideoPublisher.ts +36 -4
- package/src/hooks/index.ts +0 -1
- package/src/utilities/applyElementToRef.ts +12 -0
- package/src/utilities/chunk.ts +8 -0
- package/src/utilities/index.ts +3 -0
- package/src/utilities/isComponentType.ts +9 -0
- package/dist/src/components/CallControls/ToggleCameraButton.d.ts +0 -10
- package/dist/src/components/CallControls/ToggleCameraButton.js.map +0 -1
- package/dist/src/components/CallControls/ToggleParticipantListButton.d.ts +0 -6
- package/dist/src/components/CallControls/ToggleParticipantListButton.js +0 -7
- package/dist/src/components/CallControls/ToggleParticipantListButton.js.map +0 -1
- package/dist/src/components/Moderation/Restricted.d.ts +0 -19
- package/dist/src/components/Moderation/Restricted.js +0 -13
- package/dist/src/components/Moderation/Restricted.js.map +0 -1
- package/dist/src/components/Moderation/index.d.ts +0 -1
- package/dist/src/components/Moderation/index.js +0 -2
- package/dist/src/components/Moderation/index.js.map +0 -1
- package/dist/src/components/StreamCall/CallStats.d.ts +0 -2
- package/dist/src/components/StreamCall/CallStats.js.map +0 -1
- package/dist/src/components/StreamCall/CallStatsLatencyChart.js.map +0 -1
- package/dist/src/components/StreamMeeting/StreamMeeting.d.ts +0 -34
- package/dist/src/components/StreamMeeting/StreamMeeting.js +0 -26
- package/dist/src/components/StreamMeeting/StreamMeeting.js.map +0 -1
- package/dist/src/components/StreamMeeting/index.d.ts +0 -1
- package/dist/src/components/StreamMeeting/index.js +0 -2
- package/dist/src/components/StreamMeeting/index.js.map +0 -1
- package/dist/src/core/components/ParticipantBox/ParticipantBox.d.ts +0 -48
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js +0 -58
- package/dist/src/core/components/ParticipantBox/ParticipantBox.js.map +0 -1
- package/dist/src/core/components/ParticipantBox/index.d.ts +0 -1
- package/dist/src/core/components/ParticipantBox/index.js +0 -2
- package/dist/src/core/components/ParticipantBox/index.js.map +0 -1
- package/dist/src/core/components/Video/VideoPlaceholder.d.ts +0 -6
- package/dist/src/core/components/Video/VideoPlaceholder.js +0 -12
- package/dist/src/core/components/Video/VideoPlaceholder.js.map +0 -1
- package/dist/src/hooks/useRtcStats.d.ts +0 -11
- package/dist/src/hooks/useRtcStats.js +0 -39
- package/dist/src/hooks/useRtcStats.js.map +0 -1
- package/src/components/CallControls/ToggleParticipantListButton.tsx +0 -17
- package/src/components/Moderation/Restricted.tsx +0 -38
- package/src/components/Moderation/index.ts +0 -1
- package/src/components/StreamMeeting/StreamMeeting.tsx +0 -80
- package/src/components/StreamMeeting/index.ts +0 -1
- package/src/core/components/ParticipantBox/ParticipantBox.tsx +0 -248
- package/src/core/components/ParticipantBox/index.ts +0 -1
- package/src/core/components/Video/VideoPlaceholder.tsx +0 -40
- package/src/hooks/useRtcStats.ts +0 -36
- /package/dist/src/components/{StreamCall → CallStats}/CallStatsLatencyChart.d.ts +0 -0
- /package/dist/src/components/{StreamCall → CallStats}/CallStatsLatencyChart.js +0 -0
- /package/src/components/{StreamCall → CallStats}/CallStatsLatencyChart.tsx +0 -0
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { OwnCapability } from '@stream-io/video-client';
|
|
3
|
-
import { useCall, useOwnCapabilities } from '@stream-io/video-react-bindings';
|
|
4
|
-
|
|
5
|
-
type RestrictedProps = PropsWithChildren<{
|
|
6
|
-
/**
|
|
7
|
-
* OwnCapabilities of the participant - grants they have available
|
|
8
|
-
*/
|
|
9
|
-
availableGrants?: OwnCapability[];
|
|
10
|
-
/**
|
|
11
|
-
* Required grants for the component to be able to render supplied children elements
|
|
12
|
-
*/
|
|
13
|
-
requiredGrants: OwnCapability[];
|
|
14
|
-
/**
|
|
15
|
-
* Require all grants specified in `requiredGrants` to be available in the `availableGrants`,
|
|
16
|
-
* component by default requires only one grant to appear in both arrays to render its children
|
|
17
|
-
*/
|
|
18
|
-
requireAll?: boolean;
|
|
19
|
-
}>;
|
|
20
|
-
|
|
21
|
-
export const Restricted = ({
|
|
22
|
-
availableGrants: availableGrantsFromProps,
|
|
23
|
-
requiredGrants,
|
|
24
|
-
requireAll = true,
|
|
25
|
-
children,
|
|
26
|
-
}: RestrictedProps) => {
|
|
27
|
-
const call = useCall();
|
|
28
|
-
const ownCapabilities = useOwnCapabilities();
|
|
29
|
-
const availableGrants = availableGrantsFromProps || ownCapabilities;
|
|
30
|
-
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](
|
|
31
|
-
(capability) => availableGrants.includes(capability),
|
|
32
|
-
);
|
|
33
|
-
const canRequest = requiredGrants.some(
|
|
34
|
-
(capability) => !!call && call.permissionsContext.canRequest(capability),
|
|
35
|
-
);
|
|
36
|
-
if (hasPermissions || canRequest) return <>{children}</>;
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Restricted';
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
2
|
-
import { Call, CallingState, JoinCallRequest } from '@stream-io/video-client';
|
|
3
|
-
import {
|
|
4
|
-
StreamCallProvider,
|
|
5
|
-
useStreamVideoClient,
|
|
6
|
-
} from '@stream-io/video-react-bindings';
|
|
7
|
-
import { MediaDevicesProvider, MediaDevicesProviderProps } from '../../core';
|
|
8
|
-
|
|
9
|
-
type InitWithCallCID = {
|
|
10
|
-
callId: string;
|
|
11
|
-
callType: string;
|
|
12
|
-
call?: never;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type InitWithCallInstance = {
|
|
16
|
-
call: Call | undefined;
|
|
17
|
-
callId?: never;
|
|
18
|
-
callType?: never;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type InitStreamMeeting = InitWithCallCID | InitWithCallInstance;
|
|
22
|
-
|
|
23
|
-
export type StreamMeetingProps = InitStreamMeeting & {
|
|
24
|
-
/**
|
|
25
|
-
* If true, the call will be joined automatically.
|
|
26
|
-
* Usually, in the "ring" scenario, this flag should be set to false as
|
|
27
|
-
* the callee should decide whether to join the call or not.
|
|
28
|
-
*
|
|
29
|
-
* @default true.
|
|
30
|
-
*/
|
|
31
|
-
autoJoin?: boolean;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* An optional data to pass when joining the call.
|
|
35
|
-
*/
|
|
36
|
-
data?: JoinCallRequest;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* An optional props to pass to the `MediaDevicesProvider`.
|
|
40
|
-
*/
|
|
41
|
-
mediaDevicesProviderProps?: MediaDevicesProviderProps;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const StreamMeeting = ({
|
|
45
|
-
children,
|
|
46
|
-
callId,
|
|
47
|
-
callType,
|
|
48
|
-
call,
|
|
49
|
-
autoJoin = true,
|
|
50
|
-
data,
|
|
51
|
-
mediaDevicesProviderProps,
|
|
52
|
-
}: PropsWithChildren<StreamMeetingProps>) => {
|
|
53
|
-
const client = useStreamVideoClient();
|
|
54
|
-
const [activeCall, setActiveCall] = useState<Call | undefined>(call);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!client) return;
|
|
58
|
-
|
|
59
|
-
if (callId && callType && !activeCall) {
|
|
60
|
-
const newCall = client.call(callType, callId);
|
|
61
|
-
setActiveCall(newCall);
|
|
62
|
-
}
|
|
63
|
-
}, [activeCall, callId, callType, client]);
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
if (autoJoin && activeCall?.state.callingState === CallingState.IDLE) {
|
|
67
|
-
activeCall.join(data).catch((err) => {
|
|
68
|
-
console.error(`Failed to join call`, err);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}, [activeCall, autoJoin, data]);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<StreamCallProvider call={activeCall}>
|
|
75
|
-
<MediaDevicesProvider {...mediaDevicesProviderProps}>
|
|
76
|
-
{children}
|
|
77
|
-
</MediaDevicesProvider>
|
|
78
|
-
</StreamCallProvider>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './StreamMeeting';
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { forwardRef, useEffect, useState } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import {
|
|
4
|
-
Call,
|
|
5
|
-
SfuModels,
|
|
6
|
-
StreamVideoParticipant,
|
|
7
|
-
VisibilityState,
|
|
8
|
-
} from '@stream-io/video-client';
|
|
9
|
-
import { useIsDebugMode } from '../../../components/Debug/useIsDebugMode';
|
|
10
|
-
import { DebugParticipantPublishQuality } from '../../../components/Debug/DebugParticipantPublishQuality';
|
|
11
|
-
import { DebugStatsView } from '../../../components/Debug/DebugStatsView';
|
|
12
|
-
import { Audio } from '../Audio/Audio';
|
|
13
|
-
import { Video } from '../../../components/Video';
|
|
14
|
-
import { Notification } from '../../../components/Notification';
|
|
15
|
-
import { Reaction } from '../../../components/Reaction';
|
|
16
|
-
import { MenuToggle, ToggleMenuButtonProps } from '../../../components/Menu';
|
|
17
|
-
import { IconButton } from '../../../components/Button';
|
|
18
|
-
import { ParticipantActionsContextMenu } from '../../../components/CallParticipantsList';
|
|
19
|
-
|
|
20
|
-
export interface ParticipantBoxProps {
|
|
21
|
-
/**
|
|
22
|
-
* The participant bound to this component.
|
|
23
|
-
*/
|
|
24
|
-
participant: StreamVideoParticipant;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The current call.
|
|
28
|
-
*/
|
|
29
|
-
call: Call;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* In supported browsers, this sets the default audio output.
|
|
33
|
-
* The value of this prop should be a valid Audio Output `deviceId`.
|
|
34
|
-
*/
|
|
35
|
-
sinkId?: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The kind of video stream to play for the given participant.
|
|
39
|
-
*/
|
|
40
|
-
videoKind?: 'video' | 'screen';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Turns on/off the status indicator icons (mute, connection quality, etc...).
|
|
44
|
-
*/
|
|
45
|
-
indicatorsVisible?: boolean;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Turns on/off the audio for the participant.
|
|
49
|
-
*/
|
|
50
|
-
muteAudio?: boolean;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* A function meant for exposing the "native" element ref to the integrators.
|
|
54
|
-
* The element can either be:
|
|
55
|
-
* - `<video />` for participants with enabled video.
|
|
56
|
-
* - `<div />` for participants with disabled video. This ref would point to
|
|
57
|
-
* the VideoPlaceholder component.
|
|
58
|
-
*
|
|
59
|
-
* @param element the element ref.
|
|
60
|
-
*/
|
|
61
|
-
setVideoElementRef?: (element: HTMLElement | null) => void;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* An additional list of class names to append to the root DOM element.
|
|
65
|
-
*/
|
|
66
|
-
className?: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The position of the toggle button menu, relative to its button element.
|
|
70
|
-
*/
|
|
71
|
-
toggleMenuPosition?: 'top' | 'bottom';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const ToggleButton = forwardRef<HTMLButtonElement, ToggleMenuButtonProps>(
|
|
75
|
-
(props, ref) => {
|
|
76
|
-
return <IconButton enabled={props.menuShown} icon="ellipsis" ref={ref} />;
|
|
77
|
-
},
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
export const ParticipantBox = (props: ParticipantBoxProps) => {
|
|
81
|
-
const {
|
|
82
|
-
participant,
|
|
83
|
-
indicatorsVisible = true,
|
|
84
|
-
videoKind = 'video',
|
|
85
|
-
call,
|
|
86
|
-
sinkId,
|
|
87
|
-
muteAudio,
|
|
88
|
-
setVideoElementRef,
|
|
89
|
-
className,
|
|
90
|
-
toggleMenuPosition = 'bottom',
|
|
91
|
-
} = props;
|
|
92
|
-
|
|
93
|
-
const {
|
|
94
|
-
audioStream,
|
|
95
|
-
videoStream,
|
|
96
|
-
isLoggedInUser: isLocalParticipant,
|
|
97
|
-
isDominantSpeaker,
|
|
98
|
-
isSpeaking,
|
|
99
|
-
publishedTracks,
|
|
100
|
-
connectionQuality,
|
|
101
|
-
sessionId,
|
|
102
|
-
reaction,
|
|
103
|
-
} = participant;
|
|
104
|
-
|
|
105
|
-
const hasAudio = publishedTracks.includes(SfuModels.TrackType.AUDIO);
|
|
106
|
-
const hasVideo = publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
107
|
-
const isPinned = !!participant.pinnedAt;
|
|
108
|
-
|
|
109
|
-
const [trackedElement, setTrackedElement] = useState<HTMLDivElement | null>(
|
|
110
|
-
null,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const connectionQualityAsString =
|
|
114
|
-
!!connectionQuality &&
|
|
115
|
-
String(SfuModels.ConnectionQuality[connectionQuality]).toLowerCase();
|
|
116
|
-
|
|
117
|
-
useEffect(() => {
|
|
118
|
-
if (!trackedElement) return;
|
|
119
|
-
|
|
120
|
-
const unobserve = call.viewportTracker.observe(trackedElement, (entry) => {
|
|
121
|
-
call.state.updateParticipant(sessionId, (p) => ({
|
|
122
|
-
...p,
|
|
123
|
-
viewportVisibilityState: entry.isIntersecting
|
|
124
|
-
? VisibilityState.VISIBLE
|
|
125
|
-
: VisibilityState.INVISIBLE,
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
return () => {
|
|
130
|
-
unobserve();
|
|
131
|
-
// reset visibility state to UNKNOWN upon cleanup
|
|
132
|
-
// so that the layouts that are not actively observed
|
|
133
|
-
// can still function normally (runtime layout switching)
|
|
134
|
-
call.state.updateParticipant(sessionId, (p) => ({
|
|
135
|
-
...p,
|
|
136
|
-
viewportVisibilityState: VisibilityState.UNKNOWN,
|
|
137
|
-
}));
|
|
138
|
-
};
|
|
139
|
-
}, [trackedElement, call.viewportTracker, call.state, sessionId]);
|
|
140
|
-
|
|
141
|
-
const isDebugMode = useIsDebugMode();
|
|
142
|
-
return (
|
|
143
|
-
<div
|
|
144
|
-
className={clsx(
|
|
145
|
-
'str-video__participant',
|
|
146
|
-
isSpeaking && 'str-video__participant--speaking',
|
|
147
|
-
!hasVideo && 'str-video__participant--no-video',
|
|
148
|
-
!hasAudio && 'str-video__participant--no-audio',
|
|
149
|
-
className,
|
|
150
|
-
)}
|
|
151
|
-
ref={setTrackedElement}
|
|
152
|
-
>
|
|
153
|
-
<MenuToggle
|
|
154
|
-
strategy="fixed"
|
|
155
|
-
placement={toggleMenuPosition === 'top' ? 'top-end' : 'bottom-end'}
|
|
156
|
-
ToggleButton={ToggleButton}
|
|
157
|
-
>
|
|
158
|
-
<ParticipantActionsContextMenu participant={participant} />
|
|
159
|
-
</MenuToggle>
|
|
160
|
-
|
|
161
|
-
<div className="str-video__video-container">
|
|
162
|
-
<Audio
|
|
163
|
-
// mute the local participant, as we don't want to hear ourselves
|
|
164
|
-
muted={participant.isLoggedInUser || muteAudio}
|
|
165
|
-
sinkId={sinkId}
|
|
166
|
-
audioStream={audioStream}
|
|
167
|
-
/>
|
|
168
|
-
<Video
|
|
169
|
-
call={call}
|
|
170
|
-
participant={participant}
|
|
171
|
-
kind={videoKind}
|
|
172
|
-
setVideoElementRef={setVideoElementRef}
|
|
173
|
-
className={clsx('str-video__remote-video', {
|
|
174
|
-
'str-video__remote-video--mirror':
|
|
175
|
-
isLocalParticipant && videoKind === 'video',
|
|
176
|
-
'str-video__screen-share': videoKind === 'screen',
|
|
177
|
-
})}
|
|
178
|
-
// mute the local participant, as we don't want to hear ourselves
|
|
179
|
-
muted={participant.isLoggedInUser}
|
|
180
|
-
autoPlay
|
|
181
|
-
/>
|
|
182
|
-
{reaction && (
|
|
183
|
-
<Reaction reaction={reaction} sessionId={sessionId} call={call} />
|
|
184
|
-
)}
|
|
185
|
-
<div className="str-video__participant_details">
|
|
186
|
-
<span className="str-video__participant_name">
|
|
187
|
-
{participant.name || participant.userId}
|
|
188
|
-
{indicatorsVisible && isDominantSpeaker && (
|
|
189
|
-
<span
|
|
190
|
-
className="str-video__participant_name--dominant_speaker"
|
|
191
|
-
title="Dominant speaker"
|
|
192
|
-
/>
|
|
193
|
-
)}
|
|
194
|
-
{indicatorsVisible && (
|
|
195
|
-
<Notification
|
|
196
|
-
isVisible={
|
|
197
|
-
isLocalParticipant &&
|
|
198
|
-
connectionQuality === SfuModels.ConnectionQuality.POOR
|
|
199
|
-
}
|
|
200
|
-
message="Poor connection quality. Please check your internet connection."
|
|
201
|
-
>
|
|
202
|
-
{connectionQualityAsString && (
|
|
203
|
-
<span
|
|
204
|
-
className={clsx(
|
|
205
|
-
'str-video__participant__connection-quality',
|
|
206
|
-
`str-video__participant__connection-quality--${connectionQualityAsString}`,
|
|
207
|
-
)}
|
|
208
|
-
title={connectionQualityAsString}
|
|
209
|
-
/>
|
|
210
|
-
)}
|
|
211
|
-
</Notification>
|
|
212
|
-
)}
|
|
213
|
-
{indicatorsVisible && !hasAudio && (
|
|
214
|
-
<span className="str-video__participant_name--audio-muted"></span>
|
|
215
|
-
)}
|
|
216
|
-
{indicatorsVisible && !hasVideo && (
|
|
217
|
-
<span className="str-video__participant_name--video-muted"></span>
|
|
218
|
-
)}
|
|
219
|
-
{indicatorsVisible && isPinned && (
|
|
220
|
-
// TODO: remove this monstrosity once we have a proper design
|
|
221
|
-
<span
|
|
222
|
-
title="Unpin"
|
|
223
|
-
onClick={() =>
|
|
224
|
-
call.setParticipantPinnedAt(participant.sessionId)
|
|
225
|
-
}
|
|
226
|
-
style={{ cursor: 'pointer' }}
|
|
227
|
-
className="str-video__participant_name--pinned"
|
|
228
|
-
></span>
|
|
229
|
-
)}
|
|
230
|
-
</span>
|
|
231
|
-
{isDebugMode && (
|
|
232
|
-
<>
|
|
233
|
-
<DebugParticipantPublishQuality
|
|
234
|
-
participant={participant}
|
|
235
|
-
call={call}
|
|
236
|
-
/>
|
|
237
|
-
<DebugStatsView
|
|
238
|
-
call={call}
|
|
239
|
-
kind={isLocalParticipant ? 'publisher' : 'subscriber'}
|
|
240
|
-
mediaStream={videoStream}
|
|
241
|
-
/>
|
|
242
|
-
</>
|
|
243
|
-
)}
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
);
|
|
248
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ParticipantBox';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, forwardRef, useState } from 'react';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import { StreamVideoParticipant } from '@stream-io/video-client';
|
|
4
|
-
|
|
5
|
-
export type VideoPlaceholderProps = {
|
|
6
|
-
participant: StreamVideoParticipant;
|
|
7
|
-
} & ComponentProps<'div'>;
|
|
8
|
-
|
|
9
|
-
export const VideoPlaceholder = forwardRef<
|
|
10
|
-
HTMLDivElement,
|
|
11
|
-
VideoPlaceholderProps
|
|
12
|
-
>(({ participant, style }, ref) => {
|
|
13
|
-
const [error, setError] = useState(false);
|
|
14
|
-
|
|
15
|
-
const name = participant?.name || participant?.userId;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="str-video__participant-placeholder" style={style} ref={ref}>
|
|
19
|
-
{(!participant.image || error) &&
|
|
20
|
-
(name ? (
|
|
21
|
-
<div className="str-video__participant-placeholder--initials-fallback">
|
|
22
|
-
<div>{name[0]}</div>
|
|
23
|
-
</div>
|
|
24
|
-
) : (
|
|
25
|
-
<div>Video is disabled</div>
|
|
26
|
-
))}
|
|
27
|
-
{participant.image && !error && (
|
|
28
|
-
<img
|
|
29
|
-
onError={() => setError(true)}
|
|
30
|
-
alt="participant-placeholder"
|
|
31
|
-
className={clsx('str-video__participant-placeholder--avatar', {
|
|
32
|
-
'str-video__participant-placeholder--avatar-speaking':
|
|
33
|
-
participant.isSpeaking,
|
|
34
|
-
})}
|
|
35
|
-
src={participant.image}
|
|
36
|
-
/>
|
|
37
|
-
)}
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
});
|
package/src/hooks/useRtcStats.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Call } from '@stream-io/video-client';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param call
|
|
7
|
-
* @param kind
|
|
8
|
-
* @param mediaStream
|
|
9
|
-
* @returns
|
|
10
|
-
*
|
|
11
|
-
* @category Call State
|
|
12
|
-
*/
|
|
13
|
-
export const useRtcStats = (
|
|
14
|
-
call: Call,
|
|
15
|
-
kind: 'subscriber' | 'publisher',
|
|
16
|
-
mediaStream?: MediaStream,
|
|
17
|
-
) => {
|
|
18
|
-
const [stats, setStats] = useState<Record<string, string>>();
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const intervalId = setInterval(async () => {
|
|
21
|
-
const [track] = mediaStream?.getVideoTracks() ?? [];
|
|
22
|
-
const rawStats = await call.getStats(kind, track);
|
|
23
|
-
const decodedStats: Record<string, string> = {};
|
|
24
|
-
rawStats?.forEach((s) => {
|
|
25
|
-
decodedStats[s.id] = s;
|
|
26
|
-
});
|
|
27
|
-
setStats(decodedStats);
|
|
28
|
-
}, 1500);
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
clearInterval(intervalId);
|
|
32
|
-
};
|
|
33
|
-
}, [call, kind, mediaStream]);
|
|
34
|
-
|
|
35
|
-
return stats;
|
|
36
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|