document.addEventListener('DOMContentLoaded', function() { // Define quality URLs for both languages const qualityUrls = { 'hindi': { '1080p': 'https://tv4live.github.io/ID11?id=sts1h', '720p': 'https://anywhere.pwisetthon.com/http://y3fqd48g.megatv.fun/iptv/NRLXRWSBWBPLN4/19146/index.m3u8', '540p': '', '480p': '', '360p': '', '240p': '' }, 'english': { '1080p': 'https://tv4live.github.io/ID6?id=willowtv', '720p': 'https://tv4live.github.io/p6?url=https://anywhere.pwisetthon.com/http://xxip9.top:8080/live/7656691303/chrisbolden765%40icloud.com/58847.m3u8', '540p': '', '480p': '', '360p': '', '240p': ''} , 'telugu': { '1080p':'https://tvgo.neocities.org/APPTV/jspo?id=Star1%20teluguHD', '720p': '', '540p': '', '360p': '', '240p': ''}, 'tamil': { '1080p': 'https://tv4wap.github.io/ID6?id=sts1tamil', '720p': 'https://tv4live.github.io/ID11?id=sts1tamil1', '540p': '', '480p': '', '360p': '', '240p': ''} }; const resBtns = document.querySelectorAll('.btn-res'); const langBtns = document.querySelectorAll('.btn-lang'); const streamIframe = document.getElementById('streamIframe'); let currentLang = 'hindi'; let currentQuality = '1080p'; langBtns.forEach(btn => { btn.addEventListener('click', function() { if (!this.classList.contains('active')) { langBtns.forEach(b => b.classList.remove('active')); this.classList.add('active'); currentLang = this.dataset.lang; updateStream(); } }); }); function updateStream() { streamIframe.src = qualityUrls[currentLang][currentQuality]; } resBtns.forEach(btn => { btn.addEventListener('click', function() { // Only update if this button wasn't already active if (!this.classList.contains('active')) { // Remove active class from all resolution buttons resBtns.forEach(b => b.classList.remove('active')); // Add active class to clicked button this.classList.add('active'); // Update current quality and stream currentQuality = this.dataset.res; updateStream(); } }); }); });