[cast] Change slideshow time from 5s => 10s

This commit is contained in:
Manav Rathi 2024-03-29 12:34:54 +05:30
parent 949780d1e8
commit 70e5e9b13c
No known key found for this signature in database
2 changed files with 18 additions and 14 deletions

View file

@ -20,9 +20,9 @@ export default function PhotoAuditorium({
if (nextSlidePrerendered) {
const elapsedTime = prerenderTime ? Date.now() - prerenderTime : 0;
const delayTime = Math.max(5000 - elapsedTime, 0);
const delayTime = Math.max(10000 - elapsedTime, 0);
if (elapsedTime >= 5000) {
if (elapsedTime >= 10000) {
setShowPreloadedNextSlide(true);
} else {
timeout = setTimeout(() => {

View file

@ -59,21 +59,12 @@ export default function Slideshow() {
}
};
const init = async () => {
try {
const castToken = window.localStorage.getItem("castToken");
setCastToken(castToken);
} catch (e) {
logError(e, "error during sync");
router.push("/");
}
};
useEffect(() => {
if (castToken) {
const intervalId = setInterval(() => {
syncCastFiles(castToken);
}, 5000);
}, 10000);
syncCastFiles(castToken);
return () => clearInterval(intervalId);
}
@ -105,7 +96,20 @@ export default function Slideshow() {
const router = useRouter();
useEffect(() => {
init();
try {
const castToken = window.localStorage.getItem("castToken");
// Wait 2 seconds to ensure the green tick and the confirmation
// message remains visible for at least 2 seconds before we start
// the slideshow.
const timeoutId = setTimeout(() => {
setCastToken(castToken);
}, 2000);
return () => clearTimeout(timeoutId);
} catch (e) {
logError(e, "error during sync");
router.push("/");
}
}, []);
useEffect(() => {