[READ-ONLY] Mirror of https://github.com/flo-bit/youtube-party-dj. democratic youtube player, everyone can vote and add songs, uni project, made with uix
0

Configure Feed

Select the types of activity you want to include in your feed.

Update VideoPlayer.tsx

author
moritzbarv
committer
GitHub
date (Jun 14, 2024, 4:17 PM +0200) commit e922f084 parent 74d04e59
+8 -8
+8 -8
common/components/VideoPlayer.tsx
··· 1 1 import { Item, removePlayedVideo } from "backend/data.tsx"; 2 - import { nowPlaying } from "backend/data.tsx" 2 + import {nowPlaying} from "backend/data.tsx"; 3 3 4 4 export default function VideoPlayer({ queue }: Readonly<{ queue: Item[] }>) { 5 5 // @ts-ignore - YouTube API 6 6 let player; 7 + 7 8 8 9 function startPlaying() { 9 10 // @ts-ignore - YouTube API ··· 12 13 (!player || player.getPlayerState() !== YT.PlayerState.PLAYING) 13 14 ) { 14 15 play(queue[0].id); 15 - nowPlaying.val = removePlayedVideo(); 16 - 16 + nowPlaying.val = removePlayedVideo(); 17 + 17 18 } 18 19 } 19 20 ··· 21 22 // @ts-ignore - YouTube API 22 23 if (player) { 23 24 player.loadVideoById(videoId); 24 - nowPlaying.val = removePlayedVideo(); 25 - 25 + nowPlaying.val = removePlayedVideo(); 26 26 } else { 27 27 // @ts-ignore - YouTube API 28 28 player = new window.YT.Player("player", { ··· 50 50 function onStateChange(event) { 51 51 // @ts-ignore - YouTube API 52 52 if (event.data === window.YT.PlayerState.ENDED) { 53 - // TODO: remove just played video from queue 54 - removePlayedVideo(); 55 - 53 + 56 54 setTimeout(() => { 57 55 if (queue.length > 0) { 58 56 play(queue[0].id); 59 57 } 60 58 }, 200); 59 + 60 + 61 61 } 62 62 } 63 63