Skip to content

Commit 691c42f

Browse files
feat: added no text when there is no user
1 parent d113fc2 commit 691c42f

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ let MTComp = (function () {
474474
{children.meetingName.propertyView({
475475
label: trans("meeting.meetingName"),
476476
})}
477+
477478
{children.placement.propertyView({
478479
label: trans("drawer.placement"),
479480
radioButton: true,

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

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ const Container = styled.div<{ $style: any }>`
6262
align-items: center;
6363
justify-content: center;
6464
`;
65+
const TextContainer = styled.div<{ $style: any }>`
66+
height: 100%;
67+
width: 100%;
68+
display: flex;
69+
align-items: center;
70+
position: absolute;
71+
justify-content: center;
72+
${(props) => props.$style && getStyle(props.$style)}
73+
`;
6574
const VideoContainer = styled.video<{ $style: any }>`
6675
height: 100%;
6776
width: 100%;
@@ -166,13 +175,16 @@ export const meetingStreamChildren = {
166175
style: ButtonStyleControl,
167176
viewRef: RefControl<HTMLElement>,
168177
userId: stringExposingStateControl(""),
178+
noVideoText: stringExposingStateControl("No Video"),
169179
};
170180

171181
let VideoCompBuilder = (function (props) {
172182
return new UICompBuilder(meetingStreamChildren, (props) => {
173183
const videoRef = useRef<HTMLVideoElement>(null);
174184
const conRef = useRef<HTMLDivElement>(null);
185+
const userNameRef = useRef<HTMLDivElement>(null);
175186
const [userId, setUserId] = useState();
187+
const [userName, setUsername] = useState("");
176188

177189
useEffect(() => {
178190
onResize();
@@ -181,21 +193,31 @@ let VideoCompBuilder = (function (props) {
181193
const onResize = async () => {
182194
const container = conRef.current;
183195
let videoCo = videoRef.current;
184-
videoCo!.style.height = container?.clientHeight + "px";
185-
videoCo!.style.width = container?.clientWidth + "px";
196+
if (videoCo) {
197+
videoCo!.style.height = container?.clientHeight + "px";
198+
videoCo!.style.width = container?.clientWidth + "px";
199+
}
186200
};
187201
useEffect(() => {
188202
if (props.userId.value !== "") {
189203
let userData = JSON.parse(props.userId?.value);
190-
if (userData.user == userId && userData.streamingVideo == false && videoRef.current && videoRef.current?.id == userId + "") {
204+
if (
205+
userData.user == userId &&
206+
userData.streamingVideo == false &&
207+
videoRef.current &&
208+
videoRef.current?.id == userId + ""
209+
) {
191210
if (videoRef.current && videoRef.current?.id == userId + "") {
192211
videoRef.current.srcObject = null;
212+
if (userNameRef.current) {
213+
userNameRef.current.textContent = userData.user;
214+
}
193215
}
194216
}
195217
client.on(
196218
"user-published",
197219
async (user: IAgoraRTCRemoteUser, mediaType: "video" | "audio") => {
198-
if (mediaType === "video") {
220+
if (mediaType === "video") {
199221
const remoteTrack = await client.subscribe(user, mediaType);
200222
let userId = user.uid + "";
201223
if (
@@ -254,26 +276,29 @@ let VideoCompBuilder = (function (props) {
254276
);
255277

256278
setUserId(userData.user);
279+
setUsername(userData.user);
257280
}
258281
}, [props.userId.value]);
259282

260-
// useEffect(() => {
261-
// if (videoRef.current && videoRef.current?.id == userId + "") {
262-
// videoRef.current.srcObject = null;
263-
// }
264-
// }, []);
265-
266283
return (
267284
<EditorContext.Consumer>
268285
{(editorState) => (
269286
<ReactResizeDetector onResize={onResize}>
270287
<Container ref={conRef} $style={props.style}>
271-
<VideoContainer
272-
onClick={() => props.onEvent("videoClicked")}
273-
ref={videoRef}
274-
$style={props.style}
275-
id={props.shareScreen ? "share-screen" : userId}
276-
></VideoContainer>
288+
{props.shareScreen || userId ? (
289+
<div style={{ position: "relative" }}>
290+
<VideoContainer
291+
onClick={() => props.onEvent("videoClicked")}
292+
ref={videoRef}
293+
$style={props.style}
294+
id={props.shareScreen ? "share-screen" : userId}
295+
></VideoContainer>
296+
</div>
297+
) : (
298+
<TextContainer $style={props.style}>
299+
<p>No Video</p>
300+
</TextContainer>
301+
)}
277302
</Container>
278303
</ReactResizeDetector>
279304
)}

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,7 @@ export const en = {
14511451
shareScreen: "Share Screen",
14521452
appid: "Application Id",
14531453
meetingName: "Meeting Name",
1454+
videoCompText: "No video Text",
14541455
right: "Right",
14551456
bottom: "Bottom",
14561457
videoId: "Video Id",

0 commit comments

Comments
 (0)