Meneman commited on
Commit
e0c159c
·
verified ·
1 Parent(s): c6f4113

Please do not turn off the time settings; just change the video automatically according to the time as written in the code by time - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +29 -60
index.html CHANGED
@@ -36,7 +36,9 @@
36
  box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.6);
37
  }
38
 
39
- #schedule-times > div.bg-yellow-500 {
 
 
40
  transition: all 0.3s ease;
41
  }
42
 
@@ -108,17 +110,17 @@
108
  <h3 class="text-xl font-bold mb-4 text-yellow-300 tracking-wider">✨ Today's Schedule ✨</h3>
109
  <div id="schedule-times" class="text-sm space-y-3">
110
  <div class="flex items-start">
111
- <div class="w-24 font-mono text-yellow-400 transition-colors duration-300">21:00 – 23:35</div>
112
  <div class="flex-1">
113
- <div class="font-medium transition-colors duration-300">Dance in Front of the Library of Alexandria</div>
114
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 02:35</div>
115
  </div>
116
  </div>
117
  <div class="h-px bg-gradient-to-r from-transparent via-yellow-500/30 to-transparent"></div>
118
  <div class="flex items-start">
119
- <div class="w-24 font-mono text-yellow-400 transition-colors duration-300">23:35 – 01:28</div>
120
  <div class="flex-1">
121
- <div class="font-medium transition-colors duration-300">✨ Belly Dance ✨ - Sensual Dance</div>
122
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 01:53</div>
123
  </div>
124
  </div>
@@ -132,9 +134,9 @@
132
  </div>
133
  <div class="h-px bg-gradient-to-r from-transparent via-yellow-500/30 to-transparent"></div>
134
  <div class="flex items-start">
135
- <div class="w-24 font-mono text-yellow-400 transition-colors duration-300">06:09 – 21:00</div>
136
  <div class="flex-1">
137
- <div class="font-medium transition-colors duration-300">Feast of Hathor</div>
138
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 03:28</div>
139
  </div>
140
  </div>
@@ -220,13 +222,9 @@
220
  const scheduleItems = document.querySelectorAll('#schedule-times > div');
221
  scheduleItems.forEach((item, i) => {
222
  if (i === index * 2) { // Each video is every second div (0, 2, 4...)
223
- item.classList.add('bg-yellow-500', 'bg-opacity-10', 'rounded-lg', 'py-2', 'px-3');
224
- item.querySelector('.w-24').classList.add('text-yellow-200', 'font-bold');
225
- item.querySelector('.font-medium').classList.add('text-yellow-200');
226
  } else {
227
- item.classList.remove('bg-yellow-500', 'bg-opacity-10', 'rounded-lg', 'py-2', 'px-3');
228
- item.querySelector('.w-24').classList.remove('text-yellow-200', 'font-bold');
229
- item.querySelector('.font-medium').classList.remove('text-yellow-200');
230
  }
231
  });
232
  }
@@ -271,64 +269,35 @@
271
  // Highlight current schedule item
272
  highlightCurrentScheduleItem(videoIndex);
273
 
274
- // Add fade transition
275
- videoElement.style.opacity = '0';
276
- videoElement.style.transition = 'opacity 0.5s ease';
277
-
278
- // Set video source and metadata
279
- videoElement.src = video.url;
280
-
281
- // When video is ready to play
282
- videoElement.oncanplay = function() {
283
- // Play video from calculated position
284
- videoElement.currentTime = videoCurrentPosition;
285
- videoElement.loop = true;
286
- videoElement.play().catch(e => {
287
- console.log('Auto-play prevented:', e);
288
- // Fallback: mute and try again
289
- videoElement.muted = true;
290
- videoElement.play();
291
- }).then(() => {
292
- // Fade in the video
293
- videoElement.style.opacity = '1';
294
- });
295
-
296
- // Clear any previous timeout
297
- if (window.nextVideoTimeout) {
298
- clearTimeout(window.nextVideoTimeout);
299
- }
300
-
301
- // Calculate time until next video should start
302
- const timeUntilNextVideo = (video.endHour - currentHour) * 3600 * 1000;
303
- window.nextVideoTimeout = setTimeout(playScheduledVideo, timeUntilNextVideo);
304
- };
305
 
306
- // Handle potential loading errors
307
- videoElement.onerror = function() {
308
- console.error('Error loading video:', video.url);
309
- // Try again after 5 seconds
310
- setTimeout(playScheduledVideo, 5000);
311
- };
 
312
  }
313
 
