 response.json().then(data => { throw new Error(data.error || 'Unknown error'); });
                        }
                    })
                    .then(data => {
                        console.log('Stream Data:', data);
                        if (data.stream_url) {
                            playChannel(data.stream_url, channelName, channelIcon);
                            document.querySelectorAll('.channel-name').forEach(ch => ch.classList.remove('selected'));
                            channe