export function VideoCallScreen() {
const [signatureData, setSignatureData] = useState(null);
const [myselfUserId, setMyselfUserId] = useState(null);
const [remoteUsers, setRemoteUsers] = useState();
const [isFullScreen, setIsFullScreen] = useState(false);
const [route, setRoute] = useRecoilState(ROLETYPE);
const [zoomCredentials, setZoomCredentials] = useRecoilState(ZOOMCREDENTIALS);
const isFirstRender = useRef(true);
const uid = useRecoilValue(UIDSTORING);
const [zoomSecretKeyCredentials, setZoomSecretKeyCredentials] =
useRecoilState(videoCredential);
const navigation = useNavigation();
const [name, setName] = useState(“”);
const zoom = useZoom();
const { socket } = useSocket();
const toggleFullScreen = () => {
// setIsFullScreen(!isFullScreen);
};
useEffect(() => {
socket?.on(“callEnded”, (data) => {
console.log(“call ended
”);
leaveSession();
navigation.navigate(“Checking”);
});
return () => {
socket?.off(“participantLeft”);
};
}, [socket]);
const sendLogToPhone = (data) => {
const uniqId = uid?.data?.robot?.uuid;
const acknowledgementData = { id: uniqId, mobileLog: data };
socket?.emit("sentToPhone", acknowledgementData);
};
useEffect(() => {
const fetchSignature = async (zoomCredentialsData) => {
console.log(
zoomCredentialsData,
zoomCredentialsData.payload.data.zoomUserData,
“
”,
zoomCredentialsData.payload.data.zoomCredentials,
“![:computer: :computer:](https://emoji.discourse-cdn.com/twitter/computer.png?v=12)
zoomCredentialsData”
);
try {
sendLogToPhone({
majorCondition: isFirstRender.current,
zoomSecretKeyCredentials,
highRisk: “before jestinxavier.click/generateSignature”,
});
if (isFirstRender.current) {
// sendLogToPhone({sdkKey:zoomSecretKeyCredentials.zoom_account_id,sdkSecret:zoomSecretKeyCredentials.zoom_secret_key,zoomCredentials,},“![:desktop_computer: :desktop_computer:](https://emoji.discourse-cdn.com/twitter/desktop_computer.png?v=12)
![:desktop_computer: :desktop_computer:](https://emoji.discourse-cdn.com/twitter/desktop_computer.png?v=12)
”);
const response = await axios.post(
// 'https://tebo.devlacus.com/generateSignature',
// "https://jestinxavier.click/generateSignature",
"http://192.168.1.42:5000/generateSignature",
{
sdkKey:
zoomCredentialsData.payload.data.zoomCredentials
.zoom_account_id,
sdkSecret:
zoomCredentialsData.payload.data.zoomCredentials
.zoom_secret_key,
sessionName:
zoomCredentialsData.payload.data.zoomUserData.sessionName,
role: route.roleType,
sessionKey:
zoomCredentialsData.payload.data.zoomUserData.sessionKey,
userIdentity: route.displayName,
},
{ timeout: 9000 }
);
socket?.emit("sentToPhone", response);
const { signature } = response.data;
console.log({ signature });
sendLogToPhone({
majorCondition: isFirstRender.current,
signature: signature,
highRisk: "after jestinxavier.click/generateSignature",
});
// console.log("☠️☠️☠️☠️☠️☠️☠️☠️☠️☠️☠️☠️☠️");
setSignatureData(signature);
}
// setSignatureData(signature);
} catch (error) {
sendLogToPhone({
fetchSignature: error,
type: "ERROR in fetchSignature",
});
if (error.response) {
socket?.emit("sentToPhone", { 111: error.response });
} else if (error.request) {
socket?.emit("sentToPhone", { 117: error.request });
// console.error("Error request:", error.request);
} else {
// Something happened in setting up the request that triggered an Error
socket?.emit("sentToPhone", { 128: error.message });
console.error("Error message:", error.message);
}
}
};
console.log({ zoomSecretKeyCredentials, zoomCredentials });
if (zoomCredentials) {
console.log(zoomCredentials.payload.data.zoomUserData.name, "1");
setName(zoomCredentials.payload.data.zoomUserData.name);
sendLogToPhone({
zoomCredentials,
zoomCredentialsInside: "inside the zoom credintial ",
});
fetchSignature(zoomCredentials);
}
sendLogToPhone({
zoomCredentials,
zoomCredentialsOutSide: "outside the zoom credintial ",
});
// socket?.emit("callEnded", (data) => {
// console.log("call ended 😊");
// leaveSession();
// });
}, [zoomCredentials, socket, zoomSecretKeyCredentials]);
useEffect(() => {
async function joinSession() {
console.log(signatureData, “signatureData”);
if (signatureData) {
try {
console.log(
zoomCredentials.payload.data.zoomUserData.sessionName,
“
2”
);
let dataTop = await zoom.joinSession({
sessionName: zoomCredentials.payload.data.zoomUserData.sessionName,
sessionIdleTimeoutMins: 30,
sessionPassword:
zoomCredentials.payload.data.zoomUserData.userIdentity,
token: signatureData,
userName: route.displayName,
audioOptions: { connect: true, mute: false },
videoOptions: { localVideoOn: true },
});
isFirstRender.current = false;
console.log({ dataTop });
sendLogToPhone({
zoomJoinSession: dataTop,
message: "zoomJoining session with signature -3",
});
const mySelf = await zoom.session.getMySelf();
// setUsers([mySelf]);
const cameraList = await zoom.videoHelper.getCameraList();
sendLogToPhone({
cameraList: cameraList,
message: "cameraList -4",
});
} catch (error) {
console.error("Error joining session:", error);
sendLogToPhone({ error, message: "join section try catch error" });
}
}
}
if (signatureData && isFirstRender.current) {
joinSession();
// Set isFirstRender to false after the initial render
}
const sessionJoinListener = zoom.addListener("onSessionJoin", async () => {
sendLogToPhone({ message: "onSessionJoin event is triggered 5" });
await zoom.audioHelper.startAudio();
// Retrieve mySelf within the listener
const mySelf = await zoom.session.getMySelf();
await zoom.audioHelper.unmuteAudio(mySelf.userId);
setMyselfUserId(mySelf.userId);
const remoteUsers = await zoom.session.getRemoteUsers();
console.log({ remoteUsers });
sendLogToPhone({ remoteUsers, getRemoteUsers: “getRemoteUsers” });
// setUsers((prevUsers) => […prevUsers, …remoteUsers]);
setRemoteUsers(remoteUsers);
});
const sessionLeaveListener = zoom.addListener("onSessionLeave", () => {
// setUsers([]);
setRemoteUsers([]);
leaveSession();
});
return () => {
sessionJoinListener.remove();
sessionLeaveListener.remove();
};
}, [zoom, signatureData]);
const leaveSession = () => {
zoom.leaveSession(false);
navigation.navigate(“Checking”);
};
return (
<ScrollView contentContainerStyle={{ flex: 1, alignItems: “center” }}>
{remoteUsers.length ? (
<RenderUsers
sendLogToPhone={sendLogToPhone}
users={remoteUsers}
// remoteUser={remoteUsers}
ApplicationLog={ApplicationLog}
// name={name}
isFullScreen={isFullScreen}
toggleFullScreen={toggleFullScreen}
/>
) : (
)}
);
}
export default VideoCallScreen;
From the above code, I obtained the cameraList with -4 logs, but the onSessionJoin event is not showing “onSessionJoin event is triggered 5” , not showing during the initiation of a call from the web to the app. It worked fine for the last three months, but now it’s not working. Is there any payment issue or anything like that? I don’t understand how to solve the issue. @chunsiong.zoom and @elaine.ku i need your support.