@stream-io/video-react-sdk 0.0.1-alpha.9 → 0.0.1-alpha.91
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 +22 -150
- 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
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { useCallback, useEffect } from 'react';
|
|
11
11
|
import { map } from 'rxjs';
|
|
12
|
-
import { CallingState, getVideoStream, OwnCapability, SfuModels, watchForAddedDefaultVideoDevice, watchForDisconnectedVideoDevice, } from '@stream-io/video-client';
|
|
13
|
-
import { useCall, useCallCallingState, useCallState, useLocalParticipant, } from '@stream-io/video-react-bindings';
|
|
12
|
+
import { CallingState, getVideoStream, OwnCapability, SfuModels, VideoSettingsCameraFacingEnum, watchForAddedDefaultVideoDevice, watchForDisconnectedVideoDevice, } from '@stream-io/video-client';
|
|
13
|
+
import { useCall, useCallCallingState, useCallMetadata, useCallState, useLocalParticipant, } from '@stream-io/video-react-bindings';
|
|
14
14
|
import { useDebugPreferredVideoCodec } from '../../components/Debug/useIsDebugMode';
|
|
15
15
|
/**
|
|
16
16
|
* @internal
|
|
@@ -24,6 +24,9 @@ export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
|
|
|
24
24
|
const { localParticipant$ } = callState;
|
|
25
25
|
const preferredCodec = useDebugPreferredVideoCodec();
|
|
26
26
|
const isPublishingVideo = participant === null || participant === void 0 ? void 0 : participant.publishedTracks.includes(SfuModels.TrackType.VIDEO);
|
|
27
|
+
const metadata = useCallMetadata();
|
|
28
|
+
const videoSettings = metadata === null || metadata === void 0 ? void 0 : metadata.settings.video;
|
|
29
|
+
const targetResolution = videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.target_resolution;
|
|
27
30
|
const publishVideoStream = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
31
|
if (!call)
|
|
29
32
|
return;
|
|
@@ -31,13 +34,25 @@ export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
|
|
|
31
34
|
throw new Error(`No permission to publish video`);
|
|
32
35
|
}
|
|
33
36
|
try {
|
|
34
|
-
const videoStream = yield getVideoStream(
|
|
37
|
+
const videoStream = yield getVideoStream({
|
|
38
|
+
deviceId: videoDeviceId,
|
|
39
|
+
width: targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.width,
|
|
40
|
+
height: targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.height,
|
|
41
|
+
facingMode: toFacingMode(videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.camera_facing),
|
|
42
|
+
});
|
|
35
43
|
yield call.publishVideoStream(videoStream, { preferredCodec });
|
|
36
44
|
}
|
|
37
45
|
catch (e) {
|
|
38
46
|
console.log('Failed to publish video stream', e);
|
|
39
47
|
}
|
|
40
|
-
}), [
|
|
48
|
+
}), [
|
|
49
|
+
call,
|
|
50
|
+
preferredCodec,
|
|
51
|
+
targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.height,
|
|
52
|
+
targetResolution === null || targetResolution === void 0 ? void 0 : targetResolution.width,
|
|
53
|
+
videoDeviceId,
|
|
54
|
+
videoSettings === null || videoSettings === void 0 ? void 0 : videoSettings.camera_facing,
|
|
55
|
+
]);
|
|
41
56
|
useEffect(() => {
|
|
42
57
|
if (callingState === CallingState.JOINED && !initialVideoMuted) {
|
|
43
58
|
publishVideoStream().catch((e) => {
|
|
@@ -71,12 +86,16 @@ export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
|
|
|
71
86
|
// We need to stop the original track first in order
|
|
72
87
|
// we can retrieve the new default device stream
|
|
73
88
|
track.stop();
|
|
74
|
-
const videoStream = yield getVideoStream(
|
|
89
|
+
const videoStream = yield getVideoStream({
|
|
90
|
+
deviceId: 'default',
|
|
91
|
+
});
|
|
75
92
|
yield call.publishVideoStream(videoStream);
|
|
76
93
|
}));
|
|
77
94
|
const handleTrackEnded = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
95
|
if (selectedVideoDeviceId === videoDeviceId) {
|
|
79
|
-
const videoStream = yield getVideoStream(
|
|
96
|
+
const videoStream = yield getVideoStream({
|
|
97
|
+
deviceId: videoDeviceId,
|
|
98
|
+
});
|
|
80
99
|
yield call.publishVideoStream(videoStream);
|
|
81
100
|
}
|
|
82
101
|
});
|
|
@@ -88,4 +107,14 @@ export const useVideoPublisher = ({ initialVideoMuted, videoDeviceId, }) => {
|
|
|
88
107
|
}, [videoDeviceId, call, participant === null || participant === void 0 ? void 0 : participant.videoStream, isPublishingVideo]);
|
|
89
108
|
return publishVideoStream;
|
|
90
109
|
};
|
|
110
|
+
const toFacingMode = (value) => {
|
|
111
|
+
switch (value) {
|
|
112
|
+
case VideoSettingsCameraFacingEnum.FRONT:
|
|
113
|
+
return 'user';
|
|
114
|
+
case VideoSettingsCameraFacingEnum.BACK:
|
|
115
|
+
return 'environment';
|
|
116
|
+
default:
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
91
120
|
//# sourceMappingURL=useVideoPublisher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVideoPublisher.js","sourceRoot":"","sources":["../../../../src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AQ,EAAE,SAAS;aACpB,CAAC,CAAC;YACH,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC,CAAA,CACF,CAAC;QAEF,MAAM,gBAAgB,GAAG,GAAS,EAAE;YAClC,IAAI,qBAAqB,KAAK,aAAa,EAAE;gBAC3C,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC;oBACvC,QAAQ,EAAE,aAAa;iBACxB,CAAC,CAAC;gBACH,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;aAC5C;QACH,CAAC,CAAA,CAAC;QAEF,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YACrD,sBAAsB,CAAC,WAAW,EAAE,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEvE,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAgD,EAAE,EAAE;IACxE,QAAQ,KAAK,EAAE;QACb,KAAK,6BAA6B,CAAC,KAAK;YACtC,OAAO,MAAM,CAAC;QAChB,KAAK,6BAA6B,CAAC,IAAI;YACrC,OAAO,aAAa,CAAC;QACvB;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC,CAAC"}
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyElementToRef.js","sourceRoot":"","sources":["../../../src/utilities/applyElementToRef.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAoB,EACpB,OAAU,EACV,EAAE;IACF,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnD,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chunk: <T extends unknown[]>(array: T, size: number) => T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../src/utilities/chunk.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAsB,KAAQ,EAAE,IAAY,EAAE,EAAE;IACnE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC,IAAI,CACf,EAAE,MAAM,EAAE,UAAU,EAAE,EACtB,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,CAAM,CAClE,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ComponentType, ReactElement } from 'react';
|
|
2
|
+
export declare const isComponentType: <T extends {}>(elementOrComponent?: ReactElement<any, string | import("react").JSXElementConstructor<any>> | ComponentType<T> | null | undefined) => elementOrComponent is ComponentType<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isComponentType.js","sourceRoot":"","sources":["../../../src/utilities/isComponentType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAgB,MAAM,OAAO,CAAC;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,kBAA2D,EACnB,EAAE;IAC1C,OAAO,kBAAkB,KAAK,IAAI;QAChC,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean": "rimraf dist",
|
|
9
9
|
"start": "tsc --project tsconfig.json --watch",
|
|
10
|
-
"build": "tsc --project tsconfig.production.json",
|
|
11
|
-
"copy-css": "cp -
|
|
12
|
-
"generate-docs": "../../scripts/generate-docs.sh React @stream-io/video-react-sdk react-sdk",
|
|
10
|
+
"build": "tsc --project tsconfig.production.json && yarn copy-css",
|
|
11
|
+
"copy-css": "cp -R ../../node_modules/@stream-io/video-styling/dist/* dist/",
|
|
12
|
+
"generate-docs": "../../scripts/generate-docs-react.sh React @stream-io/video-react-sdk react-sdk",
|
|
13
13
|
"start:docs": "npx stream-chat-docusaurus -s"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
@@ -25,25 +25,27 @@
|
|
|
25
25
|
"@floating-ui/react": "^0.22.0",
|
|
26
26
|
"@nivo/core": "^0.80.0",
|
|
27
27
|
"@nivo/line": "^0.80.0",
|
|
28
|
-
"@stream-io/i18n": "^0.0.1-alpha.
|
|
29
|
-
"@stream-io/video-client": "^0.0.
|
|
30
|
-
"@stream-io/video-react-bindings": "^0.0.1-alpha.
|
|
28
|
+
"@stream-io/i18n": "^0.0.1-alpha.73",
|
|
29
|
+
"@stream-io/video-client": "^0.0.2-alpha.2",
|
|
30
|
+
"@stream-io/video-react-bindings": "^0.0.1-alpha.84",
|
|
31
31
|
"clsx": "^1.2.1",
|
|
32
|
-
"rxjs": "~7.
|
|
32
|
+
"rxjs": "~7.8.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0",
|
|
36
36
|
"react-dom": "^18.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@stream-io/video-styling": "^0.0.1-alpha.
|
|
39
|
+
"@stream-io/video-styling": "^0.0.1-alpha.68",
|
|
40
|
+
"@types/prop-types": "^15.7.5",
|
|
40
41
|
"@types/rimraf": "^3.0.2",
|
|
42
|
+
"prop-types": "^15.8.1",
|
|
41
43
|
"react": "^18.2.0",
|
|
42
44
|
"react-dom": "^18.2.0",
|
|
43
45
|
"replace-in-file": "^6.3.5",
|
|
44
46
|
"rimraf": "^3.0.2",
|
|
45
|
-
"typedoc": "^0.
|
|
47
|
+
"typedoc": "^0.24.7",
|
|
46
48
|
"typescript": "^4.9.5"
|
|
47
49
|
},
|
|
48
|
-
"version": "0.0.1-alpha.
|
|
50
|
+
"version": "0.0.1-alpha.91"
|
|
49
51
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { MenuToggle, ToggleMenuButtonProps } from '../Menu';
|
|
3
|
-
import {
|
|
4
|
-
ComponentType,
|
|
5
|
-
forwardRef,
|
|
6
|
-
isValidElement,
|
|
7
|
-
PropsWithChildren,
|
|
8
|
-
} from 'react';
|
|
9
|
-
import { IconButton } from './IconButton';
|
|
3
|
+
import { ComponentType, forwardRef, PropsWithChildren } from 'react';
|
|
10
4
|
import { Placement } from '@floating-ui/react';
|
|
11
5
|
|
|
6
|
+
import { IconButton } from './IconButton';
|
|
7
|
+
import { isComponentType } from '../../utilities';
|
|
8
|
+
|
|
12
9
|
export type IconButtonWithMenuProps = PropsWithChildren<{
|
|
13
10
|
active?: boolean;
|
|
14
11
|
Menu?: ComponentType | JSX.Element;
|
|
@@ -16,12 +13,6 @@ export type IconButtonWithMenuProps = PropsWithChildren<{
|
|
|
16
13
|
menuPlacement?: Placement;
|
|
17
14
|
}>;
|
|
18
15
|
|
|
19
|
-
const isComponentType = (
|
|
20
|
-
elementOrComponent: ComponentType | JSX.Element,
|
|
21
|
-
): elementOrComponent is ComponentType => {
|
|
22
|
-
return !isValidElement(elementOrComponent);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
16
|
export const CompositeButton = forwardRef<
|
|
26
17
|
HTMLDivElement,
|
|
27
18
|
IconButtonWithMenuProps
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MouseEventHandler, useCallback } from 'react';
|
|
2
|
+
import { IconButton } from '../Button';
|
|
3
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
4
|
+
|
|
5
|
+
export type AcceptCallButtonProps = {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
8
|
+
onAccept?: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const AcceptCallButton = ({
|
|
12
|
+
disabled,
|
|
13
|
+
onAccept,
|
|
14
|
+
onClick,
|
|
15
|
+
}: AcceptCallButtonProps) => {
|
|
16
|
+
const call = useCall();
|
|
17
|
+
const handleClick: MouseEventHandler<HTMLButtonElement> = useCallback(
|
|
18
|
+
async (e) => {
|
|
19
|
+
if (onClick) {
|
|
20
|
+
onClick(e);
|
|
21
|
+
} else if (call) {
|
|
22
|
+
await call.join();
|
|
23
|
+
onAccept?.();
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[onClick, onAccept, call],
|
|
27
|
+
);
|
|
28
|
+
return (
|
|
29
|
+
<IconButton
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
icon="call-accept"
|
|
32
|
+
variant="success"
|
|
33
|
+
onClick={handleClick}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import { Call } from '@stream-io/video-client';
|
|
2
1
|
import {
|
|
3
2
|
CallStatsButton,
|
|
4
3
|
CancelCallButton,
|
|
5
4
|
RecordCallButton,
|
|
6
5
|
ScreenShareButton,
|
|
7
6
|
ToggleAudioPublishingButton,
|
|
8
|
-
|
|
7
|
+
ToggleVideoPublishingButton,
|
|
9
8
|
} from './index';
|
|
10
9
|
import { SpeakingWhileMutedNotification } from '../Notification';
|
|
11
10
|
|
|
12
11
|
export type CallControlsProps = {
|
|
13
|
-
call: Call;
|
|
14
12
|
onLeave?: () => void;
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
export const CallControls = (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<CancelCallButton call={call} onLeave={onLeave} />
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
15
|
+
export const CallControls = ({ onLeave }: CallControlsProps) => (
|
|
16
|
+
<div className="str-video__call-controls">
|
|
17
|
+
<RecordCallButton />
|
|
18
|
+
<CallStatsButton />
|
|
19
|
+
<ScreenShareButton />
|
|
20
|
+
<SpeakingWhileMutedNotification>
|
|
21
|
+
<ToggleAudioPublishingButton />
|
|
22
|
+
</SpeakingWhileMutedNotification>
|
|
23
|
+
<ToggleVideoPublishingButton />
|
|
24
|
+
<CancelCallButton onLeave={onLeave} />
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { CallStats } from '../
|
|
3
|
+
import { CallStats } from '../CallStats';
|
|
4
4
|
import { CompositeButton, IconButton } from '../Button/';
|
|
5
5
|
import { MenuToggle, ToggleMenuButtonProps } from '../Menu';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
caption = 'Stats',
|
|
13
|
-
}: CallStatsButtonProps) => {
|
|
14
|
-
return (
|
|
15
|
-
<MenuToggle placement="top-end" ToggleButton={ToggleMenuButton}>
|
|
16
|
-
<CallStats />
|
|
17
|
-
</MenuToggle>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
7
|
+
export const CallStatsButton = () => (
|
|
8
|
+
<MenuToggle placement="top-end" ToggleButton={ToggleMenuButton}>
|
|
9
|
+
<CallStats />
|
|
10
|
+
</MenuToggle>
|
|
11
|
+
);
|
|
20
12
|
|
|
21
13
|
const ToggleMenuButton = forwardRef<
|
|
22
14
|
HTMLDivElement,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { MouseEventHandler, useCallback } from 'react';
|
|
2
|
-
import { Call } from '@stream-io/video-client';
|
|
3
2
|
import { IconButton } from '../Button/';
|
|
3
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
4
4
|
|
|
5
5
|
export type CancelCallButtonProps = {
|
|
6
|
-
|
|
6
|
+
disabled?: boolean;
|
|
7
7
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
8
8
|
onLeave?: () => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const CancelCallButton = ({
|
|
12
|
-
|
|
12
|
+
disabled,
|
|
13
13
|
onClick,
|
|
14
14
|
onLeave,
|
|
15
15
|
}: CancelCallButtonProps) => {
|
|
16
|
+
const call = useCall();
|
|
16
17
|
const handleClick: MouseEventHandler<HTMLButtonElement> = useCallback(
|
|
17
18
|
async (e) => {
|
|
18
19
|
if (onClick) {
|
|
@@ -24,5 +25,12 @@ export const CancelCallButton = ({
|
|
|
24
25
|
},
|
|
25
26
|
[onClick, onLeave, call],
|
|
26
27
|
);
|
|
27
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
<IconButton
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
icon="call-end"
|
|
32
|
+
variant="danger"
|
|
33
|
+
onClick={handleClick}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
28
36
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { OwnCapability, StreamReaction } from '@stream-io/video-client';
|
|
2
|
-
import { useCall } from '@stream-io/video-react-bindings';
|
|
2
|
+
import { Restricted, useCall } from '@stream-io/video-react-bindings';
|
|
3
3
|
|
|
4
4
|
import { CompositeButton, IconButton } from '../Button';
|
|
5
5
|
import { defaultEmojiReactions } from '../Reaction';
|
|
6
|
-
import { Restricted } from '../Moderation';
|
|
7
6
|
|
|
8
7
|
export const defaultReactions: StreamReaction[] = [
|
|
9
8
|
{
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { OwnCapability } from '@stream-io/video-client';
|
|
3
|
+
import {
|
|
4
|
+
Restricted,
|
|
5
|
+
useCall,
|
|
6
|
+
useIsCallRecordingInProgress,
|
|
7
|
+
} from '@stream-io/video-react-bindings';
|
|
4
8
|
import { CompositeButton, IconButton } from '../Button/';
|
|
5
9
|
import { LoadingIndicator } from '../LoadingIndicator';
|
|
6
|
-
import { Restricted } from '../Moderation';
|
|
7
10
|
|
|
8
11
|
export type RecordCallButtonProps = {
|
|
9
|
-
call: Call;
|
|
10
12
|
caption?: string;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export const RecordCallButton = ({
|
|
14
|
-
call,
|
|
15
16
|
caption = 'Record',
|
|
16
17
|
}: RecordCallButtonProps) => {
|
|
18
|
+
const call = useCall();
|
|
17
19
|
const isCallRecordingInProgress = useIsCallRecordingInProgress();
|
|
18
20
|
const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);
|
|
19
21
|
useEffect(() => {
|
|
@@ -30,9 +32,9 @@ export const RecordCallButton = ({
|
|
|
30
32
|
try {
|
|
31
33
|
setIsAwaitingResponse(true);
|
|
32
34
|
if (isCallRecordingInProgress) {
|
|
33
|
-
await call
|
|
35
|
+
await call?.stopRecording();
|
|
34
36
|
} else {
|
|
35
|
-
await call
|
|
37
|
+
await call?.startRecording();
|
|
36
38
|
}
|
|
37
39
|
} catch (e) {
|
|
38
40
|
console.error(`Failed start recording`, e);
|
|
@@ -57,6 +59,9 @@ export const RecordCallButton = ({
|
|
|
57
59
|
/>
|
|
58
60
|
) : (
|
|
59
61
|
<IconButton
|
|
62
|
+
// FIXME OL: sort out this ambiguity
|
|
63
|
+
enabled={!!call}
|
|
64
|
+
disabled={!call}
|
|
60
65
|
icon={isCallRecordingInProgress ? 'recording-on' : 'recording-off'}
|
|
61
66
|
title="Record call"
|
|
62
67
|
onClick={toggleRecording}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Call,
|
|
4
3
|
getScreenShareStream,
|
|
5
4
|
OwnCapability,
|
|
6
5
|
SfuModels,
|
|
7
6
|
} from '@stream-io/video-client';
|
|
8
7
|
import {
|
|
8
|
+
Restricted,
|
|
9
|
+
useCall,
|
|
9
10
|
useHasOngoingScreenShare,
|
|
10
11
|
useHasPermissions,
|
|
11
12
|
useLocalParticipant,
|
|
12
13
|
} from '@stream-io/video-react-bindings';
|
|
13
14
|
import { CompositeButton, IconButton } from '../Button/';
|
|
14
15
|
import { PermissionNotification } from '../Notification';
|
|
15
|
-
import { Restricted } from '../Moderation';
|
|
16
16
|
|
|
17
17
|
export type ScreenShareButtonProps = {
|
|
18
|
-
call: Call;
|
|
19
18
|
caption?: string;
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
export const ScreenShareButton = ({
|
|
23
|
-
call,
|
|
24
22
|
caption = 'Screen Share',
|
|
25
23
|
}: ScreenShareButtonProps) => {
|
|
24
|
+
const call = useCall();
|
|
26
25
|
const localParticipant = useLocalParticipant();
|
|
27
26
|
const isSomeoneScreenSharing = useHasOngoingScreenShare();
|
|
28
27
|
const isScreenSharing = localParticipant?.publishedTracks.includes(
|
|
@@ -49,11 +48,11 @@ export const ScreenShareButton = ({
|
|
|
49
48
|
<IconButton
|
|
50
49
|
icon={isScreenSharing ? 'screen-share-on' : 'screen-share-off'}
|
|
51
50
|
title="Share screen"
|
|
52
|
-
disabled={!isScreenSharing && isSomeoneScreenSharing}
|
|
51
|
+
disabled={(!isScreenSharing && isSomeoneScreenSharing) || !call}
|
|
53
52
|
onClick={async () => {
|
|
54
53
|
if (
|
|
55
54
|
!hasPermission &&
|
|
56
|
-
call
|
|
55
|
+
call?.permissionsContext.canRequest(OwnCapability.SCREENSHARE)
|
|
57
56
|
) {
|
|
58
57
|
setIsAwaitingApproval(true);
|
|
59
58
|
await call
|
|
@@ -71,10 +70,10 @@ export const ScreenShareButton = ({
|
|
|
71
70
|
console.log(`Can't share screen: ${e}`);
|
|
72
71
|
});
|
|
73
72
|
if (stream) {
|
|
74
|
-
await call
|
|
73
|
+
await call?.publishScreenShareStream(stream);
|
|
75
74
|
}
|
|
76
75
|
} else {
|
|
77
|
-
await call
|
|
76
|
+
await call?.stopPublish(SfuModels.TrackType.SCREEN_SHARE);
|
|
78
77
|
}
|
|
79
78
|
}}
|
|
80
79
|
/>
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { OwnCapability, SfuModels } from '@stream-io/video-client';
|
|
3
3
|
import {
|
|
4
|
+
Restricted,
|
|
4
5
|
useCall,
|
|
5
6
|
useHasPermissions,
|
|
6
|
-
useLocalParticipant,
|
|
7
7
|
useI18n,
|
|
8
|
+
useLocalParticipant,
|
|
8
9
|
} from '@stream-io/video-react-bindings';
|
|
9
10
|
|
|
10
|
-
import { useMediaDevices } from '../../core
|
|
11
|
+
import { useMediaDevices } from '../../core';
|
|
11
12
|
import { DeviceSelectorAudioInput } from '../DeviceSettings';
|
|
12
13
|
import { CompositeButton, IconButton } from '../Button';
|
|
13
14
|
import { PermissionNotification } from '../Notification';
|
|
14
|
-
import { Restricted } from '../Moderation';
|
|
15
15
|
|
|
16
16
|
export type ToggleAudioPreviewButtonProps = { caption?: string };
|
|
17
17
|
|
|
18
18
|
export const ToggleAudioPreviewButton = ({
|
|
19
19
|
caption,
|
|
20
20
|
}: ToggleAudioPreviewButtonProps) => {
|
|
21
|
-
const { initialAudioEnabled,
|
|
21
|
+
const { initialAudioEnabled, toggleInitialAudioMuteState } =
|
|
22
|
+
useMediaDevices();
|
|
22
23
|
const { t } = useI18n();
|
|
23
24
|
|
|
24
25
|
return (
|
|
@@ -29,7 +30,7 @@ export const ToggleAudioPreviewButton = ({
|
|
|
29
30
|
>
|
|
30
31
|
<IconButton
|
|
31
32
|
icon={initialAudioEnabled ? 'mic' : 'mic-off'}
|
|
32
|
-
onClick={
|
|
33
|
+
onClick={toggleInitialAudioMuteState}
|
|
33
34
|
/>
|
|
34
35
|
</CompositeButton>
|
|
35
36
|
);
|
|
@@ -39,12 +40,16 @@ export type ToggleAudioPublishingButtonProps = {
|
|
|
39
40
|
caption?: string;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
export const ToggleAudioPublishingButton = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const { publishAudioStream, stopPublishingAudio } =
|
|
43
|
+
export const ToggleAudioPublishingButton = (
|
|
44
|
+
props: ToggleAudioPublishingButtonProps,
|
|
45
|
+
) => {
|
|
46
|
+
const { publishAudioStream, stopPublishingAudio, setInitialAudioEnabled } =
|
|
47
|
+
useMediaDevices();
|
|
46
48
|
const localParticipant = useLocalParticipant();
|
|
47
49
|
const { t } = useI18n();
|
|
50
|
+
|
|
51
|
+
const { caption = t('Mic') } = props;
|
|
52
|
+
|
|
48
53
|
const isAudioMute = !localParticipant?.publishedTracks.includes(
|
|
49
54
|
SfuModels.TrackType.AUDIO,
|
|
50
55
|
);
|
|
@@ -74,8 +79,13 @@ export const ToggleAudioPublishingButton = ({
|
|
|
74
79
|
});
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
|
-
if (isAudioMute
|
|
78
|
-
|
|
82
|
+
if (isAudioMute) {
|
|
83
|
+
if (hasPermission) {
|
|
84
|
+
setInitialAudioEnabled(true);
|
|
85
|
+
await publishAudioStream();
|
|
86
|
+
} else {
|
|
87
|
+
console.log('Cannot publish audio stream. Insufficient permissions.');
|
|
88
|
+
}
|
|
79
89
|
} else {
|
|
80
90
|
stopPublishingAudio();
|
|
81
91
|
}
|
|
@@ -84,6 +94,7 @@ export const ToggleAudioPublishingButton = ({
|
|
|
84
94
|
hasPermission,
|
|
85
95
|
isAudioMute,
|
|
86
96
|
publishAudioStream,
|
|
97
|
+
setInitialAudioEnabled,
|
|
87
98
|
stopPublishingAudio,
|
|
88
99
|
]);
|
|
89
100
|
|
|
@@ -99,7 +110,7 @@ export const ToggleAudioPublishingButton = ({
|
|
|
99
110
|
<CompositeButton
|
|
100
111
|
Menu={DeviceSelectorAudioInput}
|
|
101
112
|
active={isAudioMute}
|
|
102
|
-
caption={caption
|
|
113
|
+
caption={caption}
|
|
103
114
|
>
|
|
104
115
|
<IconButton
|
|
105
116
|
icon={isAudioMute ? 'mic-off' : 'mic'}
|