Altafo commited on
Commit
ca25268
·
verified ·
1 Parent(s): ee24e9c

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +901 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Stream Guru
3
- emoji: 🌍
4
  colorFrom: red
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: stream-guru
3
+ emoji: 🐳
4
  colorFrom: red
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,901 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Stream GURU</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes float {
11
+ 0% { transform: translateY(0px) rotate(0deg); }
12
+ 50% { transform: translateY(-20px) rotate(5deg); }
13
+ 100% { transform: translateY(0px) rotate(0deg); }
14
+ }
15
+ @keyframes pulse {
16
+ 0% { transform: scale(1); opacity: 0.7; }
17
+ 50% { transform: scale(1.1); opacity: 1; }
18
+ 100% { transform: scale(1); opacity: 0.7; }
19
+ }
20
+ @keyframes spin {
21
+ 0% { transform: rotate(0deg); }
22
+ 100% { transform: rotate(360deg); }
23
+ }
24
+ .floating-icon {
25
+ animation: float 6s ease-in-out infinite;
26
+ }
27
+ .pulse-icon {
28
+ animation: pulse 2s ease-in-out infinite;
29
+ }
30
+ .spin-icon {
31
+ animation: spin 4s linear infinite;
32
+ }
33
+ .terminal {
34
+ background-color: #1e1e1e;
35
+ color: #00ff00;
36
+ font-family: 'Courier New', monospace;
37
+ height: 200px;
38
+ overflow-y: auto;
39
+ padding: 1rem;
40
+ border-radius: 0.5rem;
41
+ }
42
+ .tab-active {
43
+ border-bottom: 3px solid #3b82f6;
44
+ color: #3b82f6;
45
+ font-weight: 600;
46
+ }
47
+ .video-preview {
48
+ background: linear-gradient(45deg, #1e293b, #0f172a);
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ }
53
+ .toggle-checkbox:checked {
54
+ right: 0;
55
+ border-color: #3b82f6;
56
+ }
57
+ .toggle-checkbox:checked + .toggle-label {
58
+ background-color: #3b82f6;
59
+ }
60
+ .stream-btn:disabled {
61
+ opacity: 0.5;
62
+ cursor: not-allowed;
63
+ }
64
+ .permission-modal {
65
+ background-color: rgba(0,0,0,0.8);
66
+ z-index: 100;
67
+ }
68
+ #videoElement {
69
+ width: 100%;
70
+ height: 100%;
71
+ object-fit: cover;
72
+ }
73
+ .connection-status {
74
+ position: relative;
75
+ padding-left: 1.5rem;
76
+ }
77
+ .connection-status::before {
78
+ content: "";
79
+ position: absolute;
80
+ left: 0;
81
+ top: 50%;
82
+ transform: translateY(-50%);
83
+ width: 0.75rem;
84
+ height: 0.75rem;
85
+ border-radius: 50%;
86
+ background-color: #6b7280;
87
+ }
88
+ .connection-status.connected::before {
89
+ background-color: #10b981;
90
+ animation: pulse 1.5s infinite;
91
+ }
92
+ .connection-status.connecting::before {
93
+ background-color: #f59e0b;
94
+ animation: pulse 1s infinite;
95
+ }
96
+ .connection-status.error::before {
97
+ background-color: #ef4444;
98
+ }
99
+ </style>
100
+ </head>
101
+ <body class="bg-gray-100 dark:bg-gray-900 transition-colors duration-300">
102
+ <!-- Home Screen -->
103
+ <div id="homeScreen" class="min-h-screen flex flex-col">
104
+ <div class="container mx-auto px-4 py-8 flex-1 flex flex-col">
105
+ <div class="flex justify-between items-center mb-8">
106
+ <h1 class="text-3xl font-bold text-gray-800 dark:text-white flex items-center">
107
+ <i class="fas fa-satellite-dish text-blue-500 mr-3"></i> Stream GURU
108
+ </h1>
109
+ <div class="flex items-center">
110
+ <span class="mr-2 text-gray-600 dark:text-gray-300 text-sm">Dark Mode</span>
111
+ <div class="relative inline-block w-12 mr-2 align-middle select-none">
112
+ <input type="checkbox" id="toggle" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/>
113
+ <label for="toggle" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
114
+ </div>
115
+ </div>
116
+ </div>
117
+
118
+ <div class="relative flex-1 flex flex-col items-center justify-center overflow-hidden">
119
+ <!-- 20 Floating Icons -->
120
+ <i class="fab fa-youtube text-red-600 text-4xl floating-icon absolute top-10 left-10 opacity-20"></i>
121
+ <i class="fab fa-facebook text-blue-600 text-4xl floating-icon absolute top-20 right-20 opacity-20"></i>
122
+ <i class="fab fa-tiktok text-black dark:text-white text-4xl floating-icon absolute bottom-20 left-20 opacity-20"></i>
123
+ <i class="fas fa-broadcast-tower text-purple-600 text-4xl floating-icon absolute bottom-10 right-10 opacity-20"></i>
124
+ <i class="fab fa-twitch text-purple-500 text-3xl floating-icon absolute top-1/4 left-1/4 opacity-15 spin-icon"></i>
125
+ <i class="fab fa-instagram text-pink-500 text-3xl floating-icon absolute top-1/3 right-1/4 opacity-15"></i>
126
+ <i class="fab fa-twitter text-blue-400 text-3xl floating-icon absolute bottom-1/4 left-1/3 opacity-15 pulse-icon"></i>
127
+ <i class="fas fa-video text-green-500 text-3xl floating-icon absolute top-1/2 right-1/3 opacity-15"></i>
128
+ <i class="fas fa-film text-yellow-500 text-3xl floating-icon absolute bottom-1/3 left-1/2 opacity-15"></i>
129
+ <i class="fas fa-satellite text-indigo-500 text-3xl floating-icon absolute top-1/4 right-1/2 opacity-15 spin-icon"></i>
130
+ <i class="fas fa-wifi text-blue-300 text-3xl floating-icon absolute bottom-1/2 left-1/4 opacity-15"></i>
131
+ <i class="fas fa-cloud text-gray-400 text-3xl floating-icon absolute top-3/4 right-1/5 opacity-15"></i>
132
+ <i class="fas fa-microphone text-red-400 text-3xl floating-icon absolute bottom-1/5 left-3/4 opacity-15 pulse-icon"></i>
133
+ <i class="fas fa-headphones text-purple-300 text-3xl floating-icon absolute top-1/5 right-3/4 opacity-15"></i>
134
+ <i class="fas fa-music text-pink-300 text-3xl floating-icon absolute bottom-3/4 left-1/5 opacity-15"></i>
135
+ <i class="fas fa-compact-disc text-indigo-300 text-3xl floating-icon absolute top-2/3 right-2/3 opacity-15 spin-icon"></i>
136
+ <i class="fas fa-play-circle text-red-300 text-3xl floating-icon absolute bottom-2/3 left-2/3 opacity-15 pulse-icon"></i>
137
+ <i class="fas fa-stop-circle text-yellow-300 text-3xl floating-icon absolute top-3/4 left-3/4 opacity-15"></i>
138
+ <i class="fas fa-podcast text-green-300 text-3xl floating-icon absolute bottom-3/4 right-3/4 opacity-15"></i>
139
+ <i class="fas fa-rss text-orange-300 text-3xl floating-icon absolute top-1/2 left-1/2 opacity-15 spin-icon"></i>
140
+
141
+ <div class="text-center max-w-2xl z-10">
142
+ <h2 class="text-4xl font-bold mb-6 text-gray-800 dark:text-white">Ultimate Multi-Streaming Platform</h2>
143
+ <p class="text-lg text-gray-600 dark:text-gray-300 mb-8">
144
+ Broadcast to multiple platforms simultaneously with advanced proxy support and real-time monitoring.
145
+ </p>
146
+
147
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-12">
148
+ <div class="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md hover:shadow-lg transition-shadow">
149
+ <i class="fas fa-globe text-blue-500 text-2xl mb-2"></i>
150
+ <h3 class="font-semibold text-gray-800 dark:text-white">Multi-Platform</h3>
151
+ <p class="text-gray-600 dark:text-gray-300 text-sm">Stream to 10+ platforms including YouTube, Twitch, Facebook</p>
152
+ </div>
153
+ <div class="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md hover:shadow-lg transition-shadow">
154
+ <i class="fas fa-user-secret text-green-500 text-2xl mb-2"></i>
155
+ <h3 class="font-semibold text-gray-800 dark:text-white">Proxy Support</h3>
156
+ <p class="text-gray-600 dark:text-gray-300 text-sm">HTTPS & SOCKS5 proxy with automatic rotation</p>
157
+ </div>
158
+ <div class="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md hover:shadow-lg transition-shadow">
159
+ <i class="fas fa-video text-purple-500 text-2xl mb-2"></i>
160
+ <h3 class="font-semibold text-gray-800 dark:text-white">Flexible Sources</h3>
161
+ <p class="text-gray-600 dark:text-gray-300 text-sm">Camera, screen capture, or pre-recorded videos</p>
162
+ </div>
163
+ <div class="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md hover:shadow-lg transition-shadow">
164
+ <i class="fas fa-tachometer-alt text-yellow-500 text-2xl mb-2"></i>
165
+ <h3 class="font-semibold text-gray-800 dark:text-white">Optimized</h3>
166
+ <p class="text-gray-600 dark:text-gray-300 text-sm">Adaptive bitrate for perfect streaming quality</p>
167
+ </div>
168
+ </div>
169
+
170
+ <button onclick="showStreamSetup()" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-full text-lg transition-all transform hover:scale-105 shadow-lg">
171
+ <i class="fas fa-rocket mr-2"></i> Start Streaming
172
+ </button>
173
+ </div>
174
+ </div>
175
+
176
+ <div class="mt-auto text-center py-6">
177
+ <p class="text-gray-500 dark:text-gray-400">Developed by Trickey Guru | v2.0</p>
178
+ </div>
179
+ </div>
180
+ </div>
181
+
182
+ <!-- Streaming Setup Screen -->
183
+ <div id="streamSetupScreen" class="min-h-screen hidden bg-gray-100 dark:bg-gray-900">
184
+ <div class="container mx-auto px-4 py-6">
185
+ <div class="flex justify-between items-center mb-6">
186
+ <button onclick="showHomeScreen()" class="text-blue-600 dark:text-blue-400 flex items-center">
187
+ <i class="fas fa-arrow-left mr-2"></i> Back
188
+ </button>
189
+ <h2 class="text-2xl font-bold text-gray-800 dark:text-white flex items-center">
190
+ <i class="fas fa-sliders-h mr-2 text-blue-500"></i> Streaming Setup
191
+ </h2>
192
+ <div class="w-12"></div>
193
+ </div>
194
+
195
+ <!-- Tab Navigation -->
196
+ <div class="flex border-b border-gray-200 dark:border-gray-700 mb-6">
197
+ <button id="tab1" onclick="switchTab(1)" class="px-4 py-2 tab-active">Stream 1</button>
198
+ <button id="tab2" onclick="switchTab(2)" class="px-4 py-2">Stream 2</button>
199
+ <button id="tab3" onclick="switchTab(3)" class="px-4 py-2">Stream 3</button>
200
+ <button onclick="addTab()" class="px-4 py-2 text-blue-600 dark:text-blue-400">
201
+ <i class="fas fa-plus"></i>
202
+ </button>
203
+ </div>
204
+
205
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
206
+ <!-- Video Source -->
207
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
208
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
209
+ <i class="fas fa-video mr-2 text-blue-500"></i> Video Source
210
+ </h3>
211
+
212
+ <div class="video-preview rounded-lg mb-4 h-40 relative" id="videoPreviewContainer">
213
+ <i class="fas fa-video text-gray-400 text-4xl" id="videoPlaceholderIcon"></i>
214
+ <video id="videoElement" class="hidden" autoplay playsinline></video>
215
+ </div>
216
+
217
+ <div class="flex space-x-2 mb-4">
218
+ <button onclick="requestCameraPermission()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex-1">
219
+ <i class="fas fa-camera mr-2"></i> Use Camera
220
+ </button>
221
+ <button onclick="requestGalleryPermission()" class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg flex-1">
222
+ <i class="fas fa-folder-open mr-2"></i> Select Video
223
+ </button>
224
+ </div>
225
+
226
+ <div class="flex justify-between mb-2">
227
+ <button id="playBtn" class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg" disabled>
228
+ <i class="fas fa-play mr-2"></i> Play
229
+ </button>
230
+ <button id="pauseBtn" class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg" disabled>
231
+ <i class="fas fa-pause mr-2"></i> Pause
232
+ </button>
233
+ <button id="muteBtn" class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg" disabled>
234
+ <i class="fas fa-volume-up mr-2"></i> Mute
235
+ </button>
236
+ </div>
237
+
238
+ <div class="flex items-center">
239
+ <input type="checkbox" id="loopToggle" class="mr-2">
240
+ <label for="loopToggle" class="text-gray-700 dark:text-gray-300">Loop Video</label>
241
+ </div>
242
+ </div>
243
+
244
+ <!-- Stream Settings -->
245
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
246
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
247
+ <i class="fas fa-stream mr-2 text-blue-500"></i> Stream Settings
248
+ </h3>
249
+
250
+ <div class="mb-4">
251
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Platform</label>
252
+ <select id="platformSelect" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
253
+ <option value="">Select Platform</option>
254
+ <option value="youtube">YouTube</option>
255
+ <option value="facebook">Facebook</option>
256
+ <option value="twitch">Twitch</option>
257
+ <option value="tiktok">TikTok</option>
258
+ <option value="custom">Custom RTMP</option>
259
+ </select>
260
+ </div>
261
+
262
+ <div id="youtubeFields" class="hidden space-y-3">
263
+ <div>
264
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">YouTube Server</label>
265
+ <select id="youtubeServer" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
266
+ <option value="primary">Primary (rtmp://a.rtmp.youtube.com/live2)</option>
267
+ <option value="backup">Backup (rtmp://b.rtmp.youtube.com/live2)</option>
268
+ </select>
269
+ </div>
270
+ <div>
271
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Stream Key</label>
272
+ <input type="text" id="youtubeKey" placeholder="Enter YouTube stream key" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
273
+ </div>
274
+ <button onclick="testYouTubeConnection()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg w-full">
275
+ <i class="fas fa-plug mr-2"></i> Test Connection
276
+ </button>
277
+ <div id="youtubeStatus" class="connection-status text-sm">
278
+ Not connected
279
+ </div>
280
+ </div>
281
+
282
+ <div id="customFields" class="hidden space-y-3">
283
+ <div>
284
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">RTMP URL</label>
285
+ <input type="text" id="customUrl" placeholder="rtmp://example.com/live" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
286
+ </div>
287
+
288
+ <div>
289
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Stream Key</label>
290
+ <input type="text" id="customKey" placeholder="your-stream-key" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
291
+ </div>
292
+ </div>
293
+
294
+ <div class="mb-4 mt-4">
295
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Final URL</label>
296
+ <div id="finalUrl" class="bg-gray-100 dark:bg-gray-700 p-2 rounded-lg text-sm text-gray-600 dark:text-gray-300 break-all">
297
+ No stream URL configured
298
+ </div>
299
+ </div>
300
+
301
+ <button id="addStreamBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg w-full">
302
+ <i class="fas fa-plus-circle mr-2"></i> Add New Stream
303
+ </button>
304
+ </div>
305
+
306
+ <!-- Proxy & Quality -->
307
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
308
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
309
+ <i class="fas fa-user-shield mr-2 text-blue-500"></i> Proxy & Quality
310
+ </h3>
311
+
312
+ <div class="mb-4">
313
+ <div class="flex items-center justify-between mb-2">
314
+ <label class="text-gray-700 dark:text-gray-300">Enable Proxy</label>
315
+ <label class="relative inline-flex items-center cursor-pointer">
316
+ <input type="checkbox" class="sr-only peer" id="proxyToggle">
317
+ <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
318
+ </label>
319
+ </div>
320
+
321
+ <div id="proxyFields" class="hidden space-y-3 mt-3">
322
+ <div>
323
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Proxy Type</label>
324
+ <select class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
325
+ <option>HTTPS</option>
326
+ <option>SOCKS5</option>
327
+ </select>
328
+ </div>
329
+
330
+ <div>
331
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">IP Address</label>
332
+ <input type="text" placeholder="192.168.1.1" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
333
+ </div>
334
+
335
+ <div>
336
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Port</label>
337
+ <input type="number" placeholder="8080" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
338
+ </div>
339
+
340
+ <div>
341
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Username (optional)</label>
342
+ <input type="text" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
343
+ </div>
344
+
345
+ <div>
346
+ <label class="block text-gray-700 dark:text-gray-300 mb-1">Password (optional)</label>
347
+ <input type="password" class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-800 dark:text-white">
348
+ </div>
349
+
350
+ <div class="flex space-x-2">
351
+ <button class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg flex-1">
352
+ <i class="fas fa-plug mr-2"></i> Check Proxy
353
+ </button>
354
+ <button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex-1">
355
+ <i class="fas fa-save mr-2"></i> Save
356
+ </button>
357
+ </div>
358
+ </div>
359
+ </div>
360
+
361
+ <div class="mt-6">
362
+ <div class="flex items-center justify-between mb-2">
363
+ <label class="text-gray-700 dark:text-gray-300">Low Bandwidth Mode</label>
364
+ <label class="relative inline-flex items-center cursor-pointer">
365
+ <input type="checkbox" class="sr-only peer" id="bandwidthToggle">
366
+ <div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
367
+ </label>
368
+ </div>
369
+ <p class="text-sm text-gray-500 dark:text-gray-400">Reduces bitrate and uses "ultrafast" preset for unstable networks</p>
370
+ </div>
371
+
372
+ <div class="mt-8">
373
+ <button id="startStreamBtn" onclick="startStreaming()" class="bg-green-600 hover:bg-green-700 text-white px-4 py-3 rounded-lg w-full font-bold stream-btn" disabled>
374
+ <i class="fas fa-broadcast-tower mr-2"></i> Start Streaming
375
+ </button>
376
+ </div>
377
+ </div>
378
+ </div>
379
+ </div>
380
+ </div>
381
+
382
+ <!-- Streaming Screen -->
383
+ <div id="streamingScreen" class="min-h-screen hidden bg-gray-100 dark:bg-gray-900">
384
+ <div class="container mx-auto px-4 py-6">
385
+ <div class="flex justify-between items-center mb-6">
386
+ <button onclick="showStreamSetup()" class="text-blue-600 dark:text-blue-400 flex items-center">
387
+ <i class="fas fa-arrow-left mr-2"></i> Back
388
+ </button>
389
+ <h2 class="text-2xl font-bold text-gray-800 dark:text-white flex items-center">
390
+ <i class="fas fa-broadcast-tower text-red-500 mr-2 animate-pulse"></i> Live Streaming
391
+ </h2>
392
+ <div class="w-12"></div>
393
+ </div>
394
+
395
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
396
+ <!-- Left Column -->
397
+ <div class="lg:col-span-2 space-y-6">
398
+ <!-- Video Preview -->
399
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
400
+ <div class="video-preview rounded-lg mb-4 h-64 relative">
401
+ <video id="liveVideoElement" autoplay playsinline class="w-full h-full"></video>
402
+ <div class="absolute bottom-4 left-4 bg-red-600 text-white px-2 py-1 rounded-md flex items-center">
403
+ <div class="w-2 h-2 rounded-full bg-white mr-2 animate-pulse"></div>
404
+ <span>LIVE</span>
405
+ <span id="streamTimer" class="ml-4">00:00:00</span>
406
+ </div>
407
+ </div>
408
+
409
+ <div class="flex justify-between items-center">
410
+ <div class="flex items-center">
411
+ <div class="w-3 h-3 rounded-full bg-green-500 mr-2 animate-pulse"></div>
412
+ <span class="font-semibold text-gray-800 dark:text-white">Streaming Active</span>
413
+ </div>
414
+
415
+ <button onclick="stopStreaming()" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg">
416
+ <i class="fas fa-stop mr-2"></i> Stop Streaming
417
+ </button>
418
+ </div>
419
+ </div>
420
+
421
+ <!-- FFmpeg Logs -->
422
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
423
+ <h3 class="text-lg font-semibold mb-2 text-gray-800 dark:text-white">
424
+ <i class="fas fa-terminal mr-2 text-blue-500"></i> FFmpeg Logs
425
+ </h3>
426
+ <div class="terminal rounded-lg">
427
+ <div>> Starting FFmpeg process...</div>
428
+ <div>> Connecting to YouTube servers...</div>
429
+ <div id="youtubeLogLine">>> YouTube: Establishing connection to rtmp://a.rtmp.youtube.com/live2...</div>
430
+ <div id="youtubeStatusLine">>> YouTube: Connection established! Streaming active.</div>
431
+ <div>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':</div>
432
+ <div>> Metadata:</div>
433
+ <div>> major_brand : isom</div>
434
+ <div>> minor_version : 512</div>
435
+ <div>> compatible_brands: isomiso2avc1mp41</div>
436
+ <div>> Duration: 00:05:30.00, start: 0.000000, bitrate: 1500 kb/s</div>
437
+ <div>> Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720, 1499 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)</div>
438
+ <div>> Stream mapping:</div>
439
+ <div>> Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))</div>
440
+ <div>> Press [q] to stop, [?] for help</div>
441
+ <div>> [libx264 @ 0x7f8b4c00b600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2</div>
442
+ <div>> [libx264 @ 0x7f8b4c00b600] profile High, level 3.1, 4:2:0, 8-bit</div>
443
+ <div>> Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/your-stream-key':</div>
444
+ <div>> Metadata:</div>
445
+ <div>> encoder : Lavf58.76.100</div>
446
+ <div>> Stream #0:0(und): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1280x720, q=-1--1, 3000 kb/s, 30 fps, 1k tbn (default)</div>
447
+ <div>> Metadata:</div>
448
+ <div>> encoder : Lavc58.134.100 libx264</div>
449
+ <div>> Side data:</div>
450
+ <div>> cpb: bitrate max/min/avg: 6000000/0/3000000 buffer size: 6000000 vbv_delay: -1</div>
451
+ <div>> frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x</div>
452
+ </div>
453
+ </div>
454
+ </div>
455
+
456
+ <!-- Right Column -->
457
+ <div class="space-y-6">
458
+ <!-- Stream Status -->
459
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
460
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
461
+ <i class="fas fa-chart-bar mr-2 text-blue-500"></i> Stream Status
462
+ </h3>
463
+
464
+ <div class="space-y-3">
465
+ <div class="flex justify-between">
466
+ <span class="text-gray-700 dark:text-gray-300">YouTube</span>
467
+ <span class="text-green-500 font-semibold connection-status connected">Active</span>
468
+ </div>
469
+ <div class="flex justify-between">
470
+ <span class="text-gray-700 dark:text-gray-300">Facebook</span>
471
+ <span class="text-yellow-500 font-semibold connection-status connecting">Connecting</span>
472
+ </div>
473
+ <div class="flex justify-between">
474
+ <span class="text-gray-700 dark:text-gray-300">Twitch</span>
475
+ <span class="text-gray-500 font-semibold connection-status">Inactive</span>
476
+ </div>
477
+ </div>
478
+ </div>
479
+
480
+ <!-- Stream Info -->
481
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
482
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
483
+ <i class="fas fa-info-circle mr-2 text-blue-500"></i> Stream Information
484
+ </h3>
485
+
486
+ <div class="space-y-2">
487
+ <div>
488
+ <label class="block text-gray-700 dark:text-gray-300 text-sm">Video Source</label>
489
+ <p class="text-gray-800 dark:text-white font-medium">Live Camera</p>
490
+ </div>
491
+ <div>
492
+ <label class="block text-gray-700 dark:text-gray-300 text-sm">Resolution</label>
493
+ <p class="text-gray-800 dark:text-white font-medium">1280x720</p>
494
+ </div>
495
+ <div>
496
+ <label class="block text-gray-700 dark:text-gray-300 text-sm">Bitrate</label>
497
+ <p class="text-gray-800 dark:text-white font-medium">3000 kbps</p>
498
+ </div>
499
+ <div>
500
+ <label class="block text-gray-700 dark:text-gray-300 text-sm">FPS</label>
501
+ <p class="text-gray-800 dark:text-white font-medium">30</p>
502
+ </div>
503
+ <div>
504
+ <label class="block text-gray-700 dark:text-gray-300 text-sm">Proxy</label>
505
+ <p class="text-gray-800 dark:text-white font-medium">Disabled</p>
506
+ </div>
507
+ </div>
508
+ </div>
509
+
510
+ <!-- Quick Controls -->
511
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-4">
512
+ <h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-white">
513
+ <i class="fas fa-sliders-h mr-2 text-blue-500"></i> Quick Controls
514
+ </h3>
515
+
516
+ <div class="grid grid-cols-2 gap-3">
517
+ <button class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg">
518
+ <i class="fas fa-pause mr-2"></i> Pause
519
+ </button>
520
+ <button class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg">
521
+ <i class="fas fa-volume-up mr-2"></i> Mute
522
+ </button>
523
+ <button class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg">
524
+ <i class="fas fa-sync-alt mr-2"></i> Restart
525
+ </button>
526
+ <button class="bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-white px-4 py-2 rounded-lg">
527
+ <i class="fas fa-cog mr-2"></i> Settings
528
+ </button>
529
+ </div>
530
+ </div>
531
+ </div>
532
+ </div>
533
+ </div>
534
+ </div>
535
+
536
+ <!-- Permission Modal -->
537
+ <div id="permissionModal" class="fixed inset-0 flex items-center justify-center hidden permission-modal">
538
+ <div class="bg-white dark:bg-gray-800 rounded-lg shadow-xl p-6 max-w-md w-full mx-4">
539
+ <h3 class="text-xl font-bold mb-4 text-gray-800 dark:text-white">Permission Required</h3>
540
+ <p class="text-gray-600 dark:text-gray-300 mb-6">Stream GURU needs access to your camera to start live streaming. Please allow camera access when prompted.</p>
541
+ <div class="flex justify-end space-x-3">
542
+ <button onclick="hidePermissionModal()" class="px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-800 dark:text-white">Cancel</button>
543
+ <button onclick="requestCameraAccess()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">Allow Access</button>
544
+ </div>
545
+ </div>
546
+ </div>
547
+
548
+ <script>
549
+ // Dark mode toggle
550
+ const toggle = document.getElementById('toggle');
551
+ const html = document.querySelector('html');
552
+
553
+ // Check for saved user preference or use system preference
554
+ if (localStorage.getItem('darkMode') === 'true' ||
555
+ (!localStorage.getItem('darkMode') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
556
+ html.classList.add('dark');
557
+ toggle.checked = true;
558
+ }
559
+
560
+ toggle.addEventListener('change', function() {
561
+ if (this.checked) {
562
+ html.classList.add('dark');
563
+ localStorage.setItem('darkMode', 'true');
564
+ } else {
565
+ html.classList.remove('dark');
566
+ localStorage.setItem('darkMode', 'false');
567
+ }
568
+ });
569
+
570
+ // Screen navigation
571
+ function showHomeScreen() {
572
+ document.getElementById('homeScreen').classList.remove('hidden');
573
+ document.getElementById('streamSetupScreen').classList.add('hidden');
574
+ document.getElementById('streamingScreen').classList.add('hidden');
575
+ stopAllStreams();
576
+ }
577
+
578
+ function showStreamSetup() {
579
+ document.getElementById('homeScreen').classList.add('hidden');
580
+ document.getElementById('streamSetupScreen').classList.remove('hidden');
581
+ document.getElementById('streamingScreen').classList.add('hidden');
582
+ stopAllStreams();
583
+ }
584
+
585
+ function startStreaming() {
586
+ document.getElementById('homeScreen').classList.add('hidden');
587
+ document.getElementById('streamSetupScreen').classList.add('hidden');
588
+ document.getElementById('streamingScreen').classList.remove('hidden');
589
+
590
+ // Start timer
591
+ let seconds = 0;
592
+ const timer = setInterval(function() {
593
+ seconds++;
594
+ const hours = Math.floor(seconds / 3600);
595
+ const minutes = Math.floor((seconds % 3600) / 60);
596
+ const secs = seconds % 60;
597
+
598
+ document.getElementById('streamTimer').textContent =
599
+ `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
600
+ }, 1000);
601
+
602
+ // Store timer interval so we can clear it later
603
+ document.getElementById('streamingScreen').setAttribute('data-timer', timer);
604
+
605
+ // Start the live video feed
606
+ const videoElement = document.getElementById('liveVideoElement');
607
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
608
+ navigator.mediaDevices.getUserMedia({ video: true, audio: true })
609
+ .then(function(stream) {
610
+ videoElement.srcObject = stream;
611
+ })
612
+ .catch(function(error) {
613
+ console.error("Error accessing media devices:", error);
614
+ });
615
+ }
616
+ }
617
+
618
+ function stopStreaming() {
619
+ // Clear timer
620
+ const timer = document.getElementById('streamingScreen').getAttribute('data-timer');
621
+ clearInterval(parseInt(timer));
622
+
623
+ // Stop all media streams
624
+ stopAllStreams();
625
+
626
+ showStreamSetup();
627
+ }
628
+
629
+ function stopAllStreams() {
630
+ // Stop camera streams
631
+ const videoElements = document.querySelectorAll('video');
632
+ videoElements.forEach(video => {
633
+ if (video.srcObject) {
634
+ video.srcObject.getTracks().forEach(track => track.stop());
635
+ video.srcObject = null;
636
+ }
637
+ });
638
+
639
+ // Hide live video and show placeholder
640
+ const videoPreview = document.getElementById('videoPreviewContainer');
641
+ const videoElement = document.getElementById('videoElement');
642
+ const placeholderIcon = document.getElementById('videoPlaceholderIcon');
643
+
644
+ if (videoElement && placeholderIcon) {
645
+ videoElement.classList.add('hidden');
646
+ placeholderIcon.classList.remove('hidden');
647
+ }
648
+
649
+ // Reset YouTube connection status
650
+ const youtubeStatus = document.getElementById('youtubeStatus');
651
+ if (youtubeStatus) {
652
+ youtubeStatus.textContent = "Not connected";
653
+ youtubeStatus.className = "connection-status text-sm";
654
+ }
655
+ }
656
+
657
+ // Proxy toggle
658
+ const proxyToggle = document.getElementById('proxyToggle');
659
+ const proxyFields = document.getElementById('proxyFields');
660
+
661
+ proxyToggle.addEventListener('change', function() {
662
+ if (this.checked) {
663
+ proxyFields.classList.remove('hidden');
664
+ } else {
665
+ proxyFields.classList.add('hidden');
666
+ }
667
+ });
668
+
669
+ // Tab functionality
670
+ let currentTab = 1;
671
+ const totalTabs = 3;
672
+
673
+ function switchTab(tabNumber) {
674
+ currentTab = tabNumber;
675
+
676
+ // Update tab styling
677
+ for (let i = 1; i <= totalTabs; i++) {
678
+ const tab = document.getElementById(`tab${i}`);
679
+ if (i === tabNumber) {
680
+ tab.classList.add('tab-active');
681
+ } else {
682
+ tab.classList.remove('tab-active');
683
+ }
684
+ }
685
+
686
+ // In a real app, you would load the settings for this tab
687
+ }
688
+
689
+ function addTab() {
690
+ if (totalTabs < 5) {
691
+ // In a real app, you would add a new tab
692
+ alert('New tab would be added in the full app');
693
+ } else {
694
+ alert('Maximum number of streams reached');
695
+ }
696
+ }
697
+
698
+ // Platform selection
699
+ const platformSelect = document.getElementById('platformSelect');
700
+ const youtubeFields = document.getElementById('youtubeFields');
701
+ const customFields = document.getElementById('customFields');
702
+ const startStreamBtn = document.getElementById('startStreamBtn');
703
+
704
+ platformSelect.addEventListener('change', function() {
705
+ youtubeFields.classList.add('hidden');
706
+ customFields.classList.add('hidden');
707
+
708
+ if (this.value === 'youtube') {
709
+ youtubeFields.classList.remove('hidden');
710
+ } else if (this.value === 'custom') {
711
+ customFields.classList.remove('hidden');
712
+ }
713
+
714
+ updateFinalUrl();
715
+ validateStreamSettings();
716
+ });
717
+
718
+ // Update final URL when inputs change
719
+ document.getElementById('youtubeKey').addEventListener('input', function() {
720
+ updateFinalUrl();
721
+ validateStreamSettings();
722
+ });
723
+
724
+ document.getElementById('customUrl').addEventListener('input', function() {
725
+ updateFinalUrl();
726
+ validateStreamSettings();
727
+ });
728
+
729
+ document.getElementById('customKey').addEventListener('input', function() {
730
+ updateFinalUrl();
731
+ validateStreamSettings();
732
+ });
733
+
734
+ function updateFinalUrl() {
735
+ const finalUrl = document.getElementById('finalUrl');
736
+ const platform = platformSelect.value;
737
+
738
+ if (platform === 'youtube') {
739
+ const server = document.getElementById('youtubeServer').value;
740
+ const key = document.getElementById('youtubeKey').value;
741
+ const serverUrl = server === 'primary' ? 'rtmp://a.rtmp.youtube.com/live2' : 'rtmp://b.rtmp.youtube.com/live2';
742
+
743
+ if (key) {
744
+ finalUrl.textContent = `${serverUrl}/${key}`;
745
+ } else {
746
+ finalUrl.textContent = `${serverUrl}/[your-stream-key]`;
747
+ }
748
+ } else if (platform === 'custom') {
749
+ const url = document.getElementById('customUrl').value;
750
+ const key = document.getElementById('customKey').value;
751
+
752
+ if (url && key) {
753
+ finalUrl.textContent = `${url}/${key}`;
754
+ } else if (url) {
755
+ finalUrl.textContent = `${url}/[your-stream-key]`;
756
+ } else {
757
+ finalUrl.textContent = "No stream URL configured";
758
+ }
759
+ } else {
760
+ finalUrl.textContent = "Select a platform to configure";
761
+ }
762
+ }
763
+
764
+ function validateStreamSettings() {
765
+ const platform = platformSelect.value;
766
+ let isValid = false;
767
+
768
+ if (platform === 'youtube') {
769
+ isValid = document.getElementById('youtubeKey').value.trim() !== '';
770
+ } else if (platform === 'custom') {
771
+ isValid = document.getElementById('customUrl').value.trim() !== '' &&
772
+ document.getElementById('customKey').value.trim() !== '';
773
+ }
774
+
775
+ // Also check if we have video source
776
+ const videoElement = document.getElementById('videoElement');
777
+ const hasVideoSource = videoElement.src || (videoElement.srcObject && videoElement.srcObject.active);
778
+
779
+ startStreamBtn.disabled = !(isValid && hasVideoSource);
780
+ }
781
+
782
+ // Test YouTube connection
783
+ function testYouTubeConnection() {
784
+ const youtubeStatus = document.getElementById('youtubeStatus');
785
+ const youtubeKey = document.getElementById('youtubeKey').value.trim();
786
+
787
+ if (!youtubeKey) {
788
+ youtubeStatus.textContent = "Please enter a stream key";
789
+ youtubeStatus.className = "connection-status error text-sm";
790
+ return;
791
+ }
792
+
793
+ youtubeStatus.textContent = "Connecting to YouTube...";
794
+ youtubeStatus.className = "connection-status connecting text-sm";
795
+
796
+ // Simulate connection test (in a real app, this would be an actual connection test)
797
+ setTimeout(() => {
798
+ // Randomly decide if connection succeeds (80% chance) for demo purposes
799
+ if (Math.random() > 0.2) {
800
+ youtubeStatus.textContent = "Connected to YouTube successfully!";
801
+ youtubeStatus.className = "connection-status connected text-sm";
802
+ } else {
803
+ youtubeStatus.textContent = "Connection failed. Check your stream key.";
804
+ youtubeStatus.className = "connection-status error text-sm";
805
+ }
806
+ }, 2000);
807
+ }
808
+
809
+ // Camera and gallery permissions
810
+ function requestCameraPermission() {
811
+ showPermissionModal();
812
+ }
813
+
814
+ function requestGalleryPermission() {
815
+ alert("In a real app, this would request access to your gallery/files");
816
+ // For demo purposes, we'll just simulate selecting a video
817
+ const videoElement = document.getElementById('videoElement');
818
+ const placeholderIcon = document.getElementById('videoPlaceholderIcon');
819
+
820
+ // Create a fake video source for demo
821
+ videoElement.src = "https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4";
822
+ videoElement.classList.remove('hidden');
823
+ placeholderIcon.classList.add('hidden');
824
+
825
+ // Enable video controls
826
+ document.getElementById('playBtn').disabled = false;
827
+ document.getElementById('pauseBtn').disabled = false;
828
+ document.getElementById('muteBtn').disabled = false;
829
+
830
+ validateStreamSettings();
831
+ }
832
+
833
+ function showPermissionModal() {
834
+ document.getElementById('permissionModal').classList.remove('hidden');
835
+ }
836
+
837
+ function hidePermissionModal() {
838
+ document.getElementById('permissionModal').classList.add('hidden');
839
+ }
840
+
841
+ function requestCameraAccess() {
842
+ hidePermissionModal();
843
+
844
+ const videoElement = document.getElementById('videoElement');
845
+ const placeholderIcon = document.getElementById('videoPlaceholderIcon');
846
+
847
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
848
+ navigator.mediaDevices.getUserMedia({ video: true, audio: true })
849
+ .then(function(stream) {
850
+ videoElement.srcObject = stream;
851
+ videoElement.classList.remove('hidden');
852
+ placeholderIcon.classList.add('hidden');
853
+
854
+ // Enable video controls
855
+ document.getElementById('playBtn').disabled = false;
856
+ document.getElementById('pauseBtn').disabled = false;
857
+ document.getElementById('muteBtn').disabled = false;
858
+
859
+ validateStreamSettings();
860
+ })
861
+ .catch(function(error) {
862
+ console.error("Error accessing media devices:", error);
863
+ alert("Could not access camera. Please check permissions.");
864
+ });
865
+ } else {
866
+ alert("Camera access is not supported in your browser.");
867
+ }
868
+ }
869
+
870
+ // Video controls
871
+ document.getElementById('playBtn').addEventListener('click', function() {
872
+ const videoElement = document.getElementById('videoElement');
873
+ if (videoElement.src || videoElement.srcObject) {
874
+ videoElement.play();
875
+ }
876
+ });
877
+
878
+ document.getElementById('pauseBtn').addEventListener('click', function() {
879
+ const videoElement = document.getElementById('videoElement');
880
+ if (videoElement.src || videoElement.srcObject) {
881
+ videoElement.pause();
882
+ }
883
+ });
884
+
885
+ document.getElementById('muteBtn').addEventListener('click', function() {
886
+ const videoElement = document.getElementById('videoElement');
887
+ const muteBtn = document.getElementById('muteBtn');
888
+
889
+ if (videoElement.src || videoElement.srcObject) {
890
+ videoElement.muted = !videoElement.muted;
891
+ muteBtn.innerHTML = videoElement.muted ?
892
+ '<i class="fas fa-volume-mute mr-2"></i> Unmute' :
893
+ '<i class="fas fa-volume-up mr-2"></i> Mute';
894
+ }
895
+ });
896
+
897
+ // Initialize
898
+ updateFinalUrl();
899
+ </script>
900
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Altafo/stream-guru" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
901
+ </html>