-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplyr.html
More file actions
705 lines (629 loc) · 23.4 KB
/
Copy pathplyr.html
File metadata and controls
705 lines (629 loc) · 23.4 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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0">
<meta name="description" content="Stay updated with the latest sports news, live match scores, expert analysis, and exclusive updates from the world of football, cricket, and more on Khela.pro.bd. Your ultimate destination for comprehensive sports coverage.">
<meta name="keywords" content="FIFA World Cup 2026, ফিফা বিশ্বকাপ ২০২৬, 2026 World Cup, FIFA 2026 schedule, বিশ্বকাপ ফুটবল ২০২৬, host countries 2026, World Cup matches, football tournament 2026, Argentina football, Brazil football, Lionel Messi 2026, Cristiano Ronaldo, World Cup venues, USA Mexico Canada 2026, football world cup news, live football update">
<title>Khela - Live FIFA WorldCup</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap" rel="stylesheet">
<meta property="og:image" content="./assets/social.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="Stream live world television and curated event playlists." />
<link rel="manifest" href="manifest.json">
<link rel="icon" type="image/x-icon" href="./assets/favicon.ico">
<link rel="icon" type="image/png" href="./assets/favicon.png">
<link rel="icon" type="image/svg+xml" href="./assets/favicon.svg">
<link rel="apple-touch-icon" href="./assets/apple-touch-icon.png">
<!-- Google Material Symbols Outlined -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<!-- Plyr Player CSS -->
<link rel="stylesheet" href="https://cdn.plyr.io/3.8.4/plyr.css" />
<style>
* { margin:0; padding:0; box-sizing:border-box; }
body {
background: #0f172a;
min-height:100vh;
font-family:'Inter', system-ui, -apple-system, sans-serif;
color:#f8fafc;
overflow-x: hidden;
}
/* Custom CSS variables to skin Plyr to match Khela brand identity */
:root {
--plyr-color-main: #a855f7; /* Brand Purple */
}
.plyr {
width: 100%;
height: 100%;
border-radius: 0px; /* Adapts cleanly inside the premium card wrapper */
}
/* Material Icons specific adjustments */
.material-symbols-outlined {
vertical-align: middle;
font-size: 20px;
}
.material-symbols-outlined.spin {
animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
/* Base Layout Structure */
.app-container {
display: flex;
min-height: 100vh;
flex-direction: column;
}
/* Header & Search Bar (Fixed Layout) */
.top-bar {
background: rgba(15, 23, 42, 0.8);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
padding: 16px 40px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
position: sticky;
top: 0;
z-index: 98;
}
.brand-logo {
font-size: 1.5rem;
font-weight: 800;
letter-spacing: -0.5px;
background: linear-gradient(135deg, #a855f7, #3b82f6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 10px;
}
.brand-logo .material-symbols-outlined {
color: #a855f7; /* Provide fallback color since text-fill transparent affects icons sometimes */
font-size: 28px;
-webkit-text-fill-color: initial;
}
.search-box {
position: relative;
width: 380px;
margin: 0 20px;
}
.search-box input {
width: 100%;
padding: 11px 16px 11px 42px;
background: #1e293b;
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 12px;
color: #fff;
font-size: 0.9rem;
outline: none;
transition: all 0.3s ease;
}
.search-box input:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-box .material-symbols-outlined {
position: absolute;
left: 14px;
top: 50%;
transform: translateY(-50%);
color: #64748b;
}
.live-badge-glow {
background: linear-gradient(135deg, #ef4444, #b91c1c);
color: #fff;
font-size: 0.8rem;
font-weight: 700;
padding: 8px 16px;
border-radius: 20px;
display: flex;
align-items: center;
gap: 6px;
animation: pulseGlow 2s infinite;
box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
white-space: nowrap;
}
.live-badge-glow .material-symbols-outlined {
font-size: 14px;
}
@keyframes pulseGlow {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(0.96); opacity: 0.85; }
}
.main-wrapper {
flex: 1;
display: flex;
flex-direction: column;
}
.dashboard-grid {
padding: 32px 40px;
display: grid;
grid-template-columns: 66% 34%;
gap: 32px;
max-width: 1600px;
width: 100%;
margin: 0 auto;
}
/* Left Content Block: Video Station */
.theater-block {
display: flex;
flex-direction: column;
}
.premium-card {
background: #1e293b;
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 16px;
overflow: hidden;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.card-header-panel {
background: #161e2e;
padding: 16px 24px;
font-size: 1rem;
font-weight: 700;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.stream-title {
display: flex;
align-items: center;
gap: 10px;
}
.stream-title .material-symbols-outlined { color: #a855f7; }
.media-container {
width: 100%;
aspect-ratio: 16/9;
background: #000;
position: relative;
}
/* Secure Fallback Layer */
.ns-fallback {
position: absolute;
inset: 0;
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(15, 23, 42, 0.98);
text-align: center;
padding: 40px;
z-index: 10;
}
.ns-fallback.show { display: flex; }
.ns-fallback p {
color: #f1f5f9;
font-size: 1.1rem;
font-weight: 600;
line-height: 1.6;
max-width: 80%;
}
.ns-fallback .material-symbols-outlined {
font-size: 3rem;
color: #f43f5e;
margin-bottom: 16px;
}
/* Streaming Broadcast Details Box */
.stream-details-box {
margin-top: 20px;
background: rgba(30, 41, 59, 0.5);
border: 1px solid rgba(255, 255, 255, 0.03);
padding: 20px;
border-radius: 16px;
}
.stream-details-box h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.meta-status-line { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: #a855f7; font-weight: 600; }
/* Right Content Block: Network Channels Deck */
.channels-hub {
background: rgba(30, 41, 59, 0.6);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 16px;
padding: 24px;
height: fit-content;
}
.hub-title {
font-size: 1.1rem;
font-weight: 700;
color: #fff;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.hub-title .material-symbols-outlined { color: #3b82f6; }
/* GRID LAYOUT FOR CHANNELS */
.channels-list-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 16px;
max-height: 520px;
overflow-y: auto;
padding-right: 8px;
padding-bottom: 10px;
}
.channels-list-container::-webkit-scrollbar { width: 6px; }
.channels-list-container::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 10px; }
/* Grid Channel Card Element */
.channel-card {
background: #1e293b;
border: 1px solid rgba(255, 255, 255, 0.03);
border-radius: 14px;
padding: 20px 12px;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
gap: 12px;
}
.channel-card:hover {
background: rgba(30, 41, 59, 0.9);
border-color: rgba(168, 85, 247, 0.4);
transform: translateY(-4px);
box-shadow: 0 10px 20px -5px rgba(0,0,0,0.3);
}
.channel-card.active {
background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(59, 130, 246, 0.12));
border-color: #a855f7;
}
/* Updated avatar class to support img element with object-fit */
.channel-icon-avatar {
width: 80px;
height: 45px;
border-radius: 8px;
object-fit: contain;
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.channel-name-title {
font-weight: 700;
font-size: 0.95rem;
color: #fff;
}
.channel-card.active .channel-name-title { color: #a855f7; }
.channel-badge-status {
font-size: 0.65rem;
font-weight: 800;
padding: 4px 10px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.05);
color: #94a3b8;
letter-spacing: 0.5px;
}
.channel-card.active .channel-badge-status {
background: rgba(168, 85, 247, 0.2);
color: #a855f7;
}
/* Responsive Adaptability Breakpoints */
@media (max-width: 992px) {
.dashboard-grid {
grid-template-columns: 100%;
padding: 20px 16px;
gap: 24px;
}
.top-bar { padding: 16px 20px; flex-wrap: wrap; gap: 16px; justify-content: center; }
.search-box { width: 100%; order: 3; margin: 0; }
.brand-logo { order: 1; }
.live-badge-glow { order: 2; }
}
@media (max-width: 480px) {
.channels-list-container {
grid-template-columns: repeat(2, 1fr);
}
}
</style>
</head>
<body>
<div class="app-container">
<main class="main-wrapper">
<header class="top-bar">
<div class="brand-logo">
<span class="material-symbols-outlined">play_circle</span> Khela
</div>
</header>
<div class="dashboard-grid">
<div class="theater-block">
<div class="premium-card">
<!-- The container where dynamic Plyr Player container will be injected dynamically -->
<div class="media-container" id="mediaContainer">
<div class="ns-fallback" id="nsFallback">
<span class="material-symbols-outlined">error</span>
<p>This channel is experiencing loading issues. Please click the channel button again to reconnect, or select an alternative channel.</p>
</div>
</div>
</div>
<div class="stream-details-box">
<h2>World Cup Event Live Broadcast</h2>
<div class="meta-status-line" id="statusMsg">
<span class="material-symbols-outlined spin">sync</span> Initializing digital pipeline matrix...
</div>
</div>
</div>
<div class="channels-hub">
<div class="hub-title"><span class="material-symbols-outlined">format_list_bulleted</span> CHANNELS MATRIX</div>
<div class="channels-list-container" id="channelsList">
<div class="channel-card active" data-url="https://kazimmt.ami.bd/playlist/TF/TF-1.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/53aSeDH.png" alt="TOFFEE 1 Icon">
<div class="channel-name-title">TOFFEE 1</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://kazimmt.ami.bd/playlist/TF/TF-2.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/53aSeDH.png" alt="TOFFEE 2 Icon">
<div class="channel-name-title">TOFFEE 2</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://kazimmt.ami.bd/playlist/TF/TF-3.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/53aSeDH.png" alt="TOFFEE 3 Icon">
<div class="channel-name-title">TOFFEE 3</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://kazimmt.ami.bd/playlist/TF/TF-4.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/53aSeDH.png" alt="TOFFEE 4 Icon">
<div class="channel-name-title">TOFFEE 4</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://kazimmt.ami.bd/playlist/TF/TF-5.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/53aSeDH.png" alt="TOFFEE 5 Icon">
<div class="channel-name-title">TOFFEE 5</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://live.wxinxi.com/live/25816724_sb2maw7iluj1ghr92sk5siud28tpimx0.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/B059UW2.png" alt="CCTV 5 Icon">
<div class="channel-name-title">CCTV 5</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://kazimmt.ami.bd/playlist/TF/bdaus.m3u.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/UspLV8i.png" alt="BD VS AUS Icon">
<div class="channel-name-title">BD VS AUS</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://streamtv.panthomashreky6.workers.dev/https/d1211whpimeups.cloudfront.net/smil:rtbgo/chunklist_b4096000_slENG.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/uDz3H80.png" alt="GO Live Icon">
<div class="channel-name-title">GO LIVE 1</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
<div class="channel-card" data-url="https://d1211whpimeups.cloudfront.net/smil:rtbgo/chunklist.m3u8" onclick="play(this.dataset.url, this)">
<img class="channel-icon-avatar" src="https://i.imgur.com/uDz3H80.png" alt="GO Live Icon">
<div class="channel-name-title">GO LIVE 2</div>
<div class="channel-badge-status">ULTRA HD</div>
</div>
</div>
</div>
</div>
</main>
</div>
<!-- Essential streaming engine dependencies -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.4.12/hls.min.js"></script>
<!-- Imported Plyr Player CDN engine -->
<script src="https://cdn.plyr.io/3.8.4/plyr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/disable-devtool@latest/disable-devtool.min.js"></script>
<script>
try {
if (typeof DisableDevtool !== 'undefined') {
DisableDevtool();
}
} catch (error) {
console.warn('Devtool block could not be initialized:', error);
}
var PROXY = 'https://billowing-dawn-ee85.opkawsar156.workers.dev/?url=';
var hls=null, plyrInstance=null, msg=document.getElementById('statusMsg');
var fallback=document.getElementById('nsFallback');
var container=document.getElementById('mediaContainer');
var currentUrl='';
function showFallback(url){
currentUrl=url;
fallback.classList.add('show');
msg.innerHTML='<span class="material-symbols-outlined" style="color:#ef4444;">warning</span> Stream cluster pipeline execution failed.';
}
function hideFallback(){
fallback.classList.remove('show');
}
function play(rawUrl, btn, isDirect){
document.querySelectorAll('.channel-card').forEach(function(b){ b.classList.remove('active'); });
if(btn) btn.classList.add('active');
currentUrl=rawUrl;
// Detect if the target stream is a Go Live Cloudfront / RTBGO channel
var isGoLive = rawUrl.toLowerCase().includes("cloudfront.net") || rawUrl.toLowerCase().includes("rtbgo");
var useProxy = !isGoLive;
var url = useProxy ? (PROXY + encodeURIComponent(rawUrl)) : rawUrl;
msg.innerHTML='<span class="material-symbols-outlined spin">sync</span> Mounting broadcast data streams...';
hideFallback();
// 1. Destroy and cleanup hls.js player if active
if(hls){
try { hls.destroy(); } catch(e){}
hls=null;
}
// 2. Destroy and cleanup Plyr Player instance if active
if (plyrInstance) {
try { plyrInstance.destroy(); } catch(e){}
plyrInstance = null;
}
// 3. Clear dynamically generated player elements inside the media container
var oldPlyrPlayer = document.getElementById('plyrPlayer');
if (oldPlyrPlayer) oldPlyrPlayer.remove();
// 4. Inject a clean, unified, unblocked Video Element
var videoEl = document.createElement('video');
videoEl.id = 'plyrPlayer';
videoEl.controls = true;
videoEl.playsInline = true;
videoEl.autoplay = true;
videoEl.muted = true; // Essential to bypass modern browser autoplay blocking mechanisms
videoEl.setAttribute('muted', '');
videoEl.style.width = '100%';
videoEl.style.height = '100%';
videoEl.style.display = 'block';
container.insertBefore(videoEl, fallback);
// Initialize Plyr workflow for the channel
playWithPlyr(url, rawUrl, videoEl);
}
// Play workflow using Plyr Player with dynamic HLS quality selection bridge
function playWithPlyr(url, rawUrl, videoEl) {
if (Hls.isSupported()) {
// Optimized low-latency fast-start profile for instant loading
hls = new Hls({
enableWorker: true,
lowLatencyMode: true,
backBufferLength: 0,
liveSyncDurationCount: 2, // Force player closer to the live edge instantly
maxBufferLength: 5, // Minimize buffer length to start playing right away
maxMaxBufferLength: 10,
maxBufferSize: 8 * 1024 * 1024, // Keep buffer footprint light for immediate startup
manifestLoadingMaxRetry: 3,
levelLoadingMaxRetry: 3,
fragLoadingMaxRetry: 3
});
hls.loadSource(url);
hls.attachMedia(videoEl);
hls.on(Hls.Events.MANIFEST_PARSED, function() {
// Fetch available stream heights (e.g. [360, 480, 720, 1080])
const availableQualities = hls.levels.map((l) => l.height).filter(h => h !== undefined);
const plyrOptions = {
controls: [
'play-large',
'play',
'progress',
'current-time',
'mute',
'volume',
'settings',
'fullscreen'
],
settings: ['quality', 'speed'],
autoplay: true,
muted: true, // Sync with HTML5 video node state to bypass autoplay blocks
keyboard: { global: true, focused: true }
};
// Map quality switch triggers directly if multiple qualities are found
if (availableQualities.length > 1) {
plyrOptions.quality = {
default: 0, // Auto
options: [0, ...availableQualities],
forced: true,
onChange: function(newQuality) {
if (newQuality === 0) {
hls.currentLevel = -1; // Set to hls.js auto quality level
msg.innerHTML = '<span class="material-symbols-outlined" style="color:#10b981;">check_circle</span> Streaming Engine Live (Plyr) · Auto Quality';
} else {
hls.levels.forEach((level, levelIndex) => {
if (level.height === newQuality) {
hls.currentLevel = levelIndex;
msg.innerHTML = '<span class="material-symbols-outlined" style="color:#10b981;">check_circle</span> Streaming Engine Live (Plyr) · ' + newQuality + 'p Quality';
}
});
}
}
};
plyrOptions.i18n = {
qualityLabel: 'Quality',
qualityLevels: {
0: 'Auto'
}
};
}
// Initialize Plyr Customizer
plyrInstance = new Plyr(videoEl, plyrOptions);
plyrInstance.on('ready', function() {
msg.innerHTML = '<span class="material-symbols-outlined" style="color:#10b981;">check_circle</span> Streaming Engine Live (Plyr) · Pipeline Active';
// Muted trigger logic to start feed rendering immediately
plyrInstance.play().catch(function() {
msg.innerHTML = '<span class="material-symbols-outlined">play_arrow</span> Buffer Ready. Tap player to start.';
});
hideFallback();
});
plyrInstance.on('error', function() {
showFallback(rawUrl);
});
});
hls.on(Hls.Events.ERROR, function(e, d) {
if (d.fatal) {
console.log('HLS fatal network exceptions on Plyr engine:', d.type, d.details);
showFallback(rawUrl);
}
});
} else if (videoEl.canPlayType('application/vnd.apple.mpegurl')) {
// Safari / iOS Native HLS Handler
videoEl.src = url;
plyrInstance = new Plyr(videoEl, {
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'fullscreen'],
autoplay: true,
muted: true
});
plyrInstance.on('ready', function() {
msg.innerHTML = '<span class="material-symbols-outlined" style="color:#10b981;">check_circle</span> Streaming Engine Live (Plyr) · Pipeline Active';
plyrInstance.play().catch(function() {
msg.innerHTML = '<span class="material-symbols-outlined">play_arrow</span> Buffer Ready. Tap player to start.';
});
hideFallback();
});
videoEl.onerror = function() {
showFallback(rawUrl);
};
} else {
showFallback(rawUrl);
}
}
// Initial default deployment node bootstrap
// Fetch the default card and play its assigned URL
window.addEventListener('DOMContentLoaded', () => {
const defaultCard = document.querySelector('.channel-card.active');
if(defaultCard && defaultCard.dataset.url) {
play(defaultCard.dataset.url, defaultCard);
}
// Fetch external M3U and append channels
fetch('https://raw.githubusercontent.com/srhady/tapmad-bd/refs/heads/main/tapmad_bd.m3u')
.then(response => response.text())
.then(data => {
const lines = data.split('\n');
const channelsContainer = document.getElementById('channelsList');
let currentChannel = {};
for (let i = 0; i < lines.length; i++) {
let line = lines[i].trim();
// Parse metadata line
if (line.startsWith('#EXTINF:')) {
// Extract logo URL
const logoMatch = line.match(/tvg-logo=["']?([^"']+)["']?/);
currentChannel.logo = logoMatch ? logoMatch[1] : 'https://i.imgur.com/53aSeDH.png';
// Extract channel name (comes after the comma)
const nameMatch = line.split(',').pop();
currentChannel.name = nameMatch ? nameMatch.trim() : 'Unknown Channel';
}
// Parse URL line (not a comment, not empty)
else if (line !== '' && !line.startsWith('#')) {
currentChannel.url = line;
// Create new channel card
const card = document.createElement('div');
card.className = 'channel-card';
card.dataset.url = currentChannel.url;
card.onclick = function() { play(this.dataset.url, this); };
card.innerHTML = `
<img class="channel-icon-avatar" src="${currentChannel.logo}" alt="${currentChannel.name} Icon" onerror="this.src='https://i.imgur.com/53aSeDH.png'">
<div class="channel-name-title">${currentChannel.name}</div>
<div class="channel-badge-status">ULTRA HD</div>
`;
// Append to the end of the container
channelsContainer.appendChild(card);
// Reset for the next channel
currentChannel = {};
}
}
})
.catch(error => {
console.error('Failed to load external M3U playlist:', error);
});
});
</script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('./sw.js')
.then(registration => console.log('ServiceWorker registration successful with scope: ', registration.scope), err => console.log('ServiceWorker registration failed: ', err));
});
}
</script>
</body>
</html>