@selfcommunity/react-ui 0.8.0-live.60 → 0.8.0-live.62
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/CreateLiveStreamDialog/CreateLiveStreamDialog.js +1 -1
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +1 -1
- 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/CreateLiveStreamDialog/CreateLiveStreamDialog.js +1 -1
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +1 -1
- 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
|
@@ -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 {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
4
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
6
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
9
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
10
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
11
|
+
* governing permissions and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.mergeProps = exports.isProp = exports.mergePropsReactAria = exports.chain = void 0;
|
|
15
|
+
const tslib_1 = require("tslib");
|
|
16
|
+
const clsx_1 = tslib_1.__importDefault(require("clsx"));
|
|
17
|
+
/**
|
|
18
|
+
* Calls all functions in the order they were chained with the same arguments.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
function chain(...callbacks) {
|
|
22
|
+
return (...args) => {
|
|
23
|
+
for (const callback of callbacks) {
|
|
24
|
+
if (typeof callback === 'function') {
|
|
25
|
+
try {
|
|
26
|
+
callback(...args);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
console.error(e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.chain = chain;
|
|
36
|
+
/**
|
|
37
|
+
* Merges multiple props objects together. Event handlers are chained,
|
|
38
|
+
* classNames are combined, and ids are deduplicated - different ids
|
|
39
|
+
* will trigger a side-effect and re-render components hooked up with `useId`.
|
|
40
|
+
* For all other props, the last prop object overrides all previous ones.
|
|
41
|
+
* @param args - Multiple sets of props to merge together.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
function mergePropsReactAria(...args) {
|
|
45
|
+
// Start with a base clone of the first argument. This is a lot faster than starting
|
|
46
|
+
// with an empty object and adding properties as we go.
|
|
47
|
+
const result = Object.assign({}, args[0]);
|
|
48
|
+
for (let i = 1; i < args.length; i++) {
|
|
49
|
+
const props = args[i];
|
|
50
|
+
for (const key in props) {
|
|
51
|
+
const a = result[key];
|
|
52
|
+
const b = props[key];
|
|
53
|
+
// Chain events
|
|
54
|
+
if (typeof a === 'function' &&
|
|
55
|
+
typeof b === 'function' &&
|
|
56
|
+
// This is a lot faster than a regex.
|
|
57
|
+
key[0] === 'o' &&
|
|
58
|
+
key[1] === 'n' &&
|
|
59
|
+
key.charCodeAt(2) >= /* 'A' */ 65 &&
|
|
60
|
+
key.charCodeAt(2) <= /* 'Z' */ 90) {
|
|
61
|
+
result[key] = chain(a, b);
|
|
62
|
+
// Merge classnames, sometimes classNames are empty string which eval to false, so we just need to do a type check
|
|
63
|
+
}
|
|
64
|
+
else if ((key === 'className' || key === 'UNSAFE_className') && typeof a === 'string' && typeof b === 'string') {
|
|
65
|
+
result[key] = (0, clsx_1.default)(a, b);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result[key] = b !== undefined ? b : a;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
exports.mergePropsReactAria = mergePropsReactAria;
|
|
75
|
+
function isProp(prop) {
|
|
76
|
+
return prop !== undefined;
|
|
77
|
+
}
|
|
78
|
+
exports.isProp = isProp;
|
|
79
|
+
function mergeProps(...props) {
|
|
80
|
+
return mergePropsReactAria(...props.filter(isProp));
|
|
81
|
+
}
|
|
82
|
+
exports.mergeProps = mergeProps;
|
|
@@ -96,5 +96,5 @@ export default function CreateLiveStreamDialog(inProps) {
|
|
|
96
96
|
/**
|
|
97
97
|
* Renders root object
|
|
98
98
|
*/
|
|
99
|
-
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: 'md', title: _jsxs(Box, Object.assign({ className: classes.title, component: 'span' }, { children: [Boolean(step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent) && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: "Back" }))), _jsx(Box, Object.assign({ component: 'span' }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: 'paper', onClose: onClose, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? _jsx(EventForm, { presetLocation: SCEventLocationType.LIVESTREAM, onSuccess: handleSubmit }) : _jsx(LiveStreamForm, { onSuccess: handleSubmit }) }))] })) })));
|
|
99
|
+
return (_jsx(Root, Object.assign({ DialogContentProps: { dividers: false }, maxWidth: 'md', title: _jsxs(Box, Object.assign({ className: classes.title, component: 'span' }, { children: [Boolean(step === CreateLiveStreamStep.CREATE_LIVE && canCreateEvent) && (_jsx(Button, Object.assign({ variant: "text", onClick: handleBack, startIcon: _jsx(Icon, { children: "arrow_back" }) }, { children: "Back" }))), _jsx(Box, Object.assign({ component: 'span' }, { children: _jsx(FormattedMessage, { id: "ui.createLivestreamDialog.title", defaultMessage: "ui.createLivestreamDialog.title" }) }))] })), fullWidth: true, open: open, scroll: 'paper', onClose: onClose, className: classNames(classes.root, className), TransitionComponent: Transition, PaperProps: { elevation: 0 } }, rest, { children: _jsxs(Box, Object.assign({ className: classes.content }, { children: [step === CreateLiveStreamStep.SELECT_TYPE && (_jsx(LiveStreamSelector, { liveSelected: liveType, onLiveSelected: handleLiveTypeSelected, onNext: handleLiveTypeSelectedNext })), step === CreateLiveStreamStep.CREATE_LIVE && (_jsx(_Fragment, { children: liveType === LiveStreamType.EVENT_LIVE ? (_jsx(EventForm, { presetLocation: SCEventLocationType.LIVESTREAM, onSuccess: handleSubmit })) : (_jsx(LiveStreamForm, { onSuccess: handleSubmit })) }))] })) })));
|
|
100
100
|
}
|
|
@@ -120,7 +120,7 @@ export default function LiveStreamForm(inProps) {
|
|
|
120
120
|
formData.append('title', field.title);
|
|
121
121
|
formData.append('description', field.description);
|
|
122
122
|
formData.append('slug', field.slug);
|
|
123
|
-
formData.append('settings', JSON.stringify(
|
|
123
|
+
formData.append('settings', JSON.stringify(field.settings));
|
|
124
124
|
let liveStreamService;
|
|
125
125
|
if (liveStream) {
|
|
126
126
|
liveStreamService = LiveStreamService.update(liveStream.id, formData, {
|
|
@@ -51,7 +51,7 @@ export default function LiveStreamSettingsForm(inProps) {
|
|
|
51
51
|
/**
|
|
52
52
|
* Renders root object
|
|
53
53
|
*/
|
|
54
|
-
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.muteParticipants", defaultMessage: "ui.liveStreamForm.muteParticipants" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableShareScreen", defaultMessage: "ui.liveStreamForm.disableShareScreen" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(Switch, { className: classes.switch, checked: Boolean(settings === null || settings === void 0 ? void 0 : settings.
|
|
54
|
+
return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.muteParticipants", defaultMessage: "ui.liveStreamForm.muteParticipants" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableVideo", defaultMessage: "ui.liveStreamForm.disableVideo" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableChat", defaultMessage: "ui.liveStreamForm.disableChat" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.disableShareScreen", defaultMessage: "ui.liveStreamForm.disableShareScreen" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.hideParticipantsList", defaultMessage: "ui.liveStreamForm.hideParticipantsList" }) }))] })), _jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center" }, { children: [_jsx(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) })) }), _jsx(Typography, Object.assign({ className: classes.switchLabel }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.automaticallyNotifyFollowers", defaultMessage: "ui.liveStreamForm.automaticallyNotifyFollowers" }) }))] })), _jsxs(FormControl, Object.assign({ className: classes.accessView }, { children: [_jsx(InputLabel, Object.assign({ id: "viewLabel" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamForm.view.label", defaultMessage: "ui.liveStreamForm.view.label" }) })), _jsx(Select, Object.assign({ name: "view", label: _jsx(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 : SCLiveStreamViewType.SPEAKER, onChange: (e) => onChange(Object.assign(Object.assign({}, settings), { ['view']: e.target.value })), displayEmpty: true, renderValue: (selected) => {
|
|
55
55
|
return (_jsxs(_Fragment, { children: [_jsx(Icon, Object.assign({ className: classes.accessViewIcon }, { children: selected === SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${selected}`, defaultMessage: `ui.liveStreamForm.view.${selected}` })] }));
|
|
56
56
|
} }, { children: Object.values(SCLiveStreamViewType).map((f) => (_jsx(MenuItem, Object.assign({ value: f }, { children: _jsxs(Box, { children: [_jsx(Typography, Object.assign({ variant: "body1" }, { children: _jsxs("b", { children: [_jsx(Icon, Object.assign({ className: classes.accessViewIcon }, { children: f === SCLiveStreamViewType.SPEAKER ? 'upload' : 'category' })), "\u00A0", _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${f}`, defaultMessage: `ui.liveStreamForm.view.${f}` })] }) })), _jsx(Typography, { children: _jsx(FormattedMessage, { id: `ui.liveStreamForm.view.${f}.description`, defaultMessage: `ui.liveStreamForm.view.${f}.description` }) })] }) }), f))) }))] }))] })));
|
|
57
57
|
}
|
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import { SCLiveStreamViewType } from '@selfcommunity/types';
|
|
|
2
2
|
export const PREFIX = 'SCLiveStreamForm';
|
|
3
3
|
export const LIVESTREAM_DEFAULT_SETTINGS = {
|
|
4
4
|
muteParticipants: true,
|
|
5
|
-
|
|
5
|
+
hideParticipantsList: false,
|
|
6
6
|
automaticallyNotifyFollowers: false,
|
|
7
7
|
disableVideo: true,
|
|
8
8
|
disableChat: false,
|
|
@@ -134,5 +134,5 @@ export default function LiveStreamRoom(inProps) {
|
|
|
134
134
|
return (_jsx(Root, Object.assign({ id: id, className: classNames(classes.root, className) }, rest, { children: _jsx(Box, Object.assign({ className: classes.content, "data-lk-theme": "default" }, { children: connectionDetails === undefined || preJoinChoices === undefined ? (_jsxs(_Fragment, { children: [startPrejoinContent && _jsx(Box, Object.assign({ className: classes.startPrejoinContent }, { children: startPrejoinContent })), (scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.title) && (_jsx(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) && (_jsx(Typography, Object.assign({ component: 'div', variant: "body1", className: classes.description }, { children: scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.description }))), _jsxs(Box, Object.assign({ className: classNames(classes.preJoin, { [classes.preJoinLoading]: loading }) }, { children: [_jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(PreJoin, { defaults: preJoinDefaults, onSubmit: handlePreJoinSubmit, onError: handlePreJoinError }) })), loading && (_jsxs(Box, Object.assign({ className: classes.prejoinLoader }, { children: [_jsx(CircularProgress, {}), _jsx(Typography, Object.assign({ component: 'div', variant: "body2" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.connecting", defaultMessage: "ui.liveStreamRoom.connecting" }) }))] })))] })), _jsxs(Box, Object.assign({ className: classes.endPrejoinContent }, { children: [Boolean(scUserContext.user &&
|
|
135
135
|
scUserContext.user.id !== scLiveStream.host.id &&
|
|
136
136
|
scLiveStream &&
|
|
137
|
-
(((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: [scLiveStream && ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) && (_jsxs(_Fragment, { children: [
|
|
137
|
+
(((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.muteParticipants) || (scLiveStream && ((_b = scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo)))) && (_jsxs(Alert, Object.assign({ variant: "filled", severity: "error" }, { children: [scLiveStream && ((_c = scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) && (_jsxs(_Fragment, { children: [_jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableMicrophone", defaultMessage: "ui.liveStreamRoom.hostDisableMicrophone" }), _jsx("br", {})] })), scLiveStream && ((_d = scLiveStream.settings) === null || _d === void 0 ? void 0 : _d.disableVideo) && (_jsx(_Fragment, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.hostDisableVideo", defaultMessage: "ui.liveStreamRoom.hostDisableVideo" }) }))] }))), endPrejoinContent] }))] })) : (_jsx(Box, Object.assign({ className: classes.conference }, { children: _jsx(LiveStreamContext.Provider, Object.assign({ value: { liveStream: scLiveStream } }, { children: _jsx(LiveStreamVideoConference, Object.assign({ connectionDetails: connectionDetails, userChoices: preJoinChoices }, LiveStreamVideoConferenceComponentProps)) })) }))) })) })));
|
|
138
138
|
}
|
|
@@ -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,58 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Track } from 'livekit-client';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { supportsScreenSharing } from '@livekit/components-core';
|
|
6
|
+
import { ChatIcon, ChatToggle, GearIcon, LeaveIcon, MediaDeviceMenu, StartMediaButton, useLocalParticipantPermissions, useMaybeLayoutContext, usePersistentUserChoices } from '@livekit/components-react';
|
|
7
|
+
import { TrackToggle } from './TrackToggle';
|
|
8
|
+
import { useMediaQuery } from '@mui/material';
|
|
9
|
+
import { SettingsMenuToggle } from './SettingsMenuToggle';
|
|
10
|
+
import { DisconnectButton } from './DisconnectButton';
|
|
11
|
+
import { mergeProps } from './utils';
|
|
12
|
+
/**
|
|
13
|
+
* The `ControlBar` prefab gives the user the basic user interface to control their
|
|
14
|
+
* media devices (camera, microphone and screen share), open the `Chat` and leave the room.
|
|
15
|
+
*/
|
|
16
|
+
export function ControlBar(_a) {
|
|
17
|
+
var _b, _c, _d, _e, _f;
|
|
18
|
+
var { variation, controls, saveUserChoices = true, onDeviceError } = _a, props = __rest(_a, ["variation", "controls", "saveUserChoices", "onDeviceError"]);
|
|
19
|
+
const [isChatOpen, setIsChatOpen] = React.useState(false);
|
|
20
|
+
const layoutContext = useMaybeLayoutContext();
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if (((_a = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _a === void 0 ? void 0 : _a.showChat) !== undefined) {
|
|
24
|
+
setIsChatOpen((_b = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _b === void 0 ? void 0 : _b.showChat);
|
|
25
|
+
}
|
|
26
|
+
}, [(_b = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.widget.state) === null || _b === void 0 ? void 0 : _b.showChat]);
|
|
27
|
+
const isTooLittleSpace = useMediaQuery(`(max-width: ${isChatOpen ? 1000 : 760}px)`);
|
|
28
|
+
const defaultVariation = isTooLittleSpace ? 'minimal' : 'verbose';
|
|
29
|
+
variation !== null && variation !== void 0 ? variation : (variation = defaultVariation);
|
|
30
|
+
const visibleControls = Object.assign({ leave: true }, controls);
|
|
31
|
+
const localPermissions = useLocalParticipantPermissions();
|
|
32
|
+
if (!localPermissions) {
|
|
33
|
+
visibleControls.camera = false;
|
|
34
|
+
visibleControls.chat = false;
|
|
35
|
+
visibleControls.microphone = false;
|
|
36
|
+
visibleControls.screenShare = false;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
(_c = visibleControls.camera) !== null && _c !== void 0 ? _c : (visibleControls.camera = localPermissions.canPublish);
|
|
40
|
+
(_d = visibleControls.microphone) !== null && _d !== void 0 ? _d : (visibleControls.microphone = localPermissions.canPublish);
|
|
41
|
+
(_e = visibleControls.screenShare) !== null && _e !== void 0 ? _e : (visibleControls.screenShare = localPermissions.canPublish);
|
|
42
|
+
(_f = visibleControls.chat) !== null && _f !== void 0 ? _f : (visibleControls.chat = localPermissions.canPublishData && (controls === null || controls === void 0 ? void 0 : controls.chat));
|
|
43
|
+
}
|
|
44
|
+
const showIcon = React.useMemo(() => variation === 'minimal' || variation === 'verbose', [variation]);
|
|
45
|
+
const showText = React.useMemo(() => variation === 'textOnly' || variation === 'verbose', [variation]);
|
|
46
|
+
const browserSupportsScreenSharing = supportsScreenSharing();
|
|
47
|
+
const [isScreenShareEnabled, setIsScreenShareEnabled] = React.useState(false);
|
|
48
|
+
const onScreenShareChange = React.useCallback((enabled) => {
|
|
49
|
+
setIsScreenShareEnabled(enabled);
|
|
50
|
+
}, [setIsScreenShareEnabled]);
|
|
51
|
+
const htmlProps = mergeProps({ className: 'lk-control-bar' }, props);
|
|
52
|
+
const { saveAudioInputEnabled, saveVideoInputEnabled, saveAudioInputDeviceId, saveVideoInputDeviceId } = usePersistentUserChoices({
|
|
53
|
+
preventSave: !saveUserChoices
|
|
54
|
+
});
|
|
55
|
+
const microphoneOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveAudioInputEnabled(enabled) : null), [saveAudioInputEnabled]);
|
|
56
|
+
const cameraOnChange = React.useCallback((enabled, isUserInitiated) => (isUserInitiated ? saveVideoInputEnabled(enabled) : null), [saveVideoInputEnabled]);
|
|
57
|
+
return (_jsxs("div", Object.assign({}, htmlProps, { children: [visibleControls.microphone && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Microphone, showIcon: showIcon, onChange: microphoneOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Microphone, error }) }, { children: showText && 'Microphone' })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "audioinput", onActiveDeviceChange: (_kind, deviceId) => saveAudioInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.camera && (_jsxs("div", Object.assign({ className: "lk-button-group" }, { children: [_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.Camera, showIcon: showIcon, onChange: cameraOnChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.Camera, error }) }, { children: showText && 'Camera' })) }), _jsx("div", Object.assign({ className: "lk-button-group-menu" }, { children: _jsx(MediaDeviceMenu, { kind: "videoinput", onActiveDeviceChange: (_kind, deviceId) => saveVideoInputDeviceId(deviceId !== null && deviceId !== void 0 ? deviceId : '') }) }))] }))), visibleControls.screenShare && browserSupportsScreenSharing && (_jsx(_Fragment, { children: _jsx(TrackToggle, Object.assign({ source: Track.Source.ScreenShare, captureOptions: { audio: true, selfBrowserSurface: 'include' }, showIcon: showIcon, onChange: onScreenShareChange, onDeviceError: (error) => onDeviceError === null || onDeviceError === void 0 ? void 0 : onDeviceError({ source: Track.Source.ScreenShare, error }) }, { children: showText && (isScreenShareEnabled ? 'Stop screen share' : 'Share screen') })) })), visibleControls.chat && (_jsx(_Fragment, { children: _jsxs(ChatToggle, { children: [showIcon && _jsx(ChatIcon, {}), showText && 'Chat'] }) })), visibleControls.settings && (_jsx(_Fragment, { children: _jsxs(SettingsMenuToggle, { children: [showIcon && _jsx(GearIcon, {}), showText && 'Settings'] }) })), visibleControls.leave && (_jsx(_Fragment, { children: _jsxs(DisconnectButton, { children: [showIcon && _jsx(LeaveIcon, {}), showText && 'Leave'] }) })), _jsx(StartMediaButton, {})] })));
|
|
58
|
+
}
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useDisconnectButton } from '@livekit/components-react';
|
|
4
|
+
/**
|
|
5
|
+
* The `DisconnectButton` is a basic html button with the added ability to disconnect from a LiveKit room.
|
|
6
|
+
* Normally this is the big red button that allows end users to leave the video or audio call.
|
|
7
|
+
*/
|
|
8
|
+
export const DisconnectButton =
|
|
9
|
+
/* @__PURE__ */ React.forwardRef(function DisconnectButton(props, ref) {
|
|
10
|
+
const { buttonProps } = useDisconnectButton(props);
|
|
11
|
+
return (_jsx("button", Object.assign({ ref: ref }, buttonProps, { children: props.children })));
|
|
12
|
+
});
|
package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { Box, Button, CircularProgress, Typography } from '@mui/material';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { useThemeProps } from '@mui/system';
|
|
6
|
-
import { Link,
|
|
6
|
+
import { Link, useSCUser } from '@selfcommunity/react-core';
|
|
7
7
|
import { SCLiveStreamViewType } from '@selfcommunity/types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { PREFIX } from './constants';
|
|
@@ -57,100 +57,24 @@ export default function LiveStreamVideoConference(inProps) {
|
|
|
57
57
|
}, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = defaultVideoOptions } = props, rest = __rest(props, ["className", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
|
|
58
58
|
// CONTEXT
|
|
59
59
|
const scUserContext = useSCUser();
|
|
60
|
-
const scRoutingContext = useSCRouting();
|
|
61
|
-
const { preferences, features } = useSCPreferences();
|
|
62
60
|
const { liveStream } = useLiveStream();
|
|
63
|
-
//
|
|
64
|
-
// const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
// const worker = typeof window !== 'undefined' && e2eePassphrase && new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));
|
|
68
|
-
// const e2eeEnabled = !!(e2eePassphrase && worker);
|
|
69
|
-
// const keyProvider = new ExternalE2EEKeyProvider();
|
|
70
|
-
const [e2eeSetupComplete, setE2eeSetupComplete] = useState(true);
|
|
61
|
+
// STATE
|
|
71
62
|
const [liveActive, setLiveActive] = useState(true);
|
|
72
63
|
const [error, setError] = useState(null);
|
|
64
|
+
// PERMISSIONS
|
|
73
65
|
const canUseAudio = 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]);
|
|
74
66
|
const canUseVideo = 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]);
|
|
75
|
-
const canUseChat = useMemo(() => { var _a; return scUserContext.user && liveStream &&
|
|
67
|
+
const canUseChat = 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]);
|
|
76
68
|
const canUseShareScreen = 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]);
|
|
77
69
|
const speakerFocused = useMemo(() => (scUserContext.user && liveStream && liveStream.settings.view === SCLiveStreamViewType.SPEAKER ? liveStream.host : null), [scUserContext, liveStream]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
SCPreferences.CONFIGURATIONS_LIVE_STREAM_MAX_PARTICIPANTS in preferences &&
|
|
82
|
-
preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_MAX_PARTICIPANTS].value,
|
|
83
|
-
[preferences]
|
|
84
|
-
); */
|
|
85
|
-
// Room options
|
|
86
|
-
/* const roomOptions = useMemo((): RoomOptions => {
|
|
87
|
-
let videoCodec: VideoCodec | undefined = options.codec ? options.codec : defaultVideoOptions.codec;
|
|
88
|
-
if (e2eeEnabled && (videoCodec === 'av1' || videoCodec === 'vp9')) {
|
|
89
|
-
videoCodec = undefined;
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
// emptyTimeout: 3 * 60, // 3 minutes
|
|
93
|
-
// maxParticipants: liveStreamRoomMaxParticipants,
|
|
94
|
-
videoCaptureDefaults: {
|
|
95
|
-
deviceId: userChoices.videoDeviceId ?? undefined,
|
|
96
|
-
resolution: options.hq ? VideoPresets.h2160 : VideoPresets.h720
|
|
97
|
-
},
|
|
98
|
-
publishDefaults: {
|
|
99
|
-
dtx: false,
|
|
100
|
-
videoSimulcastLayers: options.hq ? [VideoPresets.h1080, VideoPresets.h720] : [VideoPresets.h540, VideoPresets.h216],
|
|
101
|
-
red: !e2eeEnabled,
|
|
102
|
-
videoCodec
|
|
103
|
-
},
|
|
104
|
-
audioCaptureDefaults: {
|
|
105
|
-
deviceId: userChoices.audioDeviceId ?? undefined
|
|
106
|
-
},
|
|
107
|
-
adaptiveStream: {pixelDensity: 'screen'},
|
|
108
|
-
dynacast: true,
|
|
109
|
-
e2ee: e2eeEnabled
|
|
110
|
-
? {
|
|
111
|
-
keyProvider,
|
|
112
|
-
worker
|
|
113
|
-
}
|
|
114
|
-
: undefined
|
|
115
|
-
};
|
|
116
|
-
}, [liveStreamRoomMaxParticipants, userChoices, options.hq, options.codec]); */
|
|
117
|
-
// Create room - only initial
|
|
118
|
-
/* const room = useMemo(() => {
|
|
119
|
-
const room = new Room();
|
|
120
|
-
return new Room(roomOptions);
|
|
121
|
-
}, [liveStreamRoomMaxParticipants]); */
|
|
70
|
+
console.log(canUseChat);
|
|
71
|
+
console.log(speakerFocused);
|
|
72
|
+
// CONNECT OPTIONS
|
|
122
73
|
const connectOptions = useMemo(() => {
|
|
123
74
|
return {
|
|
124
75
|
autoSubscribe: true
|
|
125
76
|
};
|
|
126
77
|
}, []);
|
|
127
|
-
/* useEffect(() => {
|
|
128
|
-
if (room) {
|
|
129
|
-
if (e2eeEnabled) {
|
|
130
|
-
keyProvider
|
|
131
|
-
.setKey(decodePassphrase(e2eePassphrase))
|
|
132
|
-
.then(() => {
|
|
133
|
-
room.setE2EEEnabled(true).catch((e) => {
|
|
134
|
-
if (e instanceof DeviceUnsupportedError) {
|
|
135
|
-
alert(
|
|
136
|
-
`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.`
|
|
137
|
-
);
|
|
138
|
-
console.error(e);
|
|
139
|
-
} else {
|
|
140
|
-
throw e;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
})
|
|
144
|
-
.then(() => {
|
|
145
|
-
setE2eeSetupComplete(true);
|
|
146
|
-
setLiveActive(true);
|
|
147
|
-
});
|
|
148
|
-
} else {
|
|
149
|
-
setE2eeSetupComplete(true);
|
|
150
|
-
setLiveActive(true);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}, [e2eeEnabled, room, e2eePassphrase]); */
|
|
154
78
|
// HANDLERS
|
|
155
79
|
/**
|
|
156
80
|
* Handle on leave
|
|
@@ -184,5 +108,5 @@ export default function LiveStreamVideoConference(inProps) {
|
|
|
184
108
|
/**
|
|
185
109
|
* Renders root object
|
|
186
110
|
*/
|
|
187
|
-
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: liveActive && !error ? (_jsx(_Fragment, { children: _jsx(LiveKitRoom, Object.assign({ connect: Boolean(
|
|
111
|
+
return (_jsx(Root, Object.assign({ className: classNames(classes.root, className) }, rest, { children: liveActive && !error ? (_jsx(_Fragment, { children: _jsx(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: _jsxs(LayoutContextProvider, { children: [_jsx(VideoConference, Object.assign({ chatMessageFormatter: formatChatMessageLinks }, (speakerFocused && { speakerFocused: liveStream.host }), VideoConferenceComponentProps, { disableMicrophone: !canUseAudio, disableCamera: !canUseVideo, disableChat: !canUseChat, disableShareScreen: !canUseShareScreen })), _jsx(ConnectionState, {})] }) })) })) : (_jsx(_Fragment, { children: error ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, error, endConferenceEndContent] }))) : liveActive === false ? (_jsxs(Box, Object.assign({ className: classes.endConferenceWrap }, { children: [startConferenceEndContent, _jsx(Typography, Object.assign({ variant: "h5" }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.conference.end", defaultMessage: "ui.liveStreamRoom.conference.end" }) })), _jsx(Button, Object.assign({ variant: "contained", color: "secondary", component: Link, to: '/', className: classes.btnBackHome }, { children: _jsx(FormattedMessage, { id: "ui.liveStreamRoom.button.backHome", defaultMessage: "ui.liveStreamRoom.button.backHome" }) })), endConferenceEndContent] }))) : (_jsx(CircularProgress, {})) })) })));
|
|
188
112
|
}
|
package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
1
|
+
import { __awaiter, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
@@ -9,7 +9,7 @@ import { useSnackbar } from 'notistack';
|
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { Box, ClickAwayListener, Grow, IconButton, ListItemIcon, ListItemText, MenuItem, MenuList, Paper, SwipeableDrawer, useMediaQuery, useTheme } from '@mui/material';
|
|
11
11
|
import { LiveStreamApiClient } from '@selfcommunity/api-services';
|
|
12
|
-
import { SCContext, SCUserContext
|
|
12
|
+
import { SCContext, SCUserContext } from '@selfcommunity/react-core';
|
|
13
13
|
import { BAN_ROOM_USER } from './constants';
|
|
14
14
|
import ConfirmDialog from '../../../shared/ConfirmDialog/ConfirmDialog';
|
|
15
15
|
import { useEnsureParticipant } from '@livekit/components-react';
|
|
@@ -61,8 +61,6 @@ export default function ContributionActionsMenu(props) {
|
|
|
61
61
|
const isMobile = useMediaQuery(theme.breakpoints.down('md'));
|
|
62
62
|
const scContext = useContext(SCContext);
|
|
63
63
|
const scUserContext = useContext(SCUserContext);
|
|
64
|
-
const scUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
65
|
-
const scRoutingContext = useSCRouting();
|
|
66
64
|
const { enqueueSnackbar } = useSnackbar();
|
|
67
65
|
const p = useEnsureParticipant(participant);
|
|
68
66
|
const { liveStream } = useLiveStream();
|
|
@@ -99,16 +97,15 @@ export default function ContributionActionsMenu(props) {
|
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
99
|
/**
|
|
102
|
-
* Perform
|
|
100
|
+
* Perform ban participant
|
|
103
101
|
*/
|
|
104
|
-
const performBanParticipant = useMemo(() => () => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, [p]);
|
|
102
|
+
const performBanParticipant = useMemo(() => () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const res = yield LiveStreamApiClient.removeUserFromRoom(liveStream.id, p.identity);
|
|
104
|
+
if (res.status >= 300) {
|
|
105
|
+
return Promise.reject(res);
|
|
106
|
+
}
|
|
107
|
+
return yield Promise.resolve(res.data);
|
|
108
|
+
}), [p]);
|
|
112
109
|
/**
|
|
113
110
|
* Handle action
|
|
114
111
|
*/
|
package/lib/esm/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/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileAvatar.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from 'react';
|
|
3
4
|
import { styled } from '@mui/material/styles';
|
|
4
5
|
import { useThemeProps } from '@mui/system';
|
|
5
6
|
import { Box } from '@mui/material';
|
|
@@ -22,7 +23,7 @@ const Root = styled(Box, {
|
|
|
22
23
|
height: 100
|
|
23
24
|
}
|
|
24
25
|
}));
|
|
25
|
-
export default function
|
|
26
|
+
export default function ParticipantTileAvatar(inProps) {
|
|
26
27
|
// PROPS
|
|
27
28
|
const props = useThemeProps({
|
|
28
29
|
props: inProps,
|
|
@@ -31,5 +32,15 @@ export default function UserAvatar(inProps) {
|
|
|
31
32
|
const { className, user, participant } = props, rest = __rest(props, ["className", "user", "participant"]);
|
|
32
33
|
// CONTEXT
|
|
33
34
|
const scContext = useSCContext();
|
|
34
|
-
|
|
35
|
+
// AVATAR
|
|
36
|
+
const avatar = useMemo(() => {
|
|
37
|
+
if (user) {
|
|
38
|
+
return _jsx("img", { src: `${user.avatar}` });
|
|
39
|
+
}
|
|
40
|
+
if (participant) {
|
|
41
|
+
return _jsx("img", { src: `${scContext.settings.portal}/api/v2/avatar/${participant.identity}` });
|
|
42
|
+
}
|
|
43
|
+
return _jsx(ParticipantPlaceholder, {});
|
|
44
|
+
}, [user, participant]);
|
|
45
|
+
return (_jsx(Root, Object.assign({ className: classNames(className, classes.root) }, rest, { children: avatar })));
|
|
35
46
|
}
|
|
@@ -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,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { mergePropsReactAria } from './utils';
|
|
4
|
+
import { useLayoutContext } from '@livekit/components-react';
|
|
5
|
+
/**
|
|
6
|
+
* The `useSettingsToggle` hook provides state and functions for toggling the settings menu.
|
|
7
|
+
*/
|
|
8
|
+
export function useSettingsToggle({ props }) {
|
|
9
|
+
const { dispatch, state } = useLayoutContext().widget;
|
|
10
|
+
const className = 'lk-button lk-settings-toggle';
|
|
11
|
+
const mergedProps = React.useMemo(() => {
|
|
12
|
+
return mergePropsReactAria(props, {
|
|
13
|
+
className,
|
|
14
|
+
onClick: () => {
|
|
15
|
+
if (dispatch)
|
|
16
|
+
dispatch({ msg: 'toggle_settings' });
|
|
17
|
+
},
|
|
18
|
+
'aria-pressed': (state === null || state === void 0 ? void 0 : state.showSettings) ? 'true' : 'false'
|
|
19
|
+
});
|
|
20
|
+
}, [props, className, dispatch, state]);
|
|
21
|
+
return { mergedProps };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The `SettingsMenuToggle` component is a button that toggles the visibility of the `SettingsMenu` component.
|
|
25
|
+
*/
|
|
26
|
+
export const SettingsMenuToggle =
|
|
27
|
+
/* @__PURE__ */ React.forwardRef(function SettingsMenuToggle(props, ref) {
|
|
28
|
+
const { mergedProps } = useSettingsToggle({ props });
|
|
29
|
+
return (_jsx("button", Object.assign({ ref: ref }, mergedProps, { children: props.children })));
|
|
30
|
+
});
|