Add custom playlists
This commit is contained in:
@ -308,4 +308,24 @@ module.exports = (io) => (socket) => {
|
||||
socket.emit("playlist-songs", { songs: youtubeService.getDefaultSongs() });
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("get-playlist-options", async () => {
|
||||
try {
|
||||
const playlists = await youtubeService.getPlaylistDetails();
|
||||
socket.emit("playlist-options", playlists);
|
||||
} catch (error) {
|
||||
console.error("Error fetching playlist options:", error);
|
||||
socket.emit("error", { message: "Failed to load playlists" });
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("vote-playlist", ({ playlistId }) => {
|
||||
const roomId = roomController.getUserRoom(socket.id);
|
||||
if (!roomId) return;
|
||||
|
||||
if (roomController.voteForPlaylist(roomId, socket.id, playlistId)) {
|
||||
const votes = roomController.getPlaylistVotes(roomId);
|
||||
io.to(roomId).emit("playlist-votes-updated", votes);
|
||||
}
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user