314
- // Handle video end and potential interruptions
315
  videoElement.addEventListener('ended', function() {
316
  const now = new Date();
317
  const currentHour = now.getUTCHours() + now.getUTCMinutes() / 60;
318
  const currentVideo = videos[currentVideoIndex];
319
 
320
- const now = new Date();
321
- const currentHour = now.getUTCHours() + now.getUTCMinutes() / 60;
322
- const currentVideo = videos[currentVideoIndex];
323
-
324
  // If still within current video's time slot, restart it
325
  if (currentHour >= currentVideo.startHour && currentHour < currentVideo.endHour) {
326
  videoElement.currentTime = 0;
327
- videoElement.play().catch(e => {
328
- console.log('Restart failed:', e);
329
- // If restart fails, force a schedule check
330
- playScheduledVideo();
331
- });
332
  } else {
333
  // Otherwise switch to scheduled video
334
  playScheduledVideo();
 
36
  box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.6);
37
  }
38
 
39
+ #schedule-times > div.active-schedule {
40
+ background-color: rgba(234, 179, 8, 0.2);
41
+ border-left: 4px solid rgba(234, 179, 8, 0.8);
42
  transition: all 0.3s ease;
43
  }
44
 
 
110
  <h3 class="text-xl font-bold mb-4 text-yellow-300 tracking-wider">✨ Today's Schedule ✨</h3>
111
  <div id="schedule-times" class="text-sm space-y-3">
112
  <div class="flex items-start">
113
+ <div class="w-24 font-mono text-yellow-400">21:00 – 23:35</div>
114
  <div class="flex-1">
115
+ <div class="font-medium">Dance in Front of the Library of Alexandria</div>
116
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 02:35</div>
117
  </div>
118
  </div>
119
  <div class="h-px bg-gradient-to-r from-transparent via-yellow-500/30 to-transparent"></div>
120
  <div class="flex items-start">
121
+ <div class="w-24 font-mono text-yellow-400">23:35 – 01:28</div>
122
  <div class="flex-1">
123
+ <div class="font-medium">✨ Belly Dance ✨ - Sensual Dance</div>
124
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 01:53</div>
125
  </div>
126
  </div>
 
134
  </div>
135
  <div class="h-px bg-gradient-to-r from-transparent via-yellow-500/30 to-transparent"></div>
136
  <div class="flex items-start">
137
+ <div class="w-24 font-mono text-yellow-400">06:09 – 21:00</div>
138
  <div class="flex-1">
139
+ <div class="font-medium">Feast of Hathor</div>
140
  <div class="text-yellow-300 opacity-80 text-xs">Duration: 03:28</div>
141
  </div>
142
  </div>
 
222
  const scheduleItems = document.querySelectorAll('#schedule-times > div');
223
  scheduleItems.forEach((item, i) => {
224
  if (i === index * 2) { // Each video is every second div (0, 2, 4...)
225
+ item.classList.add('active-schedule');
 
 
226
  } else {
227
+ item.classList.remove('active-schedule');
 
 
228
  }
229
  });
230
  }
 
269
  // Highlight current schedule item
270
  highlightCurrentScheduleItem(videoIndex);
271
 
272
+ // Play video from calculated position
273
+ videoElement.currentTime = videoCurrentPosition;
274
+ videoElement.loop = true;
275
+ videoElement.play().catch(e => {
276
+ console.log('Auto-play prevented:', e);
277
+ // Fallback: mute and try again
278
+ videoElement.muted = true;
279
+ videoElement.play();
280
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
+ // Calculate time until next video should start
283
+ const timeUntilNextVideo = (video.endHour - currentHour) * 3600 * 1000;
284
+ // Clear any existing timeout to prevent multiple triggers
285
+ if (window.scheduleTimeout) {
286
+ clearTimeout(window.scheduleTimeout);
287
+ }
288
+ window.scheduleTimeout = setTimeout(playScheduledVideo, timeUntilNextVideo);
289
  }
290
 
291
+ // Handle video end (shouldn't be needed with loop=true, but just in case)
292
  videoElement.addEventListener('ended', function() {
293
  const now = new Date();
294
  const currentHour = now.getUTCHours() + now.getUTCMinutes() / 60;
295
  const currentVideo = videos[currentVideoIndex];
296
 
 
 
 
 
297
  // If still within current video's time slot, restart it
298
  if (currentHour >= currentVideo.startHour && currentHour < currentVideo.endHour) {
299
  videoElement.currentTime = 0;
300
+ videoElement.play();
 
 
 
 
301
  } else {
302
  // Otherwise switch to scheduled video
303
  playScheduledVideo();