body {
margin: 0;
font-family: Arial, sans-serif;
background: linear-gradient(to bottom right, #f0f0f0, #ffffff);
color: #000;
}
.tbody {
margin: 0;
background-color: #ffffff;
height: auto;
width: 90%;
max-width: auto;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
box-sizing: border-box;
border: 2px solid #cccccc;
border-radius: 12px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s, color 0.3s;
}
nav {
width: 100%;
background: linear-gradient(to right, #0056b3, #003d7a);
overflow: hidden;
border-bottom: 2px solid #003d7a;
margin-bottom: 20px;
}
.nav-link {
float: left;
display: block;
color: #ffffff;
text-align: center;
padding: 16px 20px;
text-decoration: none;
font-size: 16px;
transition: background-color 0.3s;
}
.nav-link:hover {
background-color: #003d7a;
}
.dropdown {
float: left;
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 16px 20px;
background-color: #0056b3;
cursor: pointer;
transition: background-color 0.3s;
}
.dropdown .dropbtn:hover {
background-color: #003d7a;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #ffffff;
min-width: 160px;
box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
border-radius: 8px;
z-index: 1;
border: 1px solid #ddd;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
transition: background-color 0.3s;
}
.dropdown-content a:hover {
background-color: #f0f0f0;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #003d7a;
}
video {
width: 100%;
height: auto;
margin: 20px 0;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.channel-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
background: #ffffff;
border: 1px solid #ddd;
padding: 10px;
box-sizing: border-box;
overflow: scroll;
height: 500px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.channel-item {
display: flex;
flex-direction: column;
align-items: center;
text-decoration: none;
color: #333;
border: 1px solid gray;
border-radius: 8px;
overflow: hidden;
transition: transform 0.3s, box-shadow 0.3s;
background: #fff;
width: 80px;
height: 80px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.channel-item img {
width: 100%;
height: 70%;
border-radius: 10%;
object-fit: cover;
}
.channel-item span {
padding: 0px;
text-align: center;
font-size: 0px;
background: transparent;
}
.channel-item:hover {
transform: scale(1.05);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
input[type="file"] {
margin-bottom: 10px;
}
.dropdown-btn {
background-color: #0056b3;
color: #fff;
padding: 10px 20px;
margin: 0;
font-size: 16px;
border: 2px solid #003d7a;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s, color 0.3s;
}
.dropdown-btn:hover {
background-color: #003d7a;
color: #fff;
}
@media (max-width: 600px) {
.channel-item {
width: 60px;
height: 60px;
}
.dropdown-btn {
padding: 8px 16px;
font-size: 14px;
}
video {
margin: 5px 0;
}
}
@media (max-width: 400px) {
.channel-item {
width: 50px;
height: 50px;
}
.dropdown-btn {
padding: 6px 12px;
font-size: 12px;
}
video {
margin: 5px 0;
}
}
Home
About
Contact
IPTV Player
Your browser does not support the video tag.
document.addEventListener('DOMContentLoaded', () => {
const videoPlayer = document.getElementById('videoPlayer');
const channelList = document.getElementById('channelList');
const fileInput = document.getElementById('fileInput');
const loadFileButton = document.getElementById('loadFile');
// Default M3U URL
const defaultM3UUrl = 'https://iptv-org.github.io/iptv/languages/ara.m3u';
const parseM3U = async (data) => {
const lines = data.split('\n');
const channels = [];
let channel = {};
lines.forEach(line => {
if (line.startsWith('#EXTINF')) {
const nameMatch = line.match(/tvg-name="([^"]+)"/);
const logoMatch = line.match(/tvg-logo="([^"]+)"/);
channel = {
name: nameMatch ? nameMatch[1] : 'Unknown',
logo: logoMatch ? logoMatch[1] : '',
url: null
};
} else if (line.startsWith('http')) {
if (channel) {
channel.url = line;
channels.push(channel);
}
}
});
// Setup channel list
channelList.innerHTML = ''; // Clear current channels
channels.forEach(channel => {
const channelItem = document.createElement('a');
channelItem.href = '#';
channelItem.className = 'channel-item';
channelItem.innerHTML = `
${channel.logo ? `
` : `
`}
${channel.name}
`;
channelItem.addEventListener('click', (e) => {
e.preventDefault();
videoPlayer.src = channel.url;
videoPlayer.play(); // Play video on click
});
channelList.appendChild(channelItem);
});
};
const fetchDefaultPlaylist = async () => {
try {
const response = await fetch
(defaultM3UUrl);
const data = await response.text();
await parseM3U(data);
} catch (error) {
console.error('Error fetching default M3U playlist:', error);
}
};
fetchDefaultPlaylist();
loadFileButton.addEventListener('click', () => {
const file = fileInput.files[0];
if (file) {
const reader = new FileReader();
reader.onload = async (event) => {
const data = event.target.result;
await parseM3U(data);
};
reader.readAsText(file);
} else {
alert('Please select a file first.');
}
});
});