@selfcommunity/react-ui 0.8.0-live.42 → 0.8.0-live.44
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/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +22 -16
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.d.ts +17 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +5 -3
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +68 -75
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -0
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +21 -15
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.d.ts +17 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +6 -4
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +69 -76
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +2 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
- package/lib/umd/245.js +0 -1
package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
-
// @ts-nocheck
|
|
5
3
|
import { Box, CircularProgress } from '@mui/material';
|
|
6
4
|
import { styled } from '@mui/material/styles';
|
|
7
5
|
import { useThemeProps } from '@mui/system';
|
|
@@ -9,9 +7,7 @@ import { useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
|
9
7
|
import classNames from 'classnames';
|
|
10
8
|
import { PREFIX } from './constants';
|
|
11
9
|
import { ConnectionState, formatChatMessageLinks, LiveKitRoom, VideoConference } from '@livekit/components-react';
|
|
12
|
-
import {
|
|
13
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
14
|
-
import { decodePassphrase } from '../../../utils/liveStream';
|
|
10
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
15
11
|
import RecordingIndicator from './RecordingIndicator';
|
|
16
12
|
import { defaultUserChoices } from '@livekit/components-core';
|
|
17
13
|
import { defaultVideoOptions } from '../constants';
|
|
@@ -58,16 +54,15 @@ export default function LiveStreamVideoConference(inProps) {
|
|
|
58
54
|
const scUserContext = useSCUser();
|
|
59
55
|
const { preferences, features } = useSCPreferences();
|
|
60
56
|
// Passphrase
|
|
61
|
-
const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
|
|
57
|
+
// const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
|
|
62
58
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
63
59
|
// @ts-ignore
|
|
64
|
-
const worker = typeof window !== 'undefined' && e2eePassphrase && new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));
|
|
65
|
-
const e2eeEnabled = !!(e2eePassphrase && worker);
|
|
66
|
-
const keyProvider = new ExternalE2EEKeyProvider();
|
|
67
|
-
const [e2eeSetupComplete, setE2eeSetupComplete] = useState(
|
|
68
|
-
const [liveActive, setLiveActive] = useState(
|
|
60
|
+
// const worker = typeof window !== 'undefined' && e2eePassphrase && new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));
|
|
61
|
+
// const e2eeEnabled = !!(e2eePassphrase && worker);
|
|
62
|
+
// const keyProvider = new ExternalE2EEKeyProvider();
|
|
63
|
+
const [e2eeSetupComplete, setE2eeSetupComplete] = useState(true);
|
|
64
|
+
const [liveActive, setLiveActive] = useState(true);
|
|
69
65
|
const [error, setError] = useState(null);
|
|
70
|
-
const liveStreamRoomMaxParticipants = 25;
|
|
71
66
|
/* const liveStreamRoomMaxParticipants = useMemo(
|
|
72
67
|
() =>
|
|
73
68
|
preferences &&
|
|
@@ -76,76 +71,74 @@ export default function LiveStreamVideoConference(inProps) {
|
|
|
76
71
|
[preferences]
|
|
77
72
|
); */
|
|
78
73
|
// Room options
|
|
79
|
-
const roomOptions = useMemo(() => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, [liveStreamRoomMaxParticipants, userChoices, options.hq, options.codec]);
|
|
74
|
+
/* const roomOptions = useMemo((): RoomOptions => {
|
|
75
|
+
let videoCodec: VideoCodec | undefined = options.codec ? options.codec : defaultVideoOptions.codec;
|
|
76
|
+
if (e2eeEnabled && (videoCodec === 'av1' || videoCodec === 'vp9')) {
|
|
77
|
+
videoCodec = undefined;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
// emptyTimeout: 3 * 60, // 3 minutes
|
|
81
|
+
// maxParticipants: liveStreamRoomMaxParticipants,
|
|
82
|
+
videoCaptureDefaults: {
|
|
83
|
+
deviceId: userChoices.videoDeviceId ?? undefined,
|
|
84
|
+
resolution: options.hq ? VideoPresets.h2160 : VideoPresets.h720
|
|
85
|
+
},
|
|
86
|
+
publishDefaults: {
|
|
87
|
+
dtx: false,
|
|
88
|
+
videoSimulcastLayers: options.hq ? [VideoPresets.h1080, VideoPresets.h720] : [VideoPresets.h540, VideoPresets.h216],
|
|
89
|
+
red: !e2eeEnabled,
|
|
90
|
+
videoCodec
|
|
91
|
+
},
|
|
92
|
+
audioCaptureDefaults: {
|
|
93
|
+
deviceId: userChoices.audioDeviceId ?? undefined
|
|
94
|
+
},
|
|
95
|
+
adaptiveStream: {pixelDensity: 'screen'},
|
|
96
|
+
dynacast: true,
|
|
97
|
+
e2ee: e2eeEnabled
|
|
98
|
+
? {
|
|
99
|
+
keyProvider,
|
|
100
|
+
worker
|
|
101
|
+
}
|
|
102
|
+
: undefined
|
|
103
|
+
};
|
|
104
|
+
}, [liveStreamRoomMaxParticipants, userChoices, options.hq, options.codec]); */
|
|
111
105
|
// Create room - only initial
|
|
112
|
-
const room = useMemo(() => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}, [liveStreamRoomMaxParticipants]);
|
|
106
|
+
/* const room = useMemo(() => {
|
|
107
|
+
const room = new Room();
|
|
108
|
+
return new Room(roomOptions);
|
|
109
|
+
}, [liveStreamRoomMaxParticipants]); */
|
|
117
110
|
const connectOptions = useMemo(() => {
|
|
118
111
|
return {
|
|
119
112
|
autoSubscribe: true
|
|
120
113
|
};
|
|
121
114
|
}, []);
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
115
|
+
/* useEffect(() => {
|
|
116
|
+
if (room) {
|
|
117
|
+
if (e2eeEnabled) {
|
|
118
|
+
keyProvider
|
|
119
|
+
.setKey(decodePassphrase(e2eePassphrase))
|
|
120
|
+
.then(() => {
|
|
121
|
+
room.setE2EEEnabled(true).catch((e) => {
|
|
122
|
+
if (e instanceof DeviceUnsupportedError) {
|
|
123
|
+
alert(
|
|
124
|
+
`You're trying to join an encrypted meeting, but your browser does not support it. Please update it to the latest version and try again.`
|
|
125
|
+
);
|
|
126
|
+
console.error(e);
|
|
127
|
+
} else {
|
|
128
|
+
throw e;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
})
|
|
132
|
+
.then(() => {
|
|
133
|
+
setE2eeSetupComplete(true);
|
|
134
|
+
setLiveActive(true);
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
setE2eeSetupComplete(true);
|
|
138
|
+
setLiveActive(true);
|
|
147
139
|
}
|
|
148
|
-
|
|
140
|
+
}
|
|
141
|
+
}, [e2eeEnabled, room, e2eePassphrase]); */
|
|
149
142
|
// HANDLERS
|
|
150
143
|
/**
|
|
151
144
|
* Handle on leave
|
|
@@ -179,5 +172,5 @@ export default function LiveStreamVideoConference(inProps) {
|
|
|
179
172
|
/**
|
|
180
173
|
* Renders root object
|
|
181
174
|
*/
|
|
182
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children:
|
|
175
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: liveActive && !error ? (_jsx(_Fragment, { children: _jsxs(LiveKitRoom, Object.assign({ connect: Boolean(e2eeSetupComplete && liveActive), token: connectionDetails['participantToken'], serverUrl: connectionDetails['serverUrl'], connectOptions: connectOptions, video: userChoices.videoEnabled, audio: userChoices.audioEnabled, onDisconnected: handleOnLeave, onEncryptionError: handleEncryptionError, onError: handleError }, LiveKitRoomComponentsProps, { children: [_jsx(VideoConference, { chatMessageFormatter: formatChatMessageLinks }), _jsx(RecordingIndicator, {}), _jsx(ConnectionState, {})] })) })) : (_jsx(_Fragment, { children: error ? error : liveActive === false ? _jsx(_Fragment, { children: "Grazie!" }) : _jsx(CircularProgress, {}) })) })));
|
|
183
176
|
}
|
|
@@ -9,7 +9,7 @@ import ScrollContainer from '../../shared/ScrollContainer';
|
|
|
9
9
|
import DefaultDrawerContent from './DefaultDrawerContent';
|
|
10
10
|
import DefaultHeaderContent from './DefaultHeaderContent';
|
|
11
11
|
import CreateLiveStreamButton from '../CreateLiveStreamButton';
|
|
12
|
-
import { useSCPreferences } from '@selfcommunity/react-core';
|
|
12
|
+
import { useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
13
13
|
const PREFIX = 'SCNavigationMenuDrawer';
|
|
14
14
|
const classes = {
|
|
15
15
|
root: `${PREFIX}-root`,
|
|
@@ -36,6 +36,7 @@ export default function NavigationMenuDrawer(inProps) {
|
|
|
36
36
|
});
|
|
37
37
|
const { className = null, showDrawerHeader = true, drawerHeaderContent = _jsx(DefaultHeaderContent, {}), drawerContent = _jsx(DefaultDrawerContent, {}), showDrawerFooterContent = true, drawerFooterContent = null, ScrollContainerProps = {}, CreateLiveStreamButtonComponentProps = {}, open, onClose } = props, rest = __rest(props, ["className", "showDrawerHeader", "drawerHeaderContent", "drawerContent", "showDrawerFooterContent", "drawerFooterContent", "ScrollContainerProps", "CreateLiveStreamButtonComponentProps", "open", "onClose"]);
|
|
38
38
|
const { preferences, features } = useSCPreferences();
|
|
39
|
+
const scUserContext = useSCUser();
|
|
39
40
|
// TODO
|
|
40
41
|
const liveStreamEnabled = true;
|
|
41
42
|
/* const liveStreamEnabled = useMemo(
|