-
Notifications
You must be signed in to change notification settings - Fork 0
/
song.html
155 lines (138 loc) · 3.96 KB
/
song.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Life Tracker - Song</title>
<link rel="stylesheet" href="style.css" />
<style>
body {
text-align: center;
font-family: "Inter", sans-serif;
background-color: white;
margin: 0;
padding: 0;
}
#songtitle,
#playlistinfo {
margin-top: 20px;
}
#songInfo {
margin-top: 20px;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
display: inline-block;
}
#songInfo img {
width: 300px;
height: 300px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
#songInfo p {
font-size: 1.5rem;
font-weight: bold;
margin: 10px 0;
}
.iframe-container {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 20px;
margin-top: 20px;
}
.video-frame {
width: 560px;
height: 315px;
border: none;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
footer {
margin-top: 50px;
padding: 20px;
background-color: #333;
color: white;
}
</style>
</head>
<body>
<h1>Life Tracker</h1>
<ul>
<li><a href="scheduler.html">Scheduler</a></li>
<li class="dropdown">
<a href="timer.html">Timer</a>
<div class="dropdown-content">
<a href="stopwatch.html">Stopwatch</a>
</div>
</li>
<li><a href="song.html" id="selected-list">Song</a></li>
<li><a href="diary.html">Diary</a></li>
<li><a href="myPage.html">My page</a></li>
</ul>
<h1 id="songtitle">Song</h1>
<div id="songInfo">
<img src="" alt="Album Cover" />
<p id="artist"></p>
<p id="album"></p>
<p id="track"></p>
</div>
<h2 id="playlistinfo">공부할 때 틀어놓기 좋은 플레이리스트</h2>
<div class="iframe-container">
<div id="player1" class="video-frame"></div>
<div id="player2" class="video-frame"></div>
<div id="player3" class="video-frame"></div>
<div id="player4" class="video-frame"></div>
</div>
<footer>
<p >© 2024 Life Tracker.</p>
</footer>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
let players = [];
function onYouTubeIframeAPIReady() {
initializePlayers();
}
function initializePlayers() {
const playerIds = ["player1", "player2", "player3", "player4"];
const videoIds = [
"5PLpaCGqvP8",
"U34kLXjdw90",
"OqvX953wckE",
"Afi364f9FAc",
];
playerIds.forEach((playerId, index) => {
if (document.getElementById(playerId)) {
players[index] = new YT.Player(playerId, {
height: "315",
width: "560",
videoId: videoIds[index],
events: {
onReady: onPlayerReady,
onError: onPlayerError,
},
});
}
});
}
function onPlayerReady(event) {
console.log("Player ready:", event.target.a.id);
}
function onPlayerError(event) {
console.error("Player error:", event.data);
}
document.addEventListener("DOMContentLoaded", function () {
if (typeof YT === "undefined" || typeof YT.Player === "undefined") {
let tag = document.createElement("script");
tag.src = "https://www.youtube.com/iframe_api";
let firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
} else {
initializePlayers();
}
});
</script>
<script src="js/song.js"></script>
</body>
</html>