-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream-viewer.html
More file actions
258 lines (235 loc) · 11.3 KB
/
stream-viewer.html
File metadata and controls
258 lines (235 loc) · 11.3 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>StreamSync - Live Streaming</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/stream-viewer.css">
</head>
<body class="stream-page">
<header>
<nav class="main-nav">
<div class="logo">StreamSync</div>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="#">Browse</a></li>
<li><a href="#">Communities</a></li>
</ul>
<div class="auth-buttons">
<button id="login-btn">Login</button>
<button id="signup-btn" class="primary-btn">Sign Up</button>
<button id="logout-btn" style="display: none;">Logout</button>
<span id="user-status" style="display: none;"></span>
</div>
</nav>
</header>
<main class="stream-container">
<div class="stream-layout">
<div class="video-section">
<div class="video-container">
<div class="video-placeholder">
<div class="stream-offline">
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17 9.5L12 14.5L7 9.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<p>Stream is currently offline</p>
<div id="streamControls">
<button id="start-stream-btn" class="primary-btn">Start Streaming</button>
<button id="stop-stream-btn" class="primary-btn" style="display:none;">Stop Streaming</button>
</div>
<video id="stream-video" controls style="display:none; max-width: 100%; background: black;"></video>
</div>
</div>
</div>
</div>
<div class="chat-section">
<div class="stream-chat-section">
<div id="chat-messages" class="chat-messages"></div>
<div class="chat-input">
<input type="text" id="chat-input" placeholder="Send a message">
<button id="send-chat-btn" class="primary-btn">Send</button>
</div>
</div>
</div>
</div>
<div id="chat-messages" class="chat-messages">
<div class="chat-welcome">
<p>Welcome to the chat! Remember to follow our community guidelines.</p>
</div>
</div>
<div class="chat-input-area">
<input type="text" id="chat-input" placeholder="Send a message...">
<button id="send-chat-btn" class="primary-btn">Chat</button>
</div>
</div>
</div>
<div class="stream-details">
<div class="tabs">
<button class="tab-btn active" data-tab="about">About</button>
<button class="tab-btn" data-tab="videos">Videos</button>
<button class="tab-btn" data-tab="schedule">Schedule</button>
</div>
<div class="tab-content" id="about-tab">
<div class="about-stream">
<h3 id="stream-title">Stream Title</h3>
<p id="stream-description">Stream description will appear here</p>
<div class="streamer-stats">
<div class="stat-block">
<span class="stat-number" id="followers-count">0</span>
<span class="stat-label">Followers</span>
</div>
<div class="stat-block">
<span class="stat-number" id="videos-count">0</span>
<span class="stat-label">Videos</span>
</div>
<div class="stat-block">
<span class="stat-number" id="join-date">-</span>
<span class="stat-label">Joined</span>
</div>
</div>
</div>
</div>
<div class="tab-content hidden" id="videos-tab">
<h3>Past Broadcasts</h3>
<div class="video-grid">
<div class="video-card placeholder"></div>
<div class="video-card placeholder"></div>
<div class="video-card placeholder"></div>
</div>
</div>
<div class="tab-content hidden" id="schedule-tab">
<h3>Upcoming Streams</h3>
<div class="schedule-list">
<div class="schedule-item">
<div class="schedule-date">
<span class="day">Mon</span>
<span class="time">8:00 PM</span>
</div>
<div class="schedule-info">
<h4>Minecraft Mondays</h4>
<p>Building a new world with viewers!</p>
</div>
</div>
<div class="schedule-item">
<div class="schedule-date">
<span class="day">Wed</span>
<span class="time">7:00 PM</span>
</div>
<div class="schedule-info">
<h4>Coding with Friends</h4>
<p>Working on web development projects</p>
</div>
</div>
<div class="schedule-item">
<div class="schedule-date">
<span class="day">Fri</span>
<span class="time">9:00 PM</span>
</div>
<div class="schedule-info">
<h4>Friday Night Gaming</h4>
<p>Playing the latest releases</p>
</div>
</div>
</div>
</div>
</div>
</main>
<footer>
<p>© 2025 StreamSync. All rights reserved.</p>
</footer>
<!-- Authentication Modal -->
<div id="auth-modal" class="modal">
<div class="modal-content">
<span class="close-btn">×</span>
<div class="auth-container">
<!-- Login Form -->
<div id="login-form" class="auth-form active">
<h2>Login to StreamSync</h2>
<form id="login-submit">
<div class="form-group">
<label for="login-email">Email</label>
<input type="email" id="login-email" required>
</div>
<div class="form-group">
<label for="login-password">Password</label>
<input type="password" id="login-password" required>
</div>
<button type="submit" class="primary-btn">Login</button>
</form>
<p class="switch-form">Don't have an account? <a href="#" id="switch-to-signup">Sign Up</a></p>
</div>
<!-- Signup Form -->
<div id="signup-form" class="auth-form">
<h2>Create StreamSync Account</h2>
<form id="signup-submit">
<div class="form-group">
<label for="signup-username">Username</label>
<input type="text" id="signup-username" required>
</div>
<div class="form-group">
<label for="signup-email">Email</label>
<input type="email" id="signup-email" required>
</div>
<div class="form-group">
<label for="signup-password">Password</label>
<input type="password" id="signup-password" required>
</div>
<div class="form-group">
<label for="signup-confirm-password">Confirm Password</label>
<input type="password" id="signup-confirm-password" required>
</div>
<button type="submit" class="primary-btn">Sign Up</button>
</form>
<p class="switch-form">Already have an account? <a href="#" id="switch-to-login">Login</a></p>
</div>
</div>
</div>
</div>
<!-- JavaScript files -->
<script src="js/auth.js"></script>
<script src="js/main.js"></script>
<script src="js/streaming.js"></script>
<script src="js/chat.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Retrieve stream metadata from URL
const urlParams = new URLSearchParams(window.location.search);
const streamMetadataParam = urlParams.get('stream');
if (streamMetadataParam) {
try {
const streamMetadata = JSON.parse(decodeURIComponent(streamMetadataParam));
// Update stream info in UI
const titleElement = document.getElementById('stream-title');
const descriptionElement = document.getElementById('stream-description');
const streamControlsElement = document.getElementById('streamControls');
const streamOfflineElement = document.querySelector('.stream-offline');
const streamVideoElement = document.getElementById('stream-video');
if (titleElement) titleElement.textContent = streamMetadata.title;
if (descriptionElement) descriptionElement.textContent =
`Stream by ${streamMetadata.user} - ${streamMetadata.viewers} viewers`;
// Check if stream is live
if (!streamMetadata.isLive) {
// Hide start streaming button
if (streamControlsElement) streamControlsElement.style.display = 'none';
// Show offline message
if (streamOfflineElement) {
streamOfflineElement.innerHTML = `
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17 9.5L12 14.5L7 9.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<p>This stream is not live yet</p>
`;
}
// Hide video element
if (streamVideoElement) streamVideoElement.style.display = 'none';
}
} catch (error) {
console.error('Failed to parse stream metadata', error);
}
}
});
</script>
</body>
</html>