@selfcommunity/react-ui 0.8.0-live.59 → 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/EventForm/EventAddress.js +5 -2
- package/lib/cjs/components/LiveStreamForm/LiveStreamForm.js +1 -3
- package/lib/cjs/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
- package/lib/cjs/components/LiveStreamForm/constants.d.ts +2 -2
- package/lib/cjs/components/LiveStreamForm/constants.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamRoom.js +5 -6
- 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/LiveStreamProvider.d.ts +17 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +13 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +16 -88
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +33 -26
- 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/PreJoin.d.ts +1 -7
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +5 -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/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
- package/lib/esm/components/EventForm/EventAddress.js +6 -3
- package/lib/esm/components/LiveStreamForm/LiveStreamForm.js +2 -4
- package/lib/esm/components/LiveStreamForm/LiveStreamFormSettings.js +1 -1
- package/lib/esm/components/LiveStreamForm/constants.d.ts +2 -2
- package/lib/esm/components/LiveStreamForm/constants.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamRoom.js +5 -6
- 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/LiveStreamProvider.d.ts +17 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamProvider.js +9 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts +0 -6
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js +17 -89
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.d.ts +1 -0
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTile.js +2 -2
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/ParticipantTileActions.js +35 -28
- 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/PreJoin.d.ts +1 -7
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/PreJoin.js +5 -3
- 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/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +1 -1
- 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
|
@@ -42,6 +42,7 @@ const Root = (0, styles_1.styled)(material_1.Box, {
|
|
|
42
42
|
slot: 'EventAddressRoot'
|
|
43
43
|
})(() => ({}));
|
|
44
44
|
function EventAddress(inProps) {
|
|
45
|
+
var _a;
|
|
45
46
|
//PROPS
|
|
46
47
|
const props = (0, system_1.useThemeProps)({
|
|
47
48
|
props: inProps,
|
|
@@ -67,11 +68,13 @@ function EventAddress(inProps) {
|
|
|
67
68
|
}, [event]);
|
|
68
69
|
// CONTEXT
|
|
69
70
|
const scContext = (0, react_core_1.useSCContext)();
|
|
71
|
+
const scUserContext = (0, react_core_1.useSCUser)();
|
|
70
72
|
const geocodingApiKey = (0, react_1.useMemo)(() => scContext.settings.integrations && scContext.settings.integrations.geocoding.apiKey, [scContext.settings.integrations]);
|
|
71
73
|
const { isLoaded } = (0, api_1.useLoadScript)({
|
|
72
74
|
googleMapsApiKey: scContext.settings.integrations.geocoding.apiKey,
|
|
73
75
|
libraries: ['places', 'geocoding']
|
|
74
76
|
});
|
|
77
|
+
const canViewLiveTab = (0, react_1.useMemo)(() => { var _a, _b; return ((_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream) || event.live_stream; }, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission]);
|
|
75
78
|
// HANDLERS
|
|
76
79
|
const handleChange = (_event, newValue) => {
|
|
77
80
|
setLocation(newValue);
|
|
@@ -135,8 +138,8 @@ function EventAddress(inProps) {
|
|
|
135
138
|
if (!geocodingApiKey && !isLoaded) {
|
|
136
139
|
return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
|
|
137
140
|
}
|
|
138
|
-
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "photo_camera" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [location === types_1.SCEventLocationType.PERSON && ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === types_1.SCEventLocationType.ONLINE && ((0, jsx_runtime_1.jsx)(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
|
|
141
|
+
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) }), canViewLiveTab && ((0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.LIVESTREAM, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "photo_camera" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.liveStream.label", defaultMessage: "ui.eventForm.address.liveStream.label" }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [location === types_1.SCEventLocationType.PERSON && ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === types_1.SCEventLocationType.ONLINE && ((0, jsx_runtime_1.jsx)(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
|
|
139
142
|
endAdornment: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" })
|
|
140
|
-
}, onChange: handleLinkChange })), location === types_1.SCEventLocationType.LIVESTREAM && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LiveStream_1.default, { template: liveStream_1.SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }), (0, jsx_runtime_1.jsx)(LiveStreamFormSettings_1.default, { settings: liveStream.settings, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
|
|
143
|
+
}, onChange: handleLinkChange })), canViewLiveTab && location === types_1.SCEventLocationType.LIVESTREAM && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LiveStream_1.default, { template: liveStream_1.SCLiveStreamTemplateType.SNIPPET, liveStream: liveStream, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }), (0, jsx_runtime_1.jsx)(LiveStreamFormSettings_1.default, { settings: liveStream.settings, onChange: handleLiveStreamSettingsChange })] }))] }))] })));
|
|
141
144
|
}
|
|
142
145
|
exports.default = EventAddress;
|
|
@@ -98,8 +98,6 @@ function LiveStreamForm(inProps) {
|
|
|
98
98
|
const [error, setError] = (0, react_1.useState)({});
|
|
99
99
|
// PREFERENCES
|
|
100
100
|
const scPreferences = (0, react_core_1.useSCPreferences)();
|
|
101
|
-
const privateEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED].value, [scPreferences.preferences]);
|
|
102
|
-
const visibilityEnabled = (0, react_1.useMemo)(() => scPreferences.preferences[react_core_1.SCPreferences.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED].value, [scPreferences.preferences]);
|
|
103
101
|
const _backgroundCover = Object.assign({}, (field.cover
|
|
104
102
|
? { background: `url('${field.cover}') center / cover` }
|
|
105
103
|
: { background: `url('${scPreferences.preferences[react_core_1.SCPreferences.IMAGES_USER_DEFAULT_COVER].value}') center / cover` }));
|
|
@@ -153,7 +151,7 @@ function LiveStreamForm(inProps) {
|
|
|
153
151
|
utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
|
|
154
152
|
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
155
153
|
});
|
|
156
|
-
}, [field,
|
|
154
|
+
}, [field, onSuccess, onError]);
|
|
157
155
|
const handleChange = (0, react_1.useCallback)((event) => {
|
|
158
156
|
const { name, value } = event.target;
|
|
159
157
|
setField((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
@@ -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.
|
|
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
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SCLiveStreamViewType } from '@selfcommunity/types';
|
|
2
2
|
export declare const PREFIX = "SCLiveStreamForm";
|
|
3
3
|
export declare const LIVESTREAM_DEFAULT_SETTINGS: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
muteParticipants: boolean;
|
|
5
|
+
hideParticipantsList: boolean;
|
|
6
6
|
automaticallyNotifyFollowers: boolean;
|
|
7
7
|
disableVideo: boolean;
|
|
8
8
|
disableChat: boolean;
|
|
@@ -4,8 +4,8 @@ exports.LIVESTREAM_DEFAULT_SETTINGS = exports.PREFIX = void 0;
|
|
|
4
4
|
const types_1 = require("@selfcommunity/types");
|
|
5
5
|
exports.PREFIX = 'SCLiveStreamForm';
|
|
6
6
|
exports.LIVESTREAM_DEFAULT_SETTINGS = {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
muteParticipants: true,
|
|
8
|
+
hideParticipantsList: false,
|
|
9
9
|
automaticallyNotifyFollowers: false,
|
|
10
10
|
disableVideo: true,
|
|
11
11
|
disableChat: false,
|
|
@@ -17,6 +17,7 @@ const api_services_1 = require("@selfcommunity/api-services");
|
|
|
17
17
|
const utils_1 = require("@selfcommunity/utils");
|
|
18
18
|
const Errors_1 = require("../../constants/Errors");
|
|
19
19
|
const PreJoin_1 = require("./LiveStreamVideoConference/PreJoin");
|
|
20
|
+
const LiveStreamProvider_1 = require("./LiveStreamVideoConference/LiveStreamProvider");
|
|
20
21
|
const classes = {
|
|
21
22
|
root: `${constants_1.PREFIX}-root`,
|
|
22
23
|
content: `${constants_1.PREFIX}-content`,
|
|
@@ -79,7 +80,7 @@ function LiveStreamRoom(inProps) {
|
|
|
79
80
|
return {
|
|
80
81
|
username: ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.username) || '',
|
|
81
82
|
videoEnabled: ((_b = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _b === void 0 ? void 0 : _b.disableVideo) === false,
|
|
82
|
-
audioEnabled: ((_c = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.
|
|
83
|
+
audioEnabled: ((_c = scLiveStream === null || scLiveStream === void 0 ? void 0 : scLiveStream.settings) === null || _c === void 0 ? void 0 : _c.muteParticipants) === false
|
|
83
84
|
};
|
|
84
85
|
}, [scUserContext.user, scLiveStream]);
|
|
85
86
|
const [connectionDetails, setConnectionDetails] = (0, react_1.useState)(presetConnectionDetails);
|
|
@@ -99,8 +100,6 @@ function LiveStreamRoom(inProps) {
|
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
}, []);
|
|
102
|
-
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.muteParticipant)); }, [scUserContext, liveStream]);
|
|
103
|
-
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]);
|
|
104
103
|
// HANDLERS
|
|
105
104
|
/**
|
|
106
105
|
* Handle PreJoin Submit
|
|
@@ -128,15 +127,15 @@ function LiveStreamRoom(inProps) {
|
|
|
128
127
|
/**
|
|
129
128
|
* User must be authenticated
|
|
130
129
|
*/
|
|
131
|
-
if (
|
|
130
|
+
if (!scLiveStream || !scUserContext.user || !liveStreamEnabled) {
|
|
132
131
|
return (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {});
|
|
133
132
|
}
|
|
134
133
|
/**
|
|
135
134
|
* Renders root object
|
|
136
135
|
*/
|
|
137
|
-
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)(
|
|
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 &&
|
|
138
137
|
scUserContext.user.id !== scLiveStream.host.id &&
|
|
139
138
|
scLiveStream &&
|
|
140
|
-
(((_a = scLiveStream.settings) === null || _a === void 0 ? void 0 : _a.
|
|
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)) })) }))) })) })));
|
|
141
140
|
}
|
|
142
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
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SCLiveStreamType } from '@selfcommunity/types';
|
|
3
|
+
/**
|
|
4
|
+
* Interface LiveStreamContextType
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveStreamContextType {
|
|
7
|
+
/**
|
|
8
|
+
* Options
|
|
9
|
+
*/
|
|
10
|
+
liveStream: SCLiveStreamType;
|
|
11
|
+
}
|
|
12
|
+
export declare const LiveStreamContext: import("react").Context<LiveStreamContextType>;
|
|
13
|
+
/**
|
|
14
|
+
* Let's only export the `useLiveStream` hook instead of the context.
|
|
15
|
+
* We only want to use the hook directly and never the context component.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useLiveStream(): LiveStreamContextType;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLiveStream = exports.LiveStreamContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.LiveStreamContext = (0, react_1.createContext)({});
|
|
6
|
+
/**
|
|
7
|
+
* Let's only export the `useLiveStream` hook instead of the context.
|
|
8
|
+
* We only want to use the hook directly and never the context component.
|
|
9
|
+
*/
|
|
10
|
+
function useLiveStream() {
|
|
11
|
+
return (0, react_1.useContext)(exports.LiveStreamContext);
|
|
12
|
+
}
|
|
13
|
+
exports.useLiveStream = useLiveStream;
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
|
-
import { SCLiveStreamType } from '@selfcommunity/types/src/index';
|
|
3
2
|
import { LiveKitRoomProps, LocalUserChoices, VideoConferenceProps } from '@livekit/components-react';
|
|
4
3
|
import { VideoCodec } from 'livekit-client';
|
|
5
4
|
import React from 'react';
|
|
@@ -10,11 +9,6 @@ export interface LiveStreamVideoConferenceProps extends BoxProps {
|
|
|
10
9
|
* @default null
|
|
11
10
|
*/
|
|
12
11
|
className?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Livestream Object
|
|
15
|
-
* @default null
|
|
16
|
-
*/
|
|
17
|
-
liveStream?: SCLiveStreamType;
|
|
18
12
|
/**
|
|
19
13
|
* User choices
|
|
20
14
|
*/
|
package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/LiveStreamVideoConference.js
CHANGED
|
@@ -6,6 +6,7 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const styles_1 = require("@mui/material/styles");
|
|
7
7
|
const system_1 = require("@mui/system");
|
|
8
8
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
|
+
const types_1 = require("@selfcommunity/types");
|
|
9
10
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
10
11
|
const constants_1 = require("./constants");
|
|
11
12
|
const components_react_1 = require("@livekit/components-react");
|
|
@@ -14,6 +15,7 @@ const components_core_1 = require("@livekit/components-core");
|
|
|
14
15
|
const constants_2 = require("../constants");
|
|
15
16
|
const react_intl_1 = require("react-intl");
|
|
16
17
|
const VideoConference_1 = require("./VideoConference");
|
|
18
|
+
const LiveStreamProvider_1 = require("./LiveStreamProvider");
|
|
17
19
|
const classes = {
|
|
18
20
|
root: `${constants_1.PREFIX}-root`,
|
|
19
21
|
title: `${constants_1.PREFIX}-title`,
|
|
@@ -52,103 +54,29 @@ function LiveStreamVideoConference(inProps) {
|
|
|
52
54
|
props: inProps,
|
|
53
55
|
name: constants_1.PREFIX
|
|
54
56
|
});
|
|
55
|
-
const { className,
|
|
57
|
+
const { className, handleOnLeaveRoom, userChoices = components_core_1.defaultUserChoices, connectionDetails = {}, LiveKitRoomComponentProps = {
|
|
56
58
|
/* simulateParticipants: true */
|
|
57
|
-
}, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = constants_2.defaultVideoOptions } = props, rest = tslib_1.__rest(props, ["className", "
|
|
59
|
+
}, VideoConferenceComponentProps = {}, startConferenceEndContent, endConferenceEndContent, options = constants_2.defaultVideoOptions } = props, rest = tslib_1.__rest(props, ["className", "handleOnLeaveRoom", "userChoices", "connectionDetails", "LiveKitRoomComponentProps", "VideoConferenceComponentProps", "startConferenceEndContent", "endConferenceEndContent", "options"]);
|
|
58
60
|
// CONTEXT
|
|
59
61
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
// Passphrase
|
|
63
|
-
// const e2eePassphrase = typeof window !== 'undefined' && decodePassphrase(location.hash.substring(1));
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
// const worker = typeof window !== 'undefined' && e2eePassphrase && new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));
|
|
67
|
-
// const e2eeEnabled = !!(e2eePassphrase && worker);
|
|
68
|
-
// const keyProvider = new ExternalE2EEKeyProvider();
|
|
69
|
-
const [e2eeSetupComplete, setE2eeSetupComplete] = (0, react_1.useState)(true);
|
|
62
|
+
const { liveStream } = (0, LiveStreamProvider_1.useLiveStream)();
|
|
63
|
+
// STATE
|
|
70
64
|
const [liveActive, setLiveActive] = (0, react_1.useState)(true);
|
|
71
65
|
const [error, setError] = (0, react_1.useState)(null);
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
[preferences]
|
|
82
|
-
); */
|
|
83
|
-
// Room options
|
|
84
|
-
/* const roomOptions = useMemo((): RoomOptions => {
|
|
85
|
-
let videoCodec: VideoCodec | undefined = options.codec ? options.codec : defaultVideoOptions.codec;
|
|
86
|
-
if (e2eeEnabled && (videoCodec === 'av1' || videoCodec === 'vp9')) {
|
|
87
|
-
videoCodec = undefined;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
// emptyTimeout: 3 * 60, // 3 minutes
|
|
91
|
-
// maxParticipants: liveStreamRoomMaxParticipants,
|
|
92
|
-
videoCaptureDefaults: {
|
|
93
|
-
deviceId: userChoices.videoDeviceId ?? undefined,
|
|
94
|
-
resolution: options.hq ? VideoPresets.h2160 : VideoPresets.h720
|
|
95
|
-
},
|
|
96
|
-
publishDefaults: {
|
|
97
|
-
dtx: false,
|
|
98
|
-
videoSimulcastLayers: options.hq ? [VideoPresets.h1080, VideoPresets.h720] : [VideoPresets.h540, VideoPresets.h216],
|
|
99
|
-
red: !e2eeEnabled,
|
|
100
|
-
videoCodec
|
|
101
|
-
},
|
|
102
|
-
audioCaptureDefaults: {
|
|
103
|
-
deviceId: userChoices.audioDeviceId ?? undefined
|
|
104
|
-
},
|
|
105
|
-
adaptiveStream: {pixelDensity: 'screen'},
|
|
106
|
-
dynacast: true,
|
|
107
|
-
e2ee: e2eeEnabled
|
|
108
|
-
? {
|
|
109
|
-
keyProvider,
|
|
110
|
-
worker
|
|
111
|
-
}
|
|
112
|
-
: undefined
|
|
113
|
-
};
|
|
114
|
-
}, [liveStreamRoomMaxParticipants, userChoices, options.hq, options.codec]); */
|
|
115
|
-
// Create room - only initial
|
|
116
|
-
/* const room = useMemo(() => {
|
|
117
|
-
const room = new Room();
|
|
118
|
-
return new Room(roomOptions);
|
|
119
|
-
}, [liveStreamRoomMaxParticipants]); */
|
|
66
|
+
// PERMISSIONS
|
|
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]);
|
|
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]);
|
|
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]);
|
|
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]);
|
|
71
|
+
const speakerFocused = (0, react_1.useMemo)(() => (scUserContext.user && liveStream && liveStream.settings.view === types_1.SCLiveStreamViewType.SPEAKER ? liveStream.host : null), [scUserContext, liveStream]);
|
|
72
|
+
console.log(canUseChat);
|
|
73
|
+
console.log(speakerFocused);
|
|
74
|
+
// CONNECT OPTIONS
|
|
120
75
|
const connectOptions = (0, react_1.useMemo)(() => {
|
|
121
76
|
return {
|
|
122
77
|
autoSubscribe: true
|
|
123
78
|
};
|
|
124
79
|
}, []);
|
|
125
|
-
/* useEffect(() => {
|
|
126
|
-
if (room) {
|
|
127
|
-
if (e2eeEnabled) {
|
|
128
|
-
keyProvider
|
|
129
|
-
.setKey(decodePassphrase(e2eePassphrase))
|
|
130
|
-
.then(() => {
|
|
131
|
-
room.setE2EEEnabled(true).catch((e) => {
|
|
132
|
-
if (e instanceof DeviceUnsupportedError) {
|
|
133
|
-
alert(
|
|
134
|
-
`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.`
|
|
135
|
-
);
|
|
136
|
-
console.error(e);
|
|
137
|
-
} else {
|
|
138
|
-
throw e;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
})
|
|
142
|
-
.then(() => {
|
|
143
|
-
setE2eeSetupComplete(true);
|
|
144
|
-
setLiveActive(true);
|
|
145
|
-
});
|
|
146
|
-
} else {
|
|
147
|
-
setE2eeSetupComplete(true);
|
|
148
|
-
setLiveActive(true);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, [e2eeEnabled, room, e2eePassphrase]); */
|
|
152
80
|
// HANDLERS
|
|
153
81
|
/**
|
|
154
82
|
* Handle on leave
|
|
@@ -182,6 +110,6 @@ function LiveStreamVideoConference(inProps) {
|
|
|
182
110
|
/**
|
|
183
111
|
* Renders root object
|
|
184
112
|
*/
|
|
185
|
-
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, {})) })) })));
|
|
186
114
|
}
|
|
187
115
|
exports.default = LiveStreamVideoConference;
|
|
@@ -18,6 +18,7 @@ export interface ParticipantTileProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
18
18
|
/** The track reference to display. */
|
|
19
19
|
trackRef?: TrackReferenceOrPlaceholder;
|
|
20
20
|
disableSpeakingIndicator?: boolean;
|
|
21
|
+
disableTileActions?: boolean;
|
|
21
22
|
onParticipantClick?: (event: ParticipantClickEvent) => void;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
@@ -34,7 +34,7 @@ exports.TrackRefContextIfNeeded = TrackRefContextIfNeeded;
|
|
|
34
34
|
exports.ParticipantTile =
|
|
35
35
|
/* @__PURE__ */ React.forwardRef(function ParticipantTile(_a, ref) {
|
|
36
36
|
var _b, _c;
|
|
37
|
-
var { trackRef, children, onParticipantClick, disableSpeakingIndicator } = _a, htmlProps = tslib_1.__rest(_a, ["trackRef", "children", "onParticipantClick", "disableSpeakingIndicator"]);
|
|
37
|
+
var { trackRef, children, onParticipantClick, disableSpeakingIndicator, disableTileActions = false } = _a, htmlProps = tslib_1.__rest(_a, ["trackRef", "children", "onParticipantClick", "disableSpeakingIndicator", "disableTileActions"]);
|
|
38
38
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
39
39
|
const trackReference = (0, components_react_1.useEnsureTrackRef)(trackRef);
|
|
40
40
|
const { elementProps } = (0, components_react_1.useParticipantTile)({
|
|
@@ -61,5 +61,5 @@ exports.ParticipantTile =
|
|
|
61
61
|
trackReference.source === livekit_client_1.Track.Source.ScreenShare) ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.VideoTrack, { trackRef: trackReference, onSubscriptionStatusChanged: handleSubscribe, manageSubscription: autoManageSubscription }) })) : ((0, components_core_1.isTrackReference)(trackReference) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(components_react_1.AudioTrack, { trackRef: trackReference, onSubscriptionStatusChanged: handleSubscribe }) }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-participant-placeholder" }, { children: (0, jsx_runtime_1.jsx)(ParticipantTileAvatar_1.default, { participant: trackReference.participant }) })), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-participant-metadata" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-participant-metadata-item" }, { children: trackReference.source === livekit_client_1.Track.Source.Camera ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEncrypted && (0, jsx_runtime_1.jsx)(components_react_1.LockLockedIcon, { style: { marginRight: '0.25rem' } }), (0, jsx_runtime_1.jsx)(components_react_1.TrackMutedIndicator, { trackRef: {
|
|
62
62
|
participant: trackReference.participant,
|
|
63
63
|
source: livekit_client_1.Track.Source.Microphone
|
|
64
|
-
}, show: 'muted' }), (0, jsx_runtime_1.jsx)(components_react_1.ParticipantName, { children: (0, jsx_runtime_1.jsx)(ParticipantTileActions_1.default, {}) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_react_1.ScreenShareIcon, { style: { marginRight: '0.25rem' } }), (0, jsx_runtime_1.jsx)(components_react_1.ParticipantName, { children: "'s screen" })] })) })), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionQualityIndicator, { className: "lk-participant-metadata-item" })] }))] })), (0, jsx_runtime_1.jsx)(components_react_1.FocusToggle, { trackRef: trackReference })] })) })) })));
|
|
64
|
+
}, show: 'muted' }), (0, jsx_runtime_1.jsx)(components_react_1.ParticipantName, { children: !disableTileActions && (0, jsx_runtime_1.jsx)(ParticipantTileActions_1.default, {}) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_react_1.ScreenShareIcon, { style: { marginRight: '0.25rem' } }), (0, jsx_runtime_1.jsx)(components_react_1.ParticipantName, { children: "'s screen" })] })) })), (0, jsx_runtime_1.jsx)(components_react_1.ConnectionQualityIndicator, { className: "lk-participant-metadata-item" })] }))] })), (0, jsx_runtime_1.jsx)(components_react_1.FocusToggle, { trackRef: trackReference })] })) })) })));
|
|
65
65
|
});
|