Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

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

Manav Rathi70e5e9b13cf5
diff --git a/web/apps/cast/src/components/Theatre/PhotoAuditorium.tsx b/web/apps/cast/src/components/Theatre/PhotoAuditorium.tsx
index dc5a18f0b9..0042dfe953 100644
--- a/web/apps/cast/src/components/Theatre/PhotoAuditorium.tsx
+++ b/web/apps/cast/src/components/Theatre/PhotoAuditorium.tsx
@@ -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(() => {
diff --git a/web/apps/cast/src/pages/slideshow.tsx b/web/apps/cast/src/pages/slideshow.tsx
index a49d497de0..3251b26aba 100644
--- a/web/apps/cast/src/pages/slideshow.tsx
+++ b/web/apps/cast/src/pages/slideshow.tsx
@@ -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(() => {