Skip to content

Commit 5366cd4

Browse files
author
FalkWolsky
committed
Fix Editable Aspect Ratio
1 parent 7d4efa5 commit 5366cd4

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

client/packages/lowcoder/src/comps/comps/meetingComp/videoMeetingStreamComp.tsx

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { BoolCodeControl } from "comps/controls/codeControl";
22
import { dropdownControl } from "comps/controls/dropdownControl";
3-
import { IconControl } from "comps/controls/iconControl";
3+
// import { IconControl } from "comps/controls/iconControl";
44
import { CompNameContext, EditorContext, EditorState } from "comps/editorState";
55
import { withDefault } from "comps/generators";
66
import { UICompBuilder } from "comps/generators/uiCompBuilder";
77
import ReactResizeDetector from "react-resize-detector";
8-
import _ from "lodash";
8+
// import _ from "lodash";
99
import {
1010
CommonBlueLabel,
1111
controlItem,
@@ -61,7 +61,7 @@ const VideoContainer = styled.video`
6161
width: 100%;
6262
display: flex;
6363
align-items: center;
64-
justify-content: center;
64+
justify-content: space-around;
6565
`;
6666

6767
function getForm(editorState: EditorState, formName: string) {
@@ -140,13 +140,14 @@ export const meetingStreamChildren = {
140140
shareScreen: withDefault(BoolShareVideoControl, false),
141141
profilePadding: withDefault(StringControl, "0px"),
142142
profileBorderRadius: withDefault(StringControl, "0px"),
143+
videoAspectRatio: withDefault(StringControl, "1 / 1"),
143144
type: dropdownControl(typeOptions, ""),
144145
onEvent: MeetingEventHandlerControl,
145146
disabled: BoolCodeControl,
146147
loading: BoolCodeControl,
147148
form: SelectFormControl,
148-
prefixIcon: IconControl,
149-
suffixIcon: IconControl,
149+
// prefixIcon: IconControl,
150+
// suffixIcon: IconControl,
150151
style: ButtonStyleControl,
151152
viewRef: RefControl<HTMLElement>,
152153
userId: stringExposingStateControl(""),
@@ -169,12 +170,12 @@ let VideoCompBuilder = (function (props) {
169170
if (props.userId.value !== "") {
170171
let userData = JSON.parse(props.userId?.value);
171172
if (
172-
userData.user == userId &&
173-
userData.streamingVideo == false &&
173+
userData.user === userId &&
174+
userData.streamingVideo === false &&
174175
videoRef.current &&
175-
videoRef.current?.id == userId + ""
176+
videoRef.current?.id === userId + ""
176177
) {
177-
if (videoRef.current && videoRef.current?.id == userId + "") {
178+
if (videoRef.current && videoRef.current?.id === userId + "") {
178179
videoRef.current.srcObject = null;
179180
setVideo(false);
180181
}
@@ -189,8 +190,8 @@ let VideoCompBuilder = (function (props) {
189190
let userId = user.uid + "";
190191
if (
191192
user.hasVideo &&
192-
user.uid + "" != userData.user &&
193-
userData.user != ""
193+
user.uid + "" !== userData.user &&
194+
userData.user !== ""
194195
) {
195196
props.onEvent("videoOn");
196197
}
@@ -204,8 +205,8 @@ let VideoCompBuilder = (function (props) {
204205
const remoteTrack = await client.subscribe(user, mediaType);
205206
if (
206207
user.hasAudio &&
207-
user.uid + "" != userData.user &&
208-
userData.user != ""
208+
user.uid + "" !== userData.user &&
209+
userData.user !== ""
209210
) {
210211
userData.audiostatus = user.hasVideo;
211212

@@ -221,21 +222,21 @@ let VideoCompBuilder = (function (props) {
221222
if (mediaType === "audio") {
222223
if (
223224
!user.hasAudio &&
224-
user.uid + "" != userData.user &&
225-
userData.user != ""
225+
user.uid + "" !== userData.user &&
226+
userData.user !== ""
226227
) {
227228
userData.audiostatus = user.hasVideo;
228229
props.onEvent("audioMuted");
229230
}
230231
}
231232
if (mediaType === "video") {
232-
if (videoRef.current && videoRef.current?.id == user.uid + "") {
233+
if (videoRef.current && videoRef.current?.id === user.uid + "") {
233234
videoRef.current.srcObject = null;
234235
}
235236
if (
236237
!user.hasVideo &&
237-
user.uid + "" != userData.user &&
238-
userData.user != ""
238+
user.uid + "" !== userData.user &&
239+
userData.user !== ""
239240
) {
240241
props.onEvent("videoOff");
241242
}
@@ -245,7 +246,7 @@ let VideoCompBuilder = (function (props) {
245246

246247
setUserId(userData.user);
247248
setUsername(userData.userName);
248-
console.log(userData);
249+
// console.log(userData);
249250
}
250251
}, [props.userId.value]);
251252

@@ -261,7 +262,7 @@ let VideoCompBuilder = (function (props) {
261262
height: "100%",
262263
overflow: "hidden",
263264
borderRadius: props.style.radius,
264-
aspectRatio: "1 / 1",
265+
aspectRatio: props.videoAspectRatio,
265266
backgroundColor: props.style.background,
266267
padding: props.style.padding,
267268
margin: props.style.margin,
@@ -274,7 +275,7 @@ let VideoCompBuilder = (function (props) {
274275
ref={videoRef}
275276
style={{
276277
display: `${showVideo ? "flex" : "none"}`,
277-
aspectRatio: "1 / 1",
278+
aspectRatio: props.videoAspectRatio,
278279
borderRadius: props.style.radius,
279280
width: "auto",
280281
}}
@@ -290,7 +291,7 @@ let VideoCompBuilder = (function (props) {
290291
padding: props.profilePadding,
291292
}}
292293
>
293-
<img
294+
<img alt=""
294295
style={{
295296
borderRadius: props.profileBorderRadius,
296297
width: "100%",
@@ -311,7 +312,7 @@ let VideoCompBuilder = (function (props) {
311312
padding: props.profilePadding,
312313
}}
313314
>
314-
<img
315+
<img alt=""
315316
style={{
316317
borderRadius: props.profileBorderRadius,
317318
width: "100%",
@@ -336,6 +337,10 @@ let VideoCompBuilder = (function (props) {
336337
{children.shareScreen.propertyView({
337338
label: trans("meeting.shareScreen"),
338339
})}
340+
{children.profileImageUrl.propertyView({
341+
label: trans("meeting.profileImageUrl"),
342+
placeholder: "https://via.placeholder.com/120",
343+
})}
339344
</Section>
340345

341346
<Section name={sectionNames.interaction}>
@@ -345,15 +350,14 @@ let VideoCompBuilder = (function (props) {
345350
{hiddenPropertyView(children)}
346351
</Section>
347352
<Section name={sectionNames.style}>
348-
{children.profileImageUrl.propertyView({
349-
label: trans("meeting.profileImageUrl"),
350-
placeholder: "https://via.placeholder.com/120",
351-
})}
352353
{children.profilePadding.propertyView({
353-
label: "Profile Padding",
354+
label: "Profile Image Padding",
354355
})}
355356
{children.profileBorderRadius.propertyView({
356-
label: "Profile Border Radius",
357+
label: "Profile Image Border Radius",
358+
})}
359+
{children.videoAspectRatio.propertyView({
360+
label: "Video Aspect Ratio",
357361
})}
358362
{children.style.getPropertyView()}
359363
</Section>

0 commit comments

Comments
 (0)