-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
125 lines (115 loc) · 3.66 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Latest compiled and minified CSS -->
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"
/>
<script src="/socket.io/socket.io.js"></script>
<link rel="stylesheet" href="styles.css" />
<title>YTsync</title>
</head>
<body>
<!-- Search field -->
<div id="search-feild">
<input id="input" type="text" />
<button id="btn">Search</button>
</div>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player-container">
<div id="player"></div>
</div>
<!-- Player count -->
<div id="playerCount">
<p>Number of people watching are: <span id="count">0</span></p>
</div>
<!-- Player controls -->
<div id="player-controls">
<!--player controls-->
<button
type="button"
id="playButton"
class="btn btn-default"
aria-label="Left Align"
>
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
</button>
<button
type="button"
id="pauseButton"
class="btn btn-default"
aria-label="Left Align"
>
<span class="glyphicon glyphicon-pause" aria-hidden="true"></span>
</button>
<div id="timeline">
<div id="line"></div>
<div id="box"></div>
</div>
</div>
<!-- 1. The <iframe> (and video player) will replace this <div> tag.
<div id="player"></div> -->
<script
src="https://code.jquery.com/jquery-3.5.0.min.js"
integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ="
crossorigin="anonymous"
></script>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement("script");
tag.src = "https://www.youtube.com/iframe_api?enablejsapi=1";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player("player", {
height: "100%",
width: "100%",
videoId: "WsU8J91d5ck",
playerVars: {
rel: 0,
enablejsapi: 1,
controls: 0,
disablekb: 1,
modestbranding: 1,
},
events: {
onReady: onPlayerReady,
onStateChange: onPlayerStateChange,
},
});
}
// 'WsU8J91d5ck'
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
timelineLoop();
playerConnected();
newPlayer();
myVideo();
// event.target.playVideo();
}
// 5. The API calls this function when the player's state changes.
// The function indicates that when playing a video (state=1),
// the player should play for six seconds and then stop.
var done = false;
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING && !done) {
// setTimeout(stopVideo, 6000);
done = true;
}
}
function stopVideo() {
player.stopVideo();
}
</script>
<script></script>
<script src="index.js"></script>
</body>
</html>