File size: 5,484 Bytes
64298b1 3794ab9 0300ff6 3794ab9 0300ff6 64298b1 0300ff6 64298b1 0300ff6 64298b1 0300ff6 64298b1 0300ff6 | 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 |
// Real IPTV channels data with working streams
const iptvChannels = [
{ id: 1, name: 'Al Jazeera', category: 'news', url: 'https://aljazeera-eng-hd-live.hls.adaptive.level3.net/aljazeera/english2/index.m3u8', logo: 'http://static.photos/news/200x200/1' },
{ id: 2, name: 'France 24', category: 'news', url: 'https://static.france24.com/live/F24_EN_LO_HLS/live_web.m3u8', logo: 'http://static.photos/news/200x200/2' },
{ id: 3, name: 'DW English', category: 'news', url: 'https://dwamdstream102.akamaized.net/hls/live/2015525/dwstream102/index.m3u8', logo: 'http://static.photos/news/200x200/3' },
{ id: 4, name: 'NASA TV', category: 'education', url: 'https://ntv1.akamaized.net/hls/live/2014075/NASA-NTV1-HLS/master.m3u8', logo: 'http://static.photos/science/200x200/4' },
{ id: 5, name: 'Bloomberg', category: 'finance', url: 'https://liveproduseast.global.ssl.fastly.net/btv/desktop/us_live.m3u8', logo: 'http://static.photos/finance/200x200/5' },
{ id: 6, name: 'CGTN', category: 'news', url: 'https://live.cgtn.com/1000/prog_index.m3u8', logo: 'http://static.photos/news/200x200/6' },
{ id: 7, name: 'Arirang', category: 'news', url: 'https://amdlive-ch01-ctnd-com.akamaized.net/arirang_1ch/smil:arirang_1ch.smil/playlist.m3u8', logo: 'http://static.photos/news/200x200/7' },
{ id: 8, name: 'NHK World', category: 'news', url: 'https://nhkwlive-xjp.akamaized.net/hls/live/2003458/nhkwlive-xjp-en/index.m3u8', logo: 'http://static.photos/news/200x200/8' },
{ id: 9, name: 'RT News', category: 'news', url: 'https://rt-news.secure.footprint.net/1103.m3u8', logo: 'http://static.photos/news/200x200/9' },
{ id: 10, name: 'Euronews', category: 'news', url: 'https://euronews.alteox.app/hls/euronews_en.m3u8', logo: 'http://static.photos/news/200x200/10' }
];
// Add HLS.js library for better streaming support
document.addEventListener('DOMContentLoaded', () => {
// Load HLS.js if not already loaded
if (typeof Hls === 'undefined') {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/hls.js@latest';
document.head.appendChild(script);
}
const player = document.getElementById('iptv-player');
const channelsGrid = document.getElementById('channels-grid');
const searchInput = document.getElementById('channel-search');
const categoryButtons = document.querySelectorAll('.category-btn');
const playBtn = document.getElementById('play-btn');
const pauseBtn = document.getElementById('pause-btn');
const volumeSlider = document.getElementById('volume-slider');
const fullscreenBtn = document.getElementById('fullscreen-btn');
// Load channels
function loadChannels(filter = '', category = 'all') {
channelsGrid.innerHTML = '';
const filteredChannels = iptvChannels.filter(channel => {
const matchesSearch = channel.name.toLowerCase().includes(filter.toLowerCase());
const matchesCategory = category === 'all' || channel.category === category;
return matchesSearch && matchesCategory;
});
filteredChannels.forEach(channel => {
const channelElement = document.createElement('div');
channelElement.className = 'channel-card';
channelElement.innerHTML = `
<img src="${channel.logo}" alt="${channel.name}" class="channel-logo">
<h3>${channel.name}</h3>
`;
channelElement.addEventListener('click', () => playChannel(channel));
channelsGrid.appendChild(channelElement);
});
}
// Play selected channel
function playChannel(channel) {
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(channel.url);
hls.attachMedia(player);
hls.on(Hls.Events.MANIFEST_PARSED, () => {
player.play();
});
} else if (player.canPlayType('application/vnd.apple.mpegurl')) {
player.src = channel.url;
player.addEventListener('loadedmetadata', () => {
player.play();
});
}
document.title = `IPTV Player - ${channel.name}`;
}
// Search functionality
searchInput.addEventListener('input', (e) => {
loadChannels(e.target.value, document.querySelector('.category-btn.active').dataset.category);
});
// Category filter
categoryButtons.forEach(button => {
button.addEventListener('click', () => {
categoryButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
loadChannels(searchInput.value, button.dataset.category);
});
});
// Player controls
playBtn.addEventListener('click', () => player.play());
pauseBtn.addEventListener('click', () => player.pause());
volumeSlider.addEventListener('input', (e) => {
player.volume = e.target.value;
});
fullscreenBtn.addEventListener('click', () => {
if (player.requestFullscreen) {
player.requestFullscreen();
} else if (player.webkitRequestFullscreen) {
player.webkitRequestFullscreen();
}
});
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
if (e.code === 'Space') {
e.preventDefault();
player.paused ? player.play() : player.pause();
}
});
// Initialize
loadChannels();
}); |