Fix playlist bug
This commit is contained in:
@ -14,6 +14,9 @@ const gameStates = {};
|
||||
|
||||
const initializeGameState = (roomId) => {
|
||||
if (!gameStates[roomId]) {
|
||||
const selectedPlaylist = roomController.getWinningPlaylist(roomId);
|
||||
console.log(`Initializing game with winning playlist: ${selectedPlaylist}`);
|
||||
|
||||
gameStates[roomId] = {
|
||||
round: 0,
|
||||
phase: 'waiting',
|
||||
@ -29,6 +32,7 @@ const initializeGameState = (roomId) => {
|
||||
guessing: 10
|
||||
},
|
||||
lastFrequency: 440,
|
||||
selectedPlaylist: selectedPlaylist,
|
||||
};
|
||||
|
||||
const users = roomController.getRoomUsers(roomId);
|
||||
@ -82,7 +86,8 @@ const determineNextComposer = (roomId, gameState, users) => {
|
||||
// Then modify the selectSongAndOptions function to use the shuffle:
|
||||
const selectSongAndOptions = async (gameState) => {
|
||||
try {
|
||||
const availableIds = await youtubeService.getAvailableSongIds();
|
||||
console.log(`Fetching songs from playlist: ${gameState.selectedPlaylist}`);
|
||||
const availableIds = await youtubeService.getAvailableSongIds(gameState.selectedPlaylist);
|
||||
|
||||
if (!availableIds || availableIds.length === 0) {
|
||||
console.error("No song IDs available for selection");
|
||||
|
Reference in New Issue
Block a user