forked from rahul979854/webipTV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
304 lines (262 loc) · 9.65 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>web ipTV</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #222;
color: white;
margin: 0;
padding: 20px;
}
#player-container {
display: flex;
flex-direction: column;
align-items: center;
}
/* Neon glow controlled by CSS variables */
video {
width: 100%;
height: auto;
max-width: 100%;
margin-bottom: 20px;
aspect-ratio: 16/9;
border-radius: 10px;
box-shadow: 0 0 15px var(--neon-color, #00f), 0 0 30px var(--neon-color, #00f),
0 0 45px var(--neon-color, #f0f), 0 0 60px var(--neon-color, #f0f);
transition: box-shadow 0.2s ease;
}
#web-ipTV {
font-size: 30px;
font-weight: bold;
color: transparent;
background: linear-gradient(to right, #ff007f, #ff7f00, #7fff00, #00ff7f, #007fff, #0000ff);
background-clip: text;
-webkit-background-clip: text;
animation: text-gradient 5s infinite;
margin-bottom: 10px;
}
@keyframes text-gradient {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
#search-bar-container {
display: flex;
justify-content: space-between;
width: 100%;
margin: 20px 0;
gap: 0; /* Removed any gap between search bar and neon switch */
}
#search-bar {
width: 80%; /* Adjusted width for better alignment */
padding: 10px;
font-size: 16px;
background-color: rgba(255, 255, 255, 0.1);
border: none;
border-radius: 5px 0 0 5px; /* Rounded edges on the left */
color: white;
backdrop-filter: blur(5px);
transition: background-color 0.3s ease;
}
#search-bar:focus {
outline: none;
background-color: rgba(255, 255, 255, 0.2);
}
#neon-switch {
display: flex;
align-items: center;
width: 20%; /* Adjusted width */
margin-left: 0; /* Removed margin */
}
#neon-toggle {
cursor: pointer;
padding: 10px;
border: 1px solid #555;
border-radius: 0 5px 5px 0; /* Rounded edges on the right */
background-color: rgba(255, 255, 255, 0.1);
color: white;
transition: background-color 0.3s ease, color 0.3s ease;
width: 100%;
text-align: center;
}
#neon-toggle.active {
background-color: green;
color: white;
}
#channel-list-container {
width: 100%;
max-height: 400px;
overflow-y: scroll;
scrollbar-width: thin;
}
#channel-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 15px;
width: 100%;
margin-top: 20px;
}
.channel-tile {
display: flex;
flex-direction: column;
align-items: center;
padding: 10px;
cursor: pointer;
background-color: #333;
border-radius: 10px;
transition: transform 0.2s;
}
.channel-tile:hover {
transform: scale(1.05);
background-color: #444;
}
.channel-tile img {
width: 80px;
height: 80px;
margin-bottom: 10px;
border-radius: 5px;
}
.channel-name {
font-size: 14px;
text-align: center;
}
#loading {
color: yellow;
margin: 20px 0;
display: none;
}
</style>
</head>
<body>
<div id="player-container">
<div id="web-ipTV">web IPTV</div>
<video id="video" controls playsinline autoplay></video>
<div id="search-bar-container">
<input type="text" id="search-bar" placeholder="Search for channels..." onkeyup="filterChannels()">
<div id="neon-switch">
<div id="neon-toggle" class="active" onclick="toggleNeon()">lëd⚡</div>
</div>
</div>
<div id="loading">Loading channels...</div>
<div id="channel-list-container">
<div id="channel-list"></div>
</div>
</div>
<script>
const m3uLink = 'https://raw.githubusercontent.com/rahul979854/iptvfree/main/assess';
const targetUrl = 'http://starshare.live/live/bana/bana/7258.m3u8';
// Neon lights toggle functionality
let neonActive = true;
function toggleNeon() {
const video = document.querySelector('video');
const toggleButton = document.getElementById('neon-toggle');
if (neonActive) {
video.style.boxShadow = 'none';
toggleButton.classList.remove('active');
} else {
video.style.boxShadow = '0 0 15px var(--neon-color, #00f), 0 0 30px var(--neon-color, #00f), 0 0 45px var(--neon-color, #f0f), 0 0 60px var(--neon-color, #f0f)';
toggleButton.classList.add('active');
}
neonActive = !neonActive;
// Haptic feedback for toggle button
if (navigator.vibrate) {
navigator.vibrate(100); // Medium vibration for toggle
}
}
async function fetchM3U() {
try {
const response = await fetch(m3uLink);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.text();
return parseM3U(data);
} catch (error) {
console.error('Error fetching M3U file:', error);
return [];
}
}
function parseM3U(data) {
const channels = [];
const lines = data.split('\n');
let currentChannel = {};
lines.forEach(line => {
line = line.trim();
if (line.startsWith('#EXTINF:')) {
const channelInfo = line.match(/#EXTINF:.*,(.*)/);
currentChannel.name = channelInfo ? channelInfo[1].trim() : 'Unknown Channel';
const logoMatch = line.match(/tvg-logo="(.*?)"/);
currentChannel.logo = logoMatch ? logoMatch[1] : '';
} else if (line.startsWith('http')) {
currentChannel.url = line.trim();
channels.push(currentChannel);
currentChannel = {};
}
});
return channels.filter(channel => channel.url);
}
async function loadChannels() {
const loadingDiv = document.getElementById('loading');
loadingDiv.style.display = 'block'; // Show loading
const channels = await fetchM3U();
loadingDiv.style.display = 'none'; // Hide loading
const channelList = document.getElementById('channel-list');
if (channels.length === 0) {
channelList.innerHTML = '<div>No channels found.</div>';
return;
}
// Search for the specific channel to auto-play
const targetChannel = channels.find(channel => channel.url === targetUrl);
if (targetChannel) {
playChannel(targetChannel.url); // Auto-play the found channel
} else {
// If target URL not found, default to the first channel
playChannel(channels[0].url);
}
channels.forEach(channel => {
const tile = document.createElement('div');
tile.classList.add('channel-tile');
const logoImg = document.createElement('img');
logoImg.src = channel.logo ? channel.logo : 'https://via.placeholder.com/80';
tile.appendChild(logoImg);
const channelName = document.createElement('div');
channelName.classList.add('channel-name');
channelName.textContent = channel.name;
tile.appendChild(channelName);
tile.onclick = () => {
playChannel(channel.url);
};
channelList.appendChild(tile);
});
}
function playChannel(url) {
const video = document.getElementById('video');
video.src = url;
video.play();
}
function filterChannels() {
const searchValue = document.getElementById('search-bar').value.toLowerCase();
const channelTiles = document.querySelectorAll('.channel-tile');
channelTiles.forEach(tile => {
const channelName = tile.querySelector('.channel-name').textContent.toLowerCase();
if (channelName.includes(searchValue)) {
tile.style.display = '';
} else {
tile.style.display = 'none';
}
});
}
// Load the channels when the page is ready
window.onload = () => {
loadChannels();
};
</script>
</body>
</html>