-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo.html
More file actions
112 lines (96 loc) · 3.44 KB
/
Copy pathvideo.html
File metadata and controls
112 lines (96 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Watch Video | WeTube</title>
<!-- DaisyUI + Tailwind -->
<link
href="https://cdn.jsdelivr.net/npm/daisyui@5"
rel="stylesheet"
type="text/css"
/>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-base-200 min-h-screen">
<!-- Header -->
<header class="border-b bg-base-100">
<nav class="w-11/12 mx-auto flex items-center py-4">
<img
src="./assets/Logo.png"
onclick="goBack()"
class="w-[110px] cursor-pointer"
alt="WeTube Logo"
/>
</nav>
</header>
<!-- Main Content -->
<main class="w-11/12 mx-auto py-6">
<!-- Loader -->
<section id="loader" class="text-center py-20">
<span class="loading loading-dots loading-lg"></span>
</section>
<!-- Video Content -->
<div id="video-content" class="hidden max-w-4xl mx-auto">
<!-- Fake Player with Blur -->
<div class="relative aspect-video rounded-lg overflow-hidden mb-4">
<!-- Blurred Thumbnail -->
<img
id="video-thumbnail"
src=""
alt="Video Thumbnail"
class="w-full h-full object-cover scale-110 blur-sm"
/>
<!-- Dark Overlay -->
<div class="absolute inset-0 bg-black/50"></div>
<!-- Center Text -->
<div class="absolute inset-0 flex items-center justify-center">
<p class="text-white text-base sm:text-xl font-semibold mx-4 text-center">
▶ Video playback not available (API demo data)
</p>
</div>
</div>
<h1 id="video-title" class="text-xl font-bold mb-2"></h1>
<div class="flex items-center gap-3 mb-4">
<img id="author-img" class="w-10 h-10 rounded-full" />
<div>
<p id="author-name" class="font-semibold"></p>
<p id="video-views" class="text-sm text-gray-400"></p>
</div>
</div>
<p id="video-description" class="text-gray-600"></p>
</div>
</main>
<!-- Script -->
<script>
const loader = document.getElementById("loader");
const content = document.getElementById("video-content");
const params = new URLSearchParams(window.location.search);
const videoId = params.get("id");
function goBack() {
window.history.back();
}
const loadVideoDetails = async () => {
const res = await fetch(
`https://openapi.programming-hero.com/api/phero-tube/video/${videoId}`,
);
const data = await res.json();
const video = data.video;
// Set data
document.getElementById("video-thumbnail").src = video.thumbnail;
document.getElementById("video-title").innerText = video.title;
document.getElementById("author-img").src =
video.authors[0].profile_picture;
document.getElementById("author-name").innerText =
video.authors[0].profile_name;
document.getElementById("video-views").innerText =
video.others.views + " views";
document.getElementById("video-description").innerText =
video.description;
loader.classList.add("hidden");
content.classList.remove("hidden");
};
loadVideoDetails();
</script>
</body>
</html>