// 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 = `