Cast logs v2 (#1569)

## Description

## Tests
This commit is contained in:
Neeraj Gupta 2024-04-30 18:21:23 +05:30 committed by GitHub
commit f7a62c91e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View file

@ -11,14 +11,16 @@ export const PhotoAuditorium: React.FC<PhotoAuditoriumProps> = ({
showNextSlide,
}) => {
useEffect(() => {
console.log("showing slide");
const timeoutId = window.setTimeout(() => {
console.log("showing next slide timer");
showNextSlide();
}, 10000);
return () => {
if (timeoutId) clearTimeout(timeoutId);
};
}, [showNextSlide]);
}, []);
return (
<div

View file

@ -174,12 +174,18 @@ export default function PairingMode() {
const router = useRouter();
useEffect(() => {
console.log("useEffect for pairing called");
if (digits.length < 1 || !publicKeyB64 || !privateKeyB64) return;
const interval = setInterval(async () => {
console.log("polling for cast data");
const data = await pollForCastData();
if (!data) return;
if (!data) {
console.log("no data");
return;
}
storeCastData(data);
console.log("pushing slideshow");
await router.push("/slideshow");
}, 1000);

View file

@ -131,29 +131,41 @@ export default function Slideshow() {
if (!nextURL) {
try {
console.log("nextURL doesn't exist yet");
const blob = await getPreviewableImage(nextFile, castToken);
console.log("nextURL blobread");
const url = URL.createObjectURL(blob);
console.log("nextURL", url);
renderableFileURLCache.set(nextFile.id, url);
console.log("nextUrlCache set");
nextURL = url;
} catch (e) {
console.log("error in nextUrl", e);
return;
}
} else {
console.log("nextURL already exists");
}
if (!nextNextURL) {
try {
console.log("nextNextURL doesn't exist yet");
const blob = await getPreviewableImage(
nextNextFile,
castToken,
);
console.log("nextNextURL blobread");
const url = URL.createObjectURL(blob);
console.log("nextNextURL", url);
renderableFileURLCache.set(nextNextFile.id, url);
console.log("nextNextURCacheL set");
nextNextURL = url;
} catch (e) {
console.log("error in nextNextURL", e);
return;
}
} else {
console.log("nextNextURL already exists");
}
setLoading(false);