Skip to content

Commit 25a3e35

Browse files
feat: removed dark screen when video ends streaming
1 parent 871e856 commit 25a3e35

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ const publishVideo = async (
189189
height: any,
190190
certifiCateKey: string
191191
) => {
192-
console.log(appId, certifiCateKey, channel);
193192
let token = null;
194193
if (certifiCateKey) {
195194
token = await generateToken(appId, certifiCateKey, channel);
@@ -562,7 +561,7 @@ MTComp = withMethodExposing(MTComp, [
562561
},
563562
execute: async (comp, values) => {
564563
let value = !comp.children.audioControl.getView().value;
565-
let localUserData = comp.children.localUser.change({
564+
comp.children.localUser.change({
566565
user: userId + "",
567566
audiostatus: value,
568567
});
@@ -598,8 +597,8 @@ MTComp = withMethodExposing(MTComp, [
598597
user: userId + "",
599598
audiostatus: false,
600599
speaking: false,
600+
streamingVideo: true,
601601
});
602-
console.log(userId);
603602

604603
await publishVideo(
605604
comp.children.appId.getView(),
@@ -671,7 +670,13 @@ MTComp = withMethodExposing(MTComp, [
671670
execute: async (comp, values) => {
672671
let value = !comp.children.endCall.getView().value;
673672
comp.children.endCall.change(value);
673+
674674
await leaveChannel();
675+
676+
comp.children.localUser.change({
677+
user: userId + "",
678+
streamingVideo: false,
679+
});
675680
},
676681
},
677682
{

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import { RefControl } from "comps/controls/refControl";
2828
import { useEffect, useRef, useState } from "react";
2929

3030
import { AutoHeightControl } from "comps/controls/autoHeightControl";
31-
import { client } from "./videoMeetingControllerComp";
31+
import {
32+
VideoMeetingControllerComp,
33+
client,
34+
} from "./videoMeetingControllerComp";
3235

3336
import { IAgoraRTCRemoteUser } from "agora-rtc-sdk-ng";
3437

@@ -184,6 +187,14 @@ let VideoCompBuilder = (function (props) {
184187
useEffect(() => {
185188
if (props.userId.value !== "") {
186189
let userData = JSON.parse(props.userId?.value);
190+
if (
191+
userData.user == userId &&
192+
userData.streamingVideo == false &&
193+
videoRef.current &&
194+
videoRef.current?.id == userId + ""
195+
) {
196+
videoRef.current.srcObject = null;
197+
}
187198
client.on(
188199
"user-published",
189200
async (user: IAgoraRTCRemoteUser, mediaType: "video" | "audio") => {
@@ -231,6 +242,10 @@ let VideoCompBuilder = (function (props) {
231242
}
232243
}
233244
if (mediaType === "video") {
245+
console.log("user-unpublished video");
246+
if (videoRef.current && videoRef.current?.id == user.uid + "") {
247+
videoRef.current.srcObject = null;
248+
}
234249
if (
235250
!user.hasVideo &&
236251
user.uid + "" != userData.user &&
@@ -241,10 +256,17 @@ let VideoCompBuilder = (function (props) {
241256
}
242257
}
243258
);
259+
244260
setUserId(userData.user);
245261
}
246262
}, [props.userId.value]);
247263

264+
// useEffect(() => {
265+
// if (videoRef.current && videoRef.current?.id == userId + "") {
266+
// videoRef.current.srcObject = null;
267+
// }
268+
// }, []);
269+
248270
return (
249271
<EditorContext.Consumer>
250272
{(editorState) => (

0 commit comments

Comments
 (0)