154 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			154 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
	<meta charset="UTF-8">
 | 
						|
	<title>Viva++</title>
 | 
						|
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
 | 
						|
	<style>
 | 
						|
		body {
 | 
						|
			background-color: #000;
 | 
						|
			margin: 0;
 | 
						|
			padding: 0;
 | 
						|
			display: flex;
 | 
						|
			justify-content: center;
 | 
						|
			align-items: center;
 | 
						|
			height: 100vh;
 | 
						|
		}
 | 
						|
 | 
						|
		.loader {
 | 
						|
			border: 1.5vw solid #333;
 | 
						|
			border-top: 1.5vw solid #3498db;
 | 
						|
			border-bottom: 1.5vw solid #3498db;
 | 
						|
			border-radius: 50%;
 | 
						|
			width: 10vw;
 | 
						|
			height: 10vw;
 | 
						|
			animation: spin 2s linear infinite;
 | 
						|
		}
 | 
						|
 | 
						|
		@keyframes spin {
 | 
						|
			0% { transform: rotate(0deg); }
 | 
						|
			100% { transform: rotate(360deg); }
 | 
						|
		}
 | 
						|
 | 
						|
		.video-container {
 | 
						|
			display: none;
 | 
						|
			width: 100%;
 | 
						|
			justify-content: center;
 | 
						|
			align-items: center;
 | 
						|
			gap: 2vw;
 | 
						|
		}
 | 
						|
 | 
						|
		.video-thumbnail {
 | 
						|
			border-radius: 8px;
 | 
						|
			transition: transform 0.3s ease;
 | 
						|
			box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
 | 
						|
			background-color: #444;
 | 
						|
			aspect-ratio: 16/9;
 | 
						|
			object-fit: cover;
 | 
						|
		}
 | 
						|
 | 
						|
		.current-video {
 | 
						|
			width: 50vw;
 | 
						|
			z-index: 2;
 | 
						|
			box-shadow: 0 0 200px -10px #444;
 | 
						|
		}
 | 
						|
 | 
						|
		.side-video {
 | 
						|
			width: 20vw;
 | 
						|
			opacity: 0.7;
 | 
						|
			z-index: 1;
 | 
						|
		}
 | 
						|
 | 
						|
		.play-button {
 | 
						|
			position: absolute;
 | 
						|
			top: 50%;
 | 
						|
			left: 50%;
 | 
						|
			transform: translate(-50%, -50%);
 | 
						|
			width: 80px; /* Adjust size as needed */
 | 
						|
			height: 80px; /* Adjust size as needed */
 | 
						|
			background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
 | 
						|
			background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
 | 
						|
			background-repeat: no-repeat;
 | 
						|
			background-position: center;
 | 
						|
			background-size: 50%; /* Adjust icon size within button */
 | 
						|
			border-radius: 50%; /* Circular button */
 | 
						|
			cursor: pointer;
 | 
						|
			z-index: 3; /* Ensure it's above the video thumbnails */
 | 
						|
			border: 2px solid white;
 | 
						|
			box-shadow: 0 0 15px rgba(0,0,0,0.7);
 | 
						|
		}
 | 
						|
 | 
						|
		.video-player {
 | 
						|
			width: 100%;
 | 
						|
			height: 100%;
 | 
						|
			position: fixed;
 | 
						|
			top: 0;
 | 
						|
			left: 0;
 | 
						|
			z-index: 10000;
 | 
						|
			background-color: black;
 | 
						|
		}
 | 
						|
	</style>
 | 
						|
	<script>
 | 
						|
		function hideLoader() {
 | 
						|
            $(".loader").hide();
 | 
						|
            $(".video-container").css("display", "flex");
 | 
						|
		}
 | 
						|
 | 
						|
		$(document).ready(function() {
 | 
						|
			// Pre-set all thumbnails to a placeholder state
 | 
						|
			$(".video-thumbnail").attr("src", "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 16 9'%3E%3C/svg%3E");
 | 
						|
 | 
						|
			$.getJSON("/api/homepage", function(data) {
 | 
						|
                let currentVideo = data.currentVideo;
 | 
						|
                // previousVideo = data.previousVideo;
 | 
						|
                // nextVideo = data.nextVideo;
 | 
						|
				//
 | 
						|
                // // Set thumbnails
 | 
						|
                $("#current-thumb").attr("src", currentVideo.thumbnail);
 | 
						|
                // $("#prev-thumb").attr("src", previousVideo.thumbnail);
 | 
						|
                // $("#next-thumb").attr("src", nextVideo.thumbnail);
 | 
						|
 | 
						|
                // Hide loader and show videos
 | 
						|
                hideLoader();
 | 
						|
 | 
						|
				$("#play-button").click(function() {
 | 
						|
					if (currentVideo && currentVideo.url) {
 | 
						|
						let videoElement = $("<video controls autoplay class='video-player'></video>").attr("src", currentVideo.url).appendTo("body")[0];
 | 
						|
						if (videoElement.requestFullscreen) {
 | 
						|
							videoElement.requestFullscreen();
 | 
						|
						} else if (videoElement.mozRequestFullScreen) { /* Firefox */
 | 
						|
							videoElement.mozRequestFullScreen();
 | 
						|
						} else if (videoElement.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
 | 
						|
							videoElement.webkitRequestFullscreen();
 | 
						|
						} else if (videoElement.msRequestFullscreen) { /* IE/Edge */
 | 
						|
							videoElement.msRequestFullscreen();
 | 
						|
						}
 | 
						|
						videoElement.onended = function() {
 | 
						|
							if (document.exitFullscreen) {
 | 
						|
								document.exitFullscreen();
 | 
						|
							} else if (document.mozCancelFullScreen) { /* Firefox */
 | 
						|
								document.mozCancelFullScreen();
 | 
						|
							} else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
 | 
						|
								document.webkitExitFullscreen();
 | 
						|
							} else if (document.msExitFullscreen) { /* IE/Edge */
 | 
						|
								document.msExitFullscreen();
 | 
						|
							}
 | 
						|
							$(videoElement).remove(); // Remove video element when playback ends
 | 
						|
						};
 | 
						|
					}
 | 
						|
				});
 | 
						|
			})
 | 
						|
		})
 | 
						|
	</script>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
	<div class="loader" id="loader"></div>
 | 
						|
	<div class="video-container">
 | 
						|
		<img id="prev-thumb" class="video-thumbnail side-video" alt="Previous Video">
 | 
						|
		<img id="current-thumb" class="video-thumbnail current-video" alt="Current Video">
 | 
						|
		<img id="next-thumb" class="video-thumbnail side-video" alt="Next Video">
 | 
						|
		<div class="play-button" id="play-button"></div>
 | 
						|
	</div>
 | 
						|
</body>
 | 
						|
</html>
 |