forked from ShivamJoker/Ylight-Music
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ytplayer.html
38 lines (38 loc) · 1.16 KB
/
ytplayer.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<button onclick="loadVideo()">Load video</button>
<div id="ytplayer"></div>
<script>
function loadVideo() {
player.loadVideoById("Ayp719ei-BU");
}
// Load the IFrame Player API code asynchronously.
var tag = document.createElement("script");
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// Replace the 'ytplayer' element with an <iframe> and
// YouTube player after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player("ytplayer", {
height: "500",
width: "700",
videoId: "",
playerVars: {
autoplay: 1,
showinfo: 0,
controls: 1
}
});
}
</script>
</body>
</html>