@selfcommunity/react-ui 0.8.0-live.60 → 0.8.0-live.61
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/LiveStreamFormSettings.js +1 -1
- package/lib/cjs/components/LiveStreamForm/constants.d.ts +1 -1
- package/lib/cjs/components/LiveStreamForm/constants.js +1 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +1 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.d.ts +29 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +62 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/DisconnectButton.d.ts +10 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/DisconnectButton.js +16 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +7 -83
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +8 -11
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +14 -3
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/SettingsMenuToggle.d.ts +19 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/SettingsMenuToggle.js +35 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +2 -17
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +8 -22
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/utils.d.ts +27 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/utils.js +82 -0
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
- package/lib/esm/components/LiveStreamForm/constants.d.ts +1 -1
- package/lib/esm/components/LiveStreamForm/constants.js +1 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +1 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.d.ts +29 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ControlBar.js +58 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/DisconnectButton.d.ts +10 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/DisconnectButton.js +12 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +8 -84
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +10 -13
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js +13 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/SettingsMenuToggle.d.ts +19 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/SettingsMenuToggle.js +30 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.d.ts +2 -17
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +9 -23
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/utils.d.ts +27 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/utils.js +74 -0
- package/lib/umd/{43.js → 32.js} +2 -2
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -7
- /package/lib/umd/{43.js.LICENSE.txt → 32.js.LICENSE.txt} +0 -0
|
@@ -54,7 +54,7 @@ function LiveStreamSettingsForm(inProps) {
|
|
|
54
54
|
/**
|
|
55
55
|
* Renders root object
|
|
56
56
|
*/
|
|
57
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.muteParticipants), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['muteParticipants']: !(settings === null || settings === void 0 ? void 0 : settings.muteParticipants) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.muteParticipants", defaultMessage: "ui.liveStreamForm.muteParticipants" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableVideo), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableVideo']: !(settings === null || settings === void 0 ? void 0 : settings.disableVideo) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableChat), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableChat']: !(settings === null || settings === void 0 ? void 0 : settings.disableChat) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableShareScreen']: !(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableShareScreen", defaultMessage: "ui.liveStreamForm.disableShareScreen" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.muteParticipants), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['muteParticipants']: !(settings === null || settings === void 0 ? void 0 : settings.muteParticipants) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.muteParticipants", defaultMessage: "ui.liveStreamForm.muteParticipants" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableVideo), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableVideo']: !(settings === null || settings === void 0 ? void 0 : settings.disableVideo) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableChat), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableChat']: !(settings === null || settings === void 0 ? void 0 : settings.disableChat) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['disableShareScreen']: !(settings === null || settings === void 0 ? void 0 : settings.disableShareScreen) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.disableShareScreen", defaultMessage: "ui.liveStreamForm.disableShareScreen" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['hideParticipantsList']: !(settings === null || settings === void 0 ? void 0 : settings.hideParticipantsList) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.hideParticipantsList", defaultMessage: "ui.liveStreamForm.hideParticipantsList" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers), onChange: () => onChange(Object.assign(Object.assign({}, settings), { ['automaticallyNotifyFollowers']: !(settings === null || settings === void 0 ? void 0 : settings.automaticallyNotifyFollowers) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.switchLabel }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.automaticallyNotifyFollowers", defaultMessage: "ui.liveStreamForm.automaticallyNotifyFollowers" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ className: classes.accessView }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ id: "viewLabel" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }) })), (0, jsx_runtime_1.jsx)(material_1.Select, Object.assign({ name: "view", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }), labelId: "viewLabel", fullWidth: true, value: (_a = settings === null || settings === void 0 ? void 0 : settings.view) !== null && _a !== void 0 ? _a : types_1.SCLiveStreamViewType.SPEAKER, onChange: (e) => onChange(Object.assign(Object.assign({}, settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
|
|
58
58
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.accessViewIcon }, { children: selected === types_1.SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${selected}`, defaultMessage: `ui.liveStreamForm.view.${selected}` })] }));
|
|
59
59
|
} }, { children: Object.values(types_1.SCLiveStreamViewType).map((f) => ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: f }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1" }, { children: (0, jsx_runtime_1.jsxs)("b", { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, Object.assign({ className: classes.accessViewIcon }, { children: f === types_1.SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${f}`, defaultMessage: `ui.liveStreamForm.view.${f}` })] }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: `ui.liveStreamForm.view.${f}.description`, defaultMessage: `ui.liveStreamForm.view.${f}.description` }) })] }) }), f))) }))] }))] })));
|
|
60
60
|
}
|
|
@@ -2,7 +2,7 @@ import { SCLiveStreamViewType } from '@selfcommunity/types';
|
|
|
2
2
|
export declare const PREFIX = "SCLiveStreamForm";
|
|
3
3
|
export declare const LIVESTREAM_DEFAULT_SETTINGS: {
|
|
4
4
|
muteParticipants: boolean;
|
|
5
|
-
|
|
5
|
+
hideParticipantsList: boolean;
|
|
6
6
|
automaticallyNotifyFollowers: boolean;
|
|
7
7
|
disableVideo: boolean;
|
|
8
8
|
disableChat: boolean;
|
|
@@ -5,7 +5,7 @@ const types_1 = require("@selfcommunity/types");
|
|
|
5
5
|
exports.PREFIX = 'SCLiveStreamForm';
|
|
6
6
|
exports.LIVESTREAM_DEFAULT_SETTINGS = {
|
|
7
7
|
muteParticipants: true,
|
|
8
|
-
|
|
8
|
+
hideParticipantsList: false,
|
|
9
9
|
automaticallyNotifyFollowers: false,
|
|
10
10
|
disableVideo: true,
|
|
11
11
|
disableChat: false,
|
|
@@ -136,6 +136,6 @@ function LiveStreamRoom(inProps) {
|
|
|
136
136
|
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ id: id, className: (0, classnames_1.default)(classes.root, className) }, rest, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [startPrejoinContent && (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title) && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "h5", className: classes.title }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title }))), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description) && ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "body1", className: classes.description }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description }))), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: (0, classnames_1.default)(classes.preJoin, { [classes.preJoinLoading]: loading }) }, { children: [(0, jsx_runtime_1.jsx)(LiveStreamProvider_1.LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: (0, jsx_runtime_1.jsx)(PreJoin_1.PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError }) })), loading && ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.prejoinLoader }, { children: [(0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ component: 'div', variant: "body2" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.endPrejoinContent }, { children: [Boolean(scUserContext.user &&
|
|
137
137
|
scUserContext.user.id !== scLiveStream.host.id &&
|
|
138
138
|
scLiveStream &&
|
|
139
|
-
(((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && ((0, jsx_runtime_1.jsxs)(material_1.Alert, Object.assign({ variant: "filled", severity: "error" }, { children: [scLiveStream && ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [
|
|
139
|
+
(((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && ((0, jsx_runtime_1.jsxs)(material_1.Alert, Object.assign({ variant: "filled", severity: "error" }, { children: [scLiveStream && ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), (0, jsx_runtime_1.jsx)("br", {})] })), scLiveStream && ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" }) }))] }))), endPrejoinContent] }))] })) : ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.conference }, { children: (0, jsx_runtime_1.jsx)(LiveStreamProvider_1.LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: (0, jsx_runtime_1.jsx)(LiveStreamVideoConference_1.default, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) })) }))) })) })));
|
|
140
140
|
}
|
|
141
141
|
exports.default = LiveStreamRoom;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Track } from 'livekit-client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/** @public */
|
|
4
|
+
export type ControlBarControls = {
|
|
5
|
+
microphone?: boolean;
|
|
6
|
+
camera?: boolean;
|
|
7
|
+
chat?: boolean;
|
|
8
|
+
screenShare?: boolean;
|
|
9
|
+
leave?: boolean;
|
|
10
|
+
settings?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface ControlBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
onDeviceError?: (error: {
|
|
14
|
+
source: Track.Source;
|
|
15
|
+
error: Error;
|
|
16
|
+
}) => void;
|
|
17
|
+
variation?: 'minimal' | 'verbose' | 'textOnly';
|
|
18
|
+
controls?: ControlBarControls;
|
|
19
|
+
/**
|
|
20
|
+
* If `true`, the user's device choices will be persisted.
|
|
21
|
+
* This will enable the user to have the same device choices when they rejoin the room.
|
|
22
|
+
*/
|
|
23
|
+
saveUserChoices?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `ControlBar` prefab gives the user the basic user interface to control their
|
|
27
|
+
* media devices (camera, microphone and screen share), open the `Chat` and leave the room.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ControlBar({ variation, controls, saveUserChoices, onDeviceError, ...props }: ControlBarProps): JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlBar = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const livekit_client_1 = require("livekit-client");
|
|
7
|
+
const React = tslib_1.__importStar(require("react"));
|
|
8
|
+
const components_core_1 = require("@livekit/components-core");
|
|
9
|
+
const components_react_1 = require("@livekit/components-react");
|
|
10
|
+
const TrackToggle_1 = require("./TrackToggle");
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const SettingsMenuToggle_1 = require("./SettingsMenuToggle");
|
|
13
|
+
const DisconnectButton_1 = require("./DisconnectButton");
|
|
14
|
+
const utils_1 = require("./utils");
|
|
15
|
+
/**
|
|
16
|
+
* The `ControlBar` prefab gives the user the basic user interface to control their
|
|
17
|
+
* media devices (camera, microphone and screen share), open the `Chat` and leave the room.
|
|
18
|
+
*/
|
|
19
|
+
function ControlBar(_a) {
|
|
20
|
+
var _b, _c, _d, _e, _f;
|
|
21
|
+
var { variation, controls, saveUserChoices = true, onDeviceError } = _a, props = tslib_1.__rest(_a, ["variation", "controls", "saveUserChoices", "onDeviceError"]);
|
|
22
|
+
const [isChatOpen, setIsChatOpen] = React.useState(false);
|
|
23
|
+
const layoutContext = (0, components_react_1.useMaybeLayoutContext)();
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
if (((_a = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _a === void 0 ? void 0 : _a.showChat) !== undefined) {
|
|
27
|
+
setIsChatOpen((_b = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _b === void 0 ? void 0 : _b.showChat);
|
|
28
|
+
}
|
|
29
|
+
}, [(_b = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _b === void 0 ? void 0 : _b.showChat]);
|
|
30
|
+
const isTooLittleSpace = (0, material_1.useMediaQuery)(`(max-width: ${isChatOpen ? 1000 : 760}px)`);
|
|
31
|
+
const defaultVariation = isTooLittleSpace ? 'minimal' : 'verbose';
|
|
32
|
+
variation !== null && variation !== void 0 ? variation : (variation = defaultVariation);
|
|
33
|
+
const visibleControls = Object.assign({ leave: true }, controls);
|
|
34
|
+
const localPermissions = (0, components_react_1.useLocalParticipantPermissions)();
|
|
35
|
+
if (!localPermissions) {
|
|
36
|
+
visibleControls.camera = false;
|
|
37
|
+
visibleControls.chat = false;
|
|
38
|
+
visibleControls.microphone = false;
|
|
39
|
+
visibleControls.screenShare = false;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
(_c = visibleControls.camera) !== null && _c !== void 0 ? _c : (visibleControls.camera = localPermissions.canPublish);
|
|
43
|
+
(_d = visibleControls.microphone) !== null && _d !== void 0 ? _d : (visibleControls.microphone = localPermissions.canPublish);
|
|
44
|
+
(_e = visibleControls.screenShare) !== null && _e !== void 0 ? _e : (visibleControls.screenShare = localPermissions.canPublish);
|
|
45
|
+
(_f = visibleControls.chat) !== null && _f !== void 0 ? _f : (visibleControls.chat = localPermissions.canPublishData && (controls === null || controls === void 0 ? void 0 : controls.chat));
|
|
46
|
+
}
|
|
47
|
+
const showIcon = React.useMemo(() => variation === 'minimal' || variation === 'verbose', [variation]);
|
|
48
|
+
const showText = React.useMemo(() => variation === 'textOnly' || variation === 'verbose', [variation]);
|
|
49
|
+
const browserSupportsScreenSharing = (0, components_core_1.supportsScreenSharing)();
|
|
50
|
+
const [isScreenShareEnabled, setIsScreenShareEnabled] = React.useState(false);
|
|
51
|
+
const onScreenShareChange = React.useCallback((enabled) => {
|
|
52
|
+
setIsScreenShareEnabled(enabled);
|
|
53
|
+
}, [setIsScreenShareEnabled]);
|
|
54
|
+
const htmlProps = (0, utils_1.mergeProps)({ className: 'lk-control-bar' }, props);
|
|
55
|
+
const { saveAudioInputEnabled, saveVideoInputEnabled, saveAudioInputDeviceId, saveVideoInputDeviceId } = (0, components_react_1.usePersistentUserChoices)({
|
|
56
|
+
preventSave: !saveUserChoices
|
|
57
|
+
});
|
|
58
|
+
const microphoneOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveAudioInputEnabled(enabled) : null), [saveAudioInputEnabled]);
|
|
59
|
+
const cameraOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveVideoInputEnabled(enabled) : null), [saveVideoInputEnabled]);
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, htmlProps, { children: [visibleControls.microphone && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group" }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ source: livekit_client_1.Track.Source.Microphone, showIcon: showIcon, onChange: microphoneOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: livekit_client_1.Track.Source.Microphone, error }) }, { children: showText && 'Microphone' })) }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { kind: "audioinput", onActiveDeviceChange: (_kind, deviceId) => saveAudioInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.camera && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-button-group" }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ source: livekit_client_1.Track.Source.Camera, showIcon: showIcon, onChange: cameraOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: livekit_client_1.Track.Source.Camera, error }) }, { children: showText && 'Camera' })) }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-button-group-menu" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.MediaDeviceMenu, { kind: "videoinput", onActiveDeviceChange: (_kind, deviceId) => saveVideoInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.screenShare && browserSupportsScreenSharing && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(TrackToggle_1.TrackToggle, Object.assign({ source: livekit_client_1.Track.Source.ScreenShare, captureOptions: { audio: true, selfBrowserSurface: 'include' }, showIcon: showIcon, onChange: onScreenShareChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: livekit_client_1.Track.Source.ScreenShare, error }) }, { children: showText && (isScreenShareEnabled ? 'Stop screen share' : 'Share screen') })) })), visibleControls.chat && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_react_1.ChatToggle, { children: [showIcon && (0, jsx_runtime_1.jsx)(components_react_1.ChatIcon, {}), showText && 'Chat'] }) })), visibleControls.settings && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(SettingsMenuToggle_1.SettingsMenuToggle, { children: [showIcon && (0, jsx_runtime_1.jsx)(components_react_1.GearIcon, {}), showText && 'Settings'] }) })), visibleControls.leave && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(DisconnectButton_1.DisconnectButton, { children: [showIcon && (0, jsx_runtime_1.jsx)(components_react_1.LeaveIcon, {}), showText && 'Leave'] }) })), (0, jsx_runtime_1.jsx)(components_react_1.StartMediaButton, {})] })));
|
|
61
|
+
}
|
|
62
|
+
exports.ControlBar = ControlBar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** @public */
|
|
3
|
+
export interface DisconnectButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
stopTracks?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The `DisconnectButton` is a basic html button with the added ability to disconnect from a LiveKit room.
|
|
8
|
+
* Normally this is the big red button that allows end users to leave the video or audio call.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DisconnectButton: (props: DisconnectButtonProps & React.RefAttributes<HTMLButtonElement>) => React.ReactNode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisconnectButton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const components_react_1 = require("@livekit/components-react");
|
|
8
|
+
/**
|
|
9
|
+
* The `DisconnectButton` is a basic html button with the added ability to disconnect from a LiveKit room.
|
|
10
|
+
* Normally this is the big red button that allows end users to leave the video or audio call.
|
|
11
|
+
*/
|
|
12
|
+
exports.DisconnectButton =
|
|
13
|
+
/* @__PURE__ */ React.forwardRef(function DisconnectButton(props, ref) {
|
|
14
|
+
const { buttonProps } = (0, components_react_1.useDisconnectButton)(props);
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("button", Object.assign({ ref: ref }, buttonProps, { children: props.children })));
|
|
16
|
+
});
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js
CHANGED
|
@@ -59,100 +59,24 @@ function LiveStreamVideoConference(inProps) {
|
|
|
59
59
|
}, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = constants_2.defaultVideoOptions } = props, rest = tslib_1.__rest(props, ["className", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
|
|
60
60
|
// CONTEXT
|
|
61
61
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
62
|
-
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
63
|
-
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
64
62
|
const { liveStream } = (0, LiveStreamProvider_1.useLiveStream)();
|
|
65
|
-
//
|
|
66
|
-
// const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
// const worker = typeof window !== 'undefined' && e2eePassphrase && new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));
|
|
70
|
-
// const e2eeEnabled = !!(e2eePassphrase && worker);
|
|
71
|
-
// const keyProvider = new ExternalE2EEKeyProvider();
|
|
72
|
-
const [e2eeSetupComplete, setE2eeSetupComplete] = (0, react_1.useState)(true);
|
|
63
|
+
// STATE
|
|
73
64
|
const [liveActive, setLiveActive] = (0, react_1.useState)(true);
|
|
74
65
|
const [error, setError] = (0, react_1.useState)(null);
|
|
66
|
+
// PERMISSIONS
|
|
75
67
|
const canUseAudio = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && liveStream && (liveStream.host.id === scUserContext.user.id || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants))); }, [scUserContext, liveStream]);
|
|
76
68
|
const canUseVideo = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && liveStream && (liveStream.host.id === scUserContext.user.id || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableVideo))); }, [scUserContext, liveStream]);
|
|
77
|
-
const canUseChat = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && liveStream &&
|
|
69
|
+
const canUseChat = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && liveStream && liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableChat); }, [scUserContext, liveStream]);
|
|
78
70
|
const canUseShareScreen = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && liveStream && (liveStream.host.id === scUserContext.user.id || (liveStream && !((_a = liveStream === null || liveStream === void 0 ? void 0 : liveStream.settings) === null || _a === void 0 ? void 0 : _a.disableShareScreen))); }, [scUserContext, liveStream]);
|
|
79
71
|
const speakerFocused = (0, react_1.useMemo)(() => (scUserContext.user && liveStream && liveStream.settings.view === types_1.SCLiveStreamViewType.SPEAKER ? liveStream.host : null), [scUserContext, liveStream]);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
SCPreferences.CONFIGURATIONS_LIVE_STREAM_MAX_PARTICIPANTS in preferences &&
|
|
84
|
-
preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_MAX_PARTICIPANTS].value,
|
|
85
|
-
[preferences]
|
|
86
|
-
); */
|
|
87
|
-
// Room options
|
|
88
|
-
/* const roomOptions = useMemo((): RoomOptions => {
|
|
89
|
-
let videoCodec: VideoCodec | undefined = options.codec ? options.codec : defaultVideoOptions.codec;
|
|
90
|
-
if (e2eeEnabled && (videoCodec === 'av1' || videoCodec === 'vp9')) {
|
|
91
|
-
videoCodec = undefined;
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
// emptyTimeout: 3 * 60, // 3 minutes
|
|
95
|
-
// maxParticipants: liveStreamRoomMaxParticipants,
|
|
96
|
-
videoCaptureDefaults: {
|
|
97
|
-
deviceId: userChoices.videoDeviceId ?? undefined,
|
|
98
|
-
resolution: options.hq ? VideoPresets.h2160 : VideoPresets.h720
|
|
99
|
-
},
|
|
100
|
-
publishDefaults: {
|
|
101
|
-
dtx: false,
|
|
102
|
-
videoSimulcastLayers: options.hq ? [VideoPresets.h1080, VideoPresets.h720] : [VideoPresets.h540, VideoPresets.h216],
|
|
103
|
-
red: !e2eeEnabled,
|
|
104
|
-
videoCodec
|
|
105
|
-
},
|
|
106
|
-
audioCaptureDefaults: {
|
|
107
|
-
deviceId: userChoices.audioDeviceId ?? undefined
|
|
108
|
-
},
|
|
109
|
-
adaptiveStream: {pixelDensity: 'screen'},
|
|
110
|
-
dynacast: true,
|
|
111
|
-
e2ee: e2eeEnabled
|
|
112
|
-
? {
|
|
113
|
-
keyProvider,
|
|
114
|
-
worker
|
|
115
|
-
}
|
|
116
|
-
: undefined
|
|
117
|
-
};
|
|
118
|
-
}, [liveStreamRoomMaxParticipants, userChoices, options.hq, options.codec]); */
|
|
119
|
-
// Create room - only initial
|
|
120
|
-
/* const room = useMemo(() => {
|
|
121
|
-
const room = new Room();
|
|
122
|
-
return new Room(roomOptions);
|
|
123
|
-
}, [liveStreamRoomMaxParticipants]); */
|
|
72
|
+
console.log(canUseChat);
|
|
73
|
+
console.log(speakerFocused);
|
|
74
|
+
// CONNECT OPTIONS
|
|
124
75
|
const connectOptions = (0, react_1.useMemo)(() => {
|
|
125
76
|
return {
|
|
126
77
|
autoSubscribe: true
|
|
127
78
|
};
|
|
128
79
|
}, []);
|
|
129
|
-
/* useEffect(() => {
|
|
130
|
-
if (room) {
|
|
131
|
-
if (e2eeEnabled) {
|
|
132
|
-
keyProvider
|
|
133
|
-
.setKey(decodePassphrase(e2eePassphrase))
|
|
134
|
-
.then(() => {
|
|
135
|
-
room.setE2EEEnabled(true).catch((e) => {
|
|
136
|
-
if (e instanceof DeviceUnsupportedError) {
|
|
137
|
-
alert(
|
|
138
|
-
`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.`
|
|
139
|
-
);
|
|
140
|
-
console.error(e);
|
|
141
|
-
} else {
|
|
142
|
-
throw e;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
})
|
|
146
|
-
.then(() => {
|
|
147
|
-
setE2eeSetupComplete(true);
|
|
148
|
-
setLiveActive(true);
|
|
149
|
-
});
|
|
150
|
-
} else {
|
|
151
|
-
setE2eeSetupComplete(true);
|
|
152
|
-
setLiveActive(true);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}, [e2eeEnabled, room, e2eePassphrase]); */
|
|
156
80
|
// HANDLERS
|
|
157
81
|
/**
|
|
158
82
|
* Handle on leave
|
|
@@ -186,6 +110,6 @@ function LiveStreamVideoConference(inProps) {
|
|
|
186
110
|
/**
|
|
187
111
|
* Renders root object
|
|
188
112
|
*/
|
|
189
|
-
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: liveActive && !error ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.LiveKitRoom, Object.assign({ connect: Boolean(
|
|
113
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: liveActive && !error ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.LiveKitRoom, Object.assign({ connect: Boolean(liveActive), token: connectionDetails['participantToken'], serverUrl: connectionDetails['serverUrl'], connectOptions: connectOptions, video: userChoices.videoEnabled, audio: userChoices.audioEnabled, onDisconnected: handleOnLeave, onEncryptionError: handleEncryptionError, onError: handleError }, LiveKitRoomComponentProps, { children: (0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, { children: [(0, jsx_runtime_1.jsx)(VideoConference_1.VideoConference, Object.assign({ chatMessageFormatter: components_react_1.formatChatMessageLinks }, (speakerFocused && { speakerFocused: liveStream.host }), VideoConferenceComponentProps, { disableMicrophone: !canUseAudio, disableCamera: !canUseVideo, disableChat: !canUseChat, disableShareScreen: !canUseShareScreen })), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionState, {})] }) })) })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: error ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, error, endConferenceEndContent] }))) : liveActive === false ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5" }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.conference.end", defaultMessage: "ui.liveStreamRoom.conference.end" }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: "secondary", component: react_core_1.Link, to: '/', className: classes.btnBackHome }, { children: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.liveStreamRoom.button.backHome", defaultMessage: "ui.liveStreamRoom.button.backHome" }) })), endConferenceEndContent] }))) : ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, {})) })) })));
|
|
190
114
|
}
|
|
191
115
|
exports.default = LiveStreamVideoConference;
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js
CHANGED
|
@@ -63,8 +63,6 @@ function ContributionActionsMenu(props) {
|
|
|
63
63
|
const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
|
|
64
64
|
const scContext = (0, react_1.useContext)(react_core_1.SCContext);
|
|
65
65
|
const scUserContext = (0, react_1.useContext)(react_core_1.SCUserContext);
|
|
66
|
-
const scUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
67
|
-
const scRoutingContext = (0, react_core_1.useSCRouting)();
|
|
68
66
|
const { enqueueSnackbar } = (0, notistack_1.useSnackbar)();
|
|
69
67
|
const p = (0, components_react_1.useEnsureParticipant)(participant);
|
|
70
68
|
const { liveStream } = (0, LiveStreamProvider_1.useLiveStream)();
|
|
@@ -101,16 +99,15 @@ function ContributionActionsMenu(props) {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
/**
|
|
104
|
-
* Perform
|
|
102
|
+
* Perform ban participant
|
|
105
103
|
*/
|
|
106
|
-
const performBanParticipant = (0, react_1.useMemo)(() => () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [p]);
|
|
104
|
+
const performBanParticipant = (0, react_1.useMemo)(() => () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const res = yield api_services_1.LiveStreamApiClient.removeUserFromRoom(liveStream.id, p.identity);
|
|
106
|
+
if (res.status >= 300) {
|
|
107
|
+
return Promise.reject(res);
|
|
108
|
+
}
|
|
109
|
+
return yield Promise.resolve(res.data);
|
|
110
|
+
}), [p]);
|
|
114
111
|
/**
|
|
115
112
|
* Handle action
|
|
116
113
|
*/
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SCUserType } from '@selfcommunity/types';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ParticipantTileAvatarProps {
|
|
3
3
|
className?: string;
|
|
4
4
|
/**
|
|
5
5
|
* User Object
|
|
@@ -12,4 +12,4 @@ export interface ParticipantTileProps {
|
|
|
12
12
|
*/
|
|
13
13
|
participant?: any;
|
|
14
14
|
}
|
|
15
|
-
export default function
|
|
15
|
+
export default function ParticipantTileAvatar(inProps: ParticipantTileAvatarProps): JSX.Element;
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
5
6
|
const styles_1 = require("@mui/material/styles");
|
|
6
7
|
const system_1 = require("@mui/system");
|
|
7
8
|
const material_1 = require("@mui/material");
|
|
@@ -24,7 +25,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
24
25
|
height: 100
|
|
25
26
|
}
|
|
26
27
|
}));
|
|
27
|
-
function
|
|
28
|
+
function ParticipantTileAvatar(inProps) {
|
|
28
29
|
// PROPS
|
|
29
30
|
const props = (0, system_1.useThemeProps)({
|
|
30
31
|
props: inProps,
|
|
@@ -33,6 +34,16 @@ function UserAvatar(inProps) {
|
|
|
33
34
|
const { className, user, participant } = props, rest = tslib_1.__rest(props, ["className", "user", "participant"]);
|
|
34
35
|
// CONTEXT
|
|
35
36
|
const scContext = (0, react_core_1.useSCContext)();
|
|
36
|
-
|
|
37
|
+
// AVATAR
|
|
38
|
+
const avatar = (0, react_1.useMemo)(() => {
|
|
39
|
+
if (user) {
|
|
40
|
+
return (0, jsx_runtime_1.jsx)("img", { src: `${user.avatar}` });
|
|
41
|
+
}
|
|
42
|
+
if (participant) {
|
|
43
|
+
return (0, jsx_runtime_1.jsx)("img", { src: `${scContext.settings.portal}/api/v2/avatar/${participant.identity}` });
|
|
44
|
+
}
|
|
45
|
+
return (0, jsx_runtime_1.jsx)(ParticipantPlaceholder_1.default, {});
|
|
46
|
+
}, [user, participant]);
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(className, classes.root) }, rest, { children: avatar })));
|
|
37
48
|
}
|
|
38
|
-
exports.default =
|
|
49
|
+
exports.default = ParticipantTileAvatar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface UseSettingsToggleProps {
|
|
3
|
+
props: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The `useSettingsToggle` hook provides state and functions for toggling the settings menu.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSettingsToggle({ props }: UseSettingsToggleProps): {
|
|
9
|
+
mergedProps: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
|
+
className: string;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
'aria-pressed': string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type SettingsMenuToggleProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
16
|
+
/**
|
|
17
|
+
* The `SettingsMenuToggle` component is a button that toggles the visibility of the `SettingsMenu` component.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SettingsMenuToggle: (props: SettingsMenuToggleProps & React.RefAttributes<HTMLButtonElement>) => React.ReactNode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsMenuToggle = exports.useSettingsToggle = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const components_react_1 = require("@livekit/components-react");
|
|
9
|
+
/**
|
|
10
|
+
* The `useSettingsToggle` hook provides state and functions for toggling the settings menu.
|
|
11
|
+
*/
|
|
12
|
+
function useSettingsToggle({ props }) {
|
|
13
|
+
const { dispatch, state } = (0, components_react_1.useLayoutContext)().widget;
|
|
14
|
+
const className = 'lk-button lk-settings-toggle';
|
|
15
|
+
const mergedProps = React.useMemo(() => {
|
|
16
|
+
return (0, utils_1.mergePropsReactAria)(props, {
|
|
17
|
+
className,
|
|
18
|
+
onClick: () => {
|
|
19
|
+
if (dispatch)
|
|
20
|
+
dispatch({ msg: 'toggle_settings' });
|
|
21
|
+
},
|
|
22
|
+
'aria-pressed': (state === null || state === void 0 ? void 0 : state.showSettings) ? 'true' : 'false'
|
|
23
|
+
});
|
|
24
|
+
}, [props, className, dispatch, state]);
|
|
25
|
+
return { mergedProps };
|
|
26
|
+
}
|
|
27
|
+
exports.useSettingsToggle = useSettingsToggle;
|
|
28
|
+
/**
|
|
29
|
+
* The `SettingsMenuToggle` component is a button that toggles the visibility of the `SettingsMenu` component.
|
|
30
|
+
*/
|
|
31
|
+
exports.SettingsMenuToggle =
|
|
32
|
+
/* @__PURE__ */ React.forwardRef(function SettingsMenuToggle(props, ref) {
|
|
33
|
+
const { mergedProps } = useSettingsToggle({ props });
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("button", Object.assign({ ref: ref }, mergedProps, { children: props.children })));
|
|
35
|
+
});
|
|
@@ -2,9 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import type { MessageDecoder, MessageEncoder } from '@livekit/components-core';
|
|
3
3
|
import { MessageFormatter } from '@livekit/components-react';
|
|
4
4
|
import { SCUserType } from '@selfcommunity/types';
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
5
|
export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
6
|
chatMessageFormatter?: MessageFormatter;
|
|
10
7
|
chatMessageEncoder?: MessageEncoder;
|
|
@@ -16,7 +13,7 @@ export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
16
13
|
disableMicrophone?: boolean;
|
|
17
14
|
disableCamera?: boolean;
|
|
18
15
|
disableShareScreen?: boolean;
|
|
19
|
-
|
|
16
|
+
hideParticipantsList?: boolean;
|
|
20
17
|
showSettings?: boolean;
|
|
21
18
|
}
|
|
22
19
|
/**
|
|
@@ -24,17 +21,5 @@ export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
24
21
|
* It provides functionality such as focusing on one participant, grid view with pagination to handle large numbers
|
|
25
22
|
* of participants, basic non-persistent chat, screen sharing, and more.
|
|
26
23
|
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* The component is implemented with other LiveKit components like `FocusContextProvider`,
|
|
29
|
-
* `GridLayout`, `ControlBar`, `FocusLayoutContainer` and `FocusLayout`.
|
|
30
|
-
* You can use these components as a starting point for your own custom video conferencing application.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* <LiveKitRoom>
|
|
35
|
-
* <VideoConference />
|
|
36
|
-
* <LiveKitRoom>
|
|
37
|
-
* ```
|
|
38
|
-
* @public
|
|
39
24
|
*/
|
|
40
|
-
export declare function VideoConference({ chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat, disableMicrophone, disableCamera, disableShareScreen,
|
|
25
|
+
export declare function VideoConference({ chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat, disableMicrophone, disableCamera, disableShareScreen, hideParticipantsList, showSettings, ...props }: VideoConferenceProps): JSX.Element;
|
|
@@ -8,27 +8,16 @@ const components_core_1 = require("@livekit/components-core");
|
|
|
8
8
|
const livekit_client_1 = require("livekit-client");
|
|
9
9
|
const components_react_1 = require("@livekit/components-react");
|
|
10
10
|
const ParticipantTile_1 = require("./ParticipantTile");
|
|
11
|
+
const ControlBar_1 = require("./ControlBar");
|
|
11
12
|
/**
|
|
12
13
|
* The `VideoConference` ready-made component is your drop-in solution for a classic video conferencing application.
|
|
13
14
|
* It provides functionality such as focusing on one participant, grid view with pagination to handle large numbers
|
|
14
15
|
* of participants, basic non-persistent chat, screen sharing, and more.
|
|
15
16
|
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* The component is implemented with other LiveKit components like `FocusContextProvider`,
|
|
18
|
-
* `GridLayout`, `ControlBar`, `FocusLayoutContainer` and `FocusLayout`.
|
|
19
|
-
* You can use these components as a starting point for your own custom video conferencing application.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <LiveKitRoom>
|
|
24
|
-
* <VideoConference />
|
|
25
|
-
* <LiveKitRoom>
|
|
26
|
-
* ```
|
|
27
|
-
* @public
|
|
28
17
|
*/
|
|
29
18
|
function VideoConference(_a) {
|
|
30
19
|
var _b, _c;
|
|
31
|
-
var { chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat = false, disableMicrophone = false, disableCamera = false, disableShareScreen = false,
|
|
20
|
+
var { chatMessageFormatter, chatMessageDecoder, chatMessageEncoder, SettingsComponent, speakerFocused, disableChat = false, disableMicrophone = false, disableCamera = false, disableShareScreen = false, hideParticipantsList = false, showSettings } = _a, props = tslib_1.__rest(_a, ["chatMessageFormatter", "chatMessageDecoder", "chatMessageEncoder", "SettingsComponent", "speakerFocused", "disableChat", "disableMicrophone", "disableCamera", "disableShareScreen", "hideParticipantsList", "showSettings"]);
|
|
32
21
|
const [widgetState, setWidgetState] = React.useState({
|
|
33
22
|
showChat: false,
|
|
34
23
|
unreadMessages: 0,
|
|
@@ -39,7 +28,6 @@ function VideoConference(_a) {
|
|
|
39
28
|
{ source: livekit_client_1.Track.Source.Camera, withPlaceholder: true },
|
|
40
29
|
{ source: livekit_client_1.Track.Source.ScreenShare, withPlaceholder: false }
|
|
41
30
|
], { updateOnlyOn: [livekit_client_1.RoomEvent.ActiveSpeakersChanged], onlySubscribed: false });
|
|
42
|
-
const { localParticipant } = (0, components_react_1.useLocalParticipant)();
|
|
43
31
|
const participants = (0, components_react_1.useParticipants)();
|
|
44
32
|
const widgetUpdate = (state) => {
|
|
45
33
|
components_core_1.log.debug('updating widget state', state);
|
|
@@ -100,13 +88,11 @@ function VideoConference(_a) {
|
|
|
100
88
|
participants,
|
|
101
89
|
speakerFocused
|
|
102
90
|
]);
|
|
103
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference" }, props, { children: [(0, components_core_1.isWeb)() && ((0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.GridLayout, Object.assign({ tracks: tracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: (0, jsx_runtime_1.jsxs)(components_react_1.FocusLayoutContainer, { children: [!
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
: {})), { settings: !!SettingsComponent }) })] })), !disableChat && ((0, jsx_runtime_1.jsx)(components_react_1.Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), SettingsComponent && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: (0, jsx_runtime_1.jsx)(SettingsComponent, {}) })))] }))), (0, jsx_runtime_1.jsx)(components_react_1.RoomAudioRenderer, {}), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionStateToast, {})] })));
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference" }, props, { children: [(0, components_core_1.isWeb)() && ((0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.GridLayout, Object.assign({ tracks: tracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: (0, jsx_runtime_1.jsxs)(components_react_1.FocusLayoutContainer, { children: [!hideParticipantsList && ((0, jsx_runtime_1.jsx)(components_react_1.CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) }))), focusTrack && (0, jsx_runtime_1.jsx)(components_react_1.FocusLayout, { trackRef: focusTrack })] }) }))), (0, jsx_runtime_1.jsx)(ControlBar_1.ControlBar, { controls: Object.assign({
|
|
92
|
+
chat: !disableChat,
|
|
93
|
+
microphone: !disableMicrophone,
|
|
94
|
+
camera: !disableCamera,
|
|
95
|
+
screenShare: !disableShareScreen
|
|
96
|
+
}, { settings: !!SettingsComponent }) })] })), !disableChat && ((0, jsx_runtime_1.jsx)(components_react_1.Chat, { style: { display: widgetState.showChat ? 'grid' : 'none' }, messageFormatter: chatMessageFormatter, messageEncoder: chatMessageEncoder, messageDecoder: chatMessageDecoder })), SettingsComponent && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-settings-menu-modal", style: { display: widgetState.showSettings ? 'block' : 'none' } }, { children: (0, jsx_runtime_1.jsx)(SettingsComponent, {}) })))] }))), (0, jsx_runtime_1.jsx)(components_react_1.RoomAudioRenderer, {}), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionStateToast, {})] })));
|
|
111
97
|
}
|
|
112
98
|
exports.VideoConference = VideoConference;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Calls all functions in the order they were chained with the same arguments.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function chain(...callbacks: any[]): (...args: any[]) => void;
|
|
7
|
+
interface Props {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
type TupleTypes<T> = {
|
|
11
|
+
[P in keyof T]: T[P];
|
|
12
|
+
} extends {
|
|
13
|
+
[key: number]: infer V;
|
|
14
|
+
} ? V : never;
|
|
15
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
16
|
+
/**
|
|
17
|
+
* Merges multiple props objects together. Event handlers are chained,
|
|
18
|
+
* classNames are combined, and ids are deduplicated - different ids
|
|
19
|
+
* will trigger a side-effect and re-render components hooked up with `useId`.
|
|
20
|
+
* For all other props, the last prop object overrides all previous ones.
|
|
21
|
+
* @param args - Multiple sets of props to merge together.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function mergePropsReactAria<T extends Props[]>(...args: T): UnionToIntersection<TupleTypes<T>>;
|
|
25
|
+
export declare function isProp<U extends HTMLElement, T extends React.HTMLAttributes<U>>(prop: T | undefined): prop is T;
|
|
26
|
+
export declare function mergeProps<U extends HTMLElement, T extends Array<React.HTMLAttributes<U> | undefined>>(...props: T): import("react").HTMLAttributes<U>;
|
|
27
|
+
export {};
|