File size: 7,398 Bytes
7b4e5c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fa68fb
7b4e5c4
54d3774
7b4e5c4
 
 
8cc7ed7
7b4e5c4
 
 
 
8cc7ed7
7b4e5c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8cc7ed7
0fffcdc
 
8cc7ed7
7b4e5c4
 
 
 
 
 
 
 
 
 
 
b5bcda9
7b4e5c4
8cc7ed7
7b4e5c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8cc7ed7
 
 
 
 
 
 
 
 
7b4e5c4
 
 
 
 
 
 
 
 
 
fb28358
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Music Stream</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            background-color: #121212;
            color: #B2B2B2;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            overflow: hidden;
        }
        header {
            width: 100%;
            background-color: #1DB954;
            padding: 10px 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-sizing: border-box;
        }
        header h1 {
            margin: 0;
            font-size: 24px;
            text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
        }
        .stop-button {
            background-color: #4A4A4A;
            color: #B3B3B3;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
        }
        .stop-button:hover {
            background-color: #C5303A;
        }
        .genre-container {
            margin: 20px;
            padding: 20px;
            background-color: #282828;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            width: 90%;
            max-width: 600px;
        }
        .genre-title {
            font-size: 20px;
            margin-bottom: 10px;
        }
        .track-list {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        .track-list li {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background-color: #333;
            margin-bottom: 10px;
            border-radius: 5px;
            transition: all 0.3s ease;
        }
        .track-list li:last-child {
            margin-bottom: 0;
        }
        .track-list li:hover {
            background-color: #444;
            transform: scale(1.05);
        }
        .track-list button {
            background-color: #1DB954;
            color: #FFF;
            border: none;
            padding: 5px 10px;
            border-radius: 3px;
            cursor: pointer;
            font-size: 14px;
            transition: background-color 0.3s ease;
        }
        .track-list button:hover {
            background-color: #1AA34A;
        }
        .playing {
            background-color: #555;
            cursor: not-allowed;
        }
        footer {
            margin-top: auto;
            padding: 10px;
            text-align: center;
            font-size: 14px;
            background-color: #1E1E1E;
            width: 100%;
            color: #B3B3B3;
        }
        .firework {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            animation: explode 2s ease-out forwards;
        }
        @keyframes explode {
            0% {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
            50% {
                transform: translateY(-300px) scale(1.5);
                opacity: 1;
            }
            100% {
                transform: translateY(-400px) scale(0);
                opacity: 0;
            }
        }
    </style>
</head>
<body>
    <header>
        <h1>Stream</h1>
        <div>
            <button class="stop-button" onclick="playRandom()">Random</button>
            <button class="stop-button" onclick="stopMusic()">Stop</button>
        </div>
    </header>

    <div class="genre-container">
        <div class="genre-title"></div>
        <ul class="track-list">
            <li class="lo-fi">
                Lo-Fi 
                <button class="play-button" onclick="playMusic('jfKfPfyJRdk', this)">Play</button>
            </li>
            <li class="rock">
                Rock
                <button class="play-button" onclick="playMusic('Nt27aBceerI', this)">Play</button>
            </li>
            <li class="dubstep">
                Dubstep
                <button class="play-button" onclick="playMusic('sR-sbG98ldM', this)">Play</button>
            </li>
        </ul>
    </div>

    <div id="player" style="display:none;"></div>

    <footer>
        <div>&copy; 2025 Music Stream | Made with ❤️</div>
        <div id="current-time"></div>
    </footer>

    <script>
        var tag = document.createElement('script');
        tag.src = "https://www.youtube.com/iframe_api";
        var firstScriptTag = document.getElementsByTagName('script')[0];
        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
        var player;
        var fireworkInterval;

        function onYouTubeIframeAPIReady() {
            player = new YT.Player('player', {
                height: '0',
                width: '0',
                events: {
                    'onStateChange': onPlayerStateChange
                }
            });
        }

        function createFirework() {
            const firework = document.createElement('div');
            firework.className = 'firework';
            firework.style.left = `${Math.random() * window.innerWidth}px`;
            firework.style.bottom = '0';
            firework.style.backgroundColor = Math.random() < 0.2 ? '#FF0000' : '#FFD700';
            document.body.appendChild(firework);
            setTimeout(() => {
                document.body.removeChild(firework);
            }, 2000);
        }

        function onPlayerStateChange(event) {
            if (event.data === YT.PlayerState.PLAYING) {
                fireworkInterval = setInterval(createFirework, 500);
            } else {
                clearInterval(fireworkInterval);
            }
        }

        function playMusic(videoId, button) {
            if (player) {
                stopMusic();
                player.loadVideoById(videoId);
                player.playVideo();
                button.classList.add('playing');
                button.textContent = "Playing...";
            }
        }

        function stopMusic() {
            if (player) {
                player.stopVideo();
            }
            clearInterval(fireworkInterval);
            document.querySelectorAll('.play-button').forEach(button => {
                button.classList.remove('playing');
                button.textContent = "Play";
            });
        }

        function playRandom() {
            const tracks = document.querySelectorAll('.track-list li');
            const randomIndex = Math.floor(Math.random() * tracks.length);
            const randomTrack = tracks[randomIndex];
            const button = randomTrack.querySelector('.play-button');
            const videoId = button.getAttribute('onclick').match(/'(.*?)'/)[1];
            playMusic(videoId, button);
        }

        function updateTime() {
            const now = new Date();
            const timeString = now.toLocaleTimeString();
            document.getElementById('current-time').textContent = `${timeString}`;
        }

        setInterval(updateTime, 1000);
        updateTime();
    </script>
</body>
</html>