Skip to content

Commit f3b5343

Browse files
committed
mod code for livestream app route - 1
1 parent 62382d4 commit f3b5343

File tree

1 file changed

+73
-71
lines changed

1 file changed

+73
-71
lines changed

client/src/app/live/page.tsx

Lines changed: 73 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -214,107 +214,105 @@ function VideoPlayer({
214214
}, [hidden]);
215215

216216
return (
217-
<div
217+
<div
218218
className={`relative transition-all duration-700 ease-out transform ${
219-
hidden
220-
? 'opacity-0 scale-95 pointer-events-none absolute'
221-
: 'opacity-100 scale-100'
219+
hidden ? "opacity-0 scale-95 pointer-events-none absolute" : "opacity-100 scale-100"
222220
}`}
223221
style={{ display: hidden ? "none" : "block" }}
224222
>
225223
<div className="relative overflow-hidden rounded-2xl bg-gradient-to-br from-gray-900 via-gray-800 to-black shadow-2xl dark:from-gray-950 dark:via-gray-900 dark:to-gray-800">
226-
{/* Stream info overlay */}
227-
<div className="absolute top-4 left-4 z-20 flex items-center gap-3">
228-
<div
229-
className={`flex items-center gap-2 px-3 py-1.5 rounded-full backdrop-blur-sm ${
230-
hasError ? "bg-gray-500/80" : "bg-red-500/90"
231-
}`}
232-
>
224+
225+
{/* Stream info overlay */}
226+
<div className="absolute top-4 left-4 z-20 flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3">
233227
<div
234-
className={`w-2 h-2 rounded-full ${
235-
hasError ? "bg-red-600 animate-none" : "bg-emerald-400 animate-pulse"
228+
className={`flex items-center gap-2 px-3 py-1.5 rounded-full backdrop-blur-sm ${
229+
hasError ? "bg-gray-500/80" : "bg-red-500/90"
236230
}`}
237-
></div>
238-
<span className={`text-sm font-medium ${hasError ? "text-white" : "text-emerald"}`}>
239-
{hasError ? "OFFLINE" : "LIVE"}
240-
</span>
241-
</div>
242-
243-
<div className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/40 backdrop-blur-sm text-white/90 dark:bg-white/10 dark:text-gray-200">
244-
<Users size={14} />
231+
>
232+
<div
233+
className={`w-2 h-2 rounded-full ${
234+
hasError ? "bg-red-600 animate-none" : "bg-emerald-400 animate-pulse"
235+
}`}
236+
></div>
237+
<span className={`text-xs sm:text-sm font-medium ${hasError ? "text-white" : "text-emerald"}`}>
238+
{hasError ? "OFFLINE" : "LIVE"}
239+
</span>
240+
</div>
241+
242+
<div className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/40 backdrop-blur-sm text-white/90 dark:bg-white/10 dark:text-gray-200 text-xs sm:text-sm">
243+
<Users size={14} />
244+
</div>
245245
</div>
246-
</div>
247-
246+
248247
{/* Stream quality badge */}
249248
<div className="absolute top-4 right-4 z-20">
250-
<div className="px-3 py-1.5 rounded-full bg-sky-500/90 backdrop-blur-sm text-white text-sm font-medium">
249+
<div className="px-2 sm:px-3 py-1 rounded-full bg-sky-500/90 backdrop-blur-sm text-white text-xs sm:text-sm font-medium">
251250
{streamType.toUpperCase()}
252251
</div>
253252
</div>
254-
253+
255254
{/* Video container */}
256-
<div className="relative aspect-video bg-gradient-to-br from-gray-800 to-gray-900 dark:from-gray-900 dark:to-black">
255+
<div className="relative aspect-video sm:aspect-[16/9] bg-gradient-to-br from-gray-800 to-gray-900 dark:from-gray-900 dark:to-black">
257256
{isLoading && (
258257
<div className="absolute inset-0 flex items-center justify-center bg-gray-900 dark:bg-black">
259258
<div className="text-center">
260-
<div className="w-16 h-16 border-4 border-sky-500/30 border-t-sky-500 rounded-full animate-spin mx-auto mb-4"></div>
261-
<p className="text-white/80 text-lg font-medium dark:text-gray-300">Connecting to stream...</p>
262-
<p className="text-white/50 text-sm mt-1 dark:text-gray-400">Initializing {streamType.toUpperCase()} player</p>
259+
<div className="w-12 h-12 sm:w-16 sm:h-16 border-4 border-sky-500/30 border-t-sky-500 rounded-full animate-spin mx-auto mb-2 sm:mb-4"></div>
260+
<p className="text-white/80 text-sm sm:text-lg font-medium dark:text-gray-300">Connecting to stream...</p>
261+
<p className="text-white/50 text-xs sm:text-sm mt-1 dark:text-gray-400">Initializing {streamType.toUpperCase()} player</p>
263262
</div>
264263
</div>
265264
)}
266-
267-
<video
268-
ref={videoRef}
269-
className="video-js vjs-default-skin w-full h-full"
270-
data-setup="{}"
271-
/>
265+
<video ref={videoRef} className="video-js vjs-default-skin w-full h-full" data-setup="{}" />
272266
</div>
273-
267+
274268
{/* Bottom gradient overlay */}
275-
<div className="absolute bottom-0 left-0 right-0 h-32 bg-gradient-to-t from-black/60 to-transparent pointer-events-none dark:from-black/80"></div>
269+
<div className="absolute bottom-0 left-0 right-0 h-24 sm:h-32 bg-gradient-to-t from-black/60 to-transparent pointer-events-none dark:from-black/80"></div>
276270
</div>
277-
271+
278272
{/* Stream stats */}
279-
<div className="mt-6 grid grid-cols-3 gap-4">
280-
<div className="bg-gradient-to-br from-blue-500/10 to-blue-600/5 border border-blue-500/20 rounded-xl p-4 backdrop-blur-sm dark:from-blue-900/30 dark:to-blue-800/10 dark:border-blue-500/30">
281-
<div className="flex items-center gap-3">
282-
<div className="p-2 bg-blue-500/20 rounded-lg">
283-
<Signal size={20} className="text-blue-400" />
273+
<div className="mt-4 sm:mt-6 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4">
274+
{/* Quality */}
275+
<div className="bg-gradient-to-br from-blue-500/10 to-blue-600/5 border border-blue-500/20 rounded-xl p-3 sm:p-4 backdrop-blur-sm dark:from-blue-900/30 dark:to-blue-800/10 dark:border-blue-500/30">
276+
<div className="flex items-center gap-2 sm:gap-3">
277+
<div className="p-2 sm:p-2.5 bg-blue-500/20 rounded-lg">
278+
<Signal size={18} className="text-blue-400" />
284279
</div>
285280
<div>
286-
<p className="text-slate-800/90 font-medium dark:text-gray-200">Quality</p>
287-
<p className="text-slate-800/60 text-sm dark:text-gray-400">1080p HD</p>
281+
<p className="text-slate-800/90 font-medium text-sm sm:text-base dark:text-gray-200">Quality</p>
282+
<p className="text-slate-800/60 text-xs sm:text-sm dark:text-gray-400">1080p HD</p>
288283
</div>
289284
</div>
290285
</div>
291-
292-
<div className="bg-gradient-to-br from-green-500/10 to-green-600/5 border border-green-500/20 rounded-xl p-4 backdrop-blur-sm dark:from-green-900/30 dark:to-green-800/10 dark:border-green-500/30">
293-
<div className="flex items-center gap-3">
294-
<div className="p-2 bg-green-500/20 rounded-lg">
295-
<Zap size={20} className="text-green-400" />
286+
287+
{/* Latency */}
288+
<div className="bg-gradient-to-br from-green-500/10 to-green-600/5 border border-green-500/20 rounded-xl p-3 sm:p-4 backdrop-blur-sm dark:from-green-900/30 dark:to-green-800/10 dark:border-green-500/30">
289+
<div className="flex items-center gap-2 sm:gap-3">
290+
<div className="p-2 sm:p-2.5 bg-green-500/20 rounded-lg">
291+
<Zap size={18} className="text-green-400" />
296292
</div>
297293
<div>
298-
<p className="text-slate-800/90 font-medium dark:text-gray-200">Latency</p>
299-
<p className="text-slate-800/60 text-sm dark:text-gray-400">&le;2.3s</p>
294+
<p className="text-slate-800/90 font-medium text-sm sm:text-base dark:text-gray-200">Latency</p>
295+
<p className="text-slate-800/60 text-xs sm:text-sm dark:text-gray-400">&le;2.3s</p>
300296
</div>
301297
</div>
302298
</div>
303-
304-
<div className="bg-gradient-to-br from-sky-500/10 to-sky-600/5 border border-sky-500/20 rounded-xl p-4 backdrop-blur-sm dark:from-sky-900/30 dark:to-sky-800/10 dark:border-sky-500/30">
305-
<div className="flex items-center gap-3">
306-
<div className="p-2 bg-sky-500/20 rounded-lg">
307-
<Radio size={20} className="text-sky-400" />
299+
300+
{/* Bitrate */}
301+
<div className="bg-gradient-to-br from-sky-500/10 to-sky-600/5 border border-sky-500/20 rounded-xl p-3 sm:p-4 backdrop-blur-sm dark:from-sky-900/30 dark:to-sky-800/10 dark:border-sky-500/30">
302+
<div className="flex items-center gap-2 sm:gap-3">
303+
<div className="p-2 sm:p-2.5 bg-sky-500/20 rounded-lg">
304+
<Radio size={18} className="text-sky-400" />
308305
</div>
309306
<div>
310-
<p className="text-slate-800/90 font-medium dark:text-gray-200">Bitrate</p>
311-
<p className="text-slate-800/60 text-sm dark:text-gray-400">&ge;4.2 Mbps</p>
307+
<p className="text-slate-800/90 font-medium text-sm sm:text-base dark:text-gray-200">Bitrate</p>
308+
<p className="text-slate-800/60 text-xs sm:text-sm dark:text-gray-400">&ge;4.2 Mbps</p>
312309
</div>
313310
</div>
314311
</div>
315312
</div>
316313
</div>
317314
);
315+
318316
}
319317

320318
export default function LivePage() {
@@ -346,31 +344,32 @@ export default function LivePage() {
346344
</div>
347345

348346
{/* Protocol Selector */}
349-
<div className="flex justify-center items-center gap-4 mb-12">
350-
<div className="bg-gray-200/50 backdrop-blur-lg rounded-2xl p-2 border border-gray-300 dark:bg-gray-800/50 dark:border-gray-700">
351-
<div className="flex gap-2">
347+
<div className="flex flex-col sm:flex-row justify-center items-center gap-4 mb-12">
348+
<div className="bg-gray-200/50 backdrop-blur-lg rounded-2xl p-2 border border-gray-300 dark:bg-gray-800/50 dark:border-gray-700 w-full sm:w-auto">
349+
<div className="flex flex-col sm:flex-row gap-2">
352350
<button
353351
onClick={() => setActiveTab("hls")}
354-
className={`px-8 py-4 rounded-xl font-medium transition-all duration-300 ${
352+
className={`px-4 py-2 sm:px-8 sm:py-4 rounded-xl font-medium transition-all duration-300 w-full sm:w-auto ${
355353
activeTab === "hls"
356354
? "bg-gradient-to-r from-blue-600 to-sky-500 text-white shadow-lg shadow-sky-500/25 dark:shadow-sky-500/30"
357355
: "text-gray-600 hover:text-gray-800 hover:bg-gray-300/50 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700"
358356
}`}
359357
>
360-
<div className="flex items-center gap-2">
358+
<div className="flex items-center justify-center gap-2 text-sm sm:text-base">
361359
<Play size={18} />
362360
HLS Stream
363361
</div>
364362
</button>
363+
365364
<button
366365
onClick={() => setActiveTab("dash")}
367-
className={`px-8 py-4 rounded-xl font-medium transition-all duration-300 ${
366+
className={`px-4 py-2 sm:px-8 sm:py-4 rounded-xl font-medium transition-all duration-300 w-full sm:w-auto ${
368367
activeTab === "dash"
369368
? "bg-gradient-to-r from-blue-600 to-sky-500 text-white shadow-lg shadow-sky-500/25 dark:shadow-sky-500/30"
370369
: "text-gray-600 hover:text-gray-800 hover:bg-gray-300/50 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-700"
371370
}`}
372371
>
373-
<div className="flex items-center gap-2">
372+
<div className="flex items-center justify-center gap-2 text-sm sm:text-base">
374373
<Zap size={18} />
375374
DASH Stream
376375
</div>
@@ -379,13 +378,16 @@ export default function LivePage() {
379378
</div>
380379

381380
{/* New StreamInfoPopover component */}
382-
<StreamInfoPopover
383-
hlsUrl={genericHlsUrl}
384-
dashUrl={genericDashUrl}
385-
rtmpServer={rtmpServerUrl}
386-
/>
381+
<div className="w-full sm:w-auto">
382+
<StreamInfoPopover
383+
hlsUrl={genericHlsUrl}
384+
dashUrl={genericDashUrl}
385+
rtmpServer={rtmpServerUrl}
386+
/>
387+
</div>
387388
</div>
388389

390+
389391
{/* Video Players */}
390392
<div className="max-w-6xl mx-auto">
391393
<VideoPlayer

0 commit comments

Comments
 (0)