Skip to content

Commit

Permalink
update buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
firofame committed Jul 6, 2024
1 parent f017598 commit 03b2616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions youtube-player.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const iframe = document.getElementById('youtube-iframe');
const buttons = document.querySelectorAll('#button-container button');
let buttons = document.querySelectorAll('#button-container button');

async function loadPlaylist() {
const response = await fetch('playlist.json');
const playlist = await response.json();

function changeChannel(channelId) {
console.log(`Changing channel to ${channelId}`);
iframe.src = `https://www.youtube.com/embed/live_stream?channel=${channelId}&autoplay=1`;
localStorage.setItem('lastChannel', channelId);
updateActiveButton(channelId);
Expand All @@ -29,6 +28,7 @@ async function loadPlaylist() {
button.addEventListener('click', () => changeChannel(channel.channel_id));
buttonContainer.appendChild(button);
});
buttons = document.querySelectorAll('#button-container button');
}

loadPlaylist();

0 comments on commit 03b2616

Please sign in to comment.