alpha
Login
or
Join now
flo-bit.dev
/
youtube-party-dj
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[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
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Update VideoPlayer.tsx
author
moritzbarv
committer
GitHub
date
2 years ago
(Jun 14, 2024, 4:17 PM +0200)
commit
e922f084
e922f084ac71dab7ecc789374c1869d815d0aa35
parent
74d04e59
74d04e59e4397e7006c41a7e830f2cec3e9a624e
+8
-8
1 changed file
Expand all
Collapse all
Unified
Split
common
components
VideoPlayer.tsx
+8
-8
common/components/VideoPlayer.tsx
View file
Reviewed
···
1
1
import { Item, removePlayedVideo } from "backend/data.tsx";
2
2
-
import { nowPlaying } from "backend/data.tsx"
2
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
+
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
15
-
nowPlaying.val = removePlayedVideo();
16
16
-
16
16
+
nowPlaying.val = removePlayedVideo();
17
17
+
17
18
}
18
19
}
19
20
···
21
22
// @ts-ignore - YouTube API
22
23
if (player) {
23
24
player.loadVideoById(videoId);
24
24
-
nowPlaying.val = removePlayedVideo();
25
25
-
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
53
-
// TODO: remove just played video from queue
54
54
-
removePlayedVideo();
55
55
-
53
53
+
56
54
setTimeout(() => {
57
55
if (queue.length > 0) {
58
56
play(queue[0].id);
59
57
}
60
58
}, 200);
59
59
+
60
60
+
61
61
}
62
62
}
63
63