-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArtvibes1.html
188 lines (169 loc) · 5.6 KB
/
Artvibes1.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
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://www.youtube.com/iframe_api"></script>
</head>
<script src="./qrcode.js" onload="onQRCodeLoad()" defer></script>
<script defer>
function onQRCodeLoad(){
console.log('loaded')
if (typeof QRCode === 'undefined') {
console.error('Failed to load QRCode library');
}
// Get the current local address and port
// const localAddress = window.location.hostname;
// const localPort = window.location.port || '80';
// const localUrl = `http://${localAddress}:${localPort}`;
let localUrl = window.location.href;
// Create a new QR code instance
const qrCodeContainer = document.createElement('div');
const qrCode = new QRCode(qrCodeContainer, {
text: localUrl,
width: 128,
height: 128,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H,
});
// Set the position of the QR code container
qrCodeContainer.style.position = 'fixed';
qrCodeContainer.style.bottom = '0';
qrCodeContainer.style.right = '0';
// Append the QR code container to the document
document.body.appendChild(qrCodeContainer);
}
</script>
<style>
body{
margin: 0 30px;
background-color: #080b16;
}
.music-container{
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
#art{
margin-top: 50px;
border-radius: 20px;
}
.btn {
position: relative;
width: 40px;
height: 40px;
border: white 3px solid;
border-radius: 50%;
cursor: pointer;
transition: border 0.1s ease-in-out;
}
.bar {
display: inline-block;
position: absolute;
top: 10px;
left: 0;
width: 3px;
height: 20px;
border-radius: 3px;
background-color: white;
transform-origin: center;
transition: transform 0.2s ease-in-out, background 0.1s ease-in-out;
}
.pause .bar-1 {
transform: translateX(13.5px) translateY(0px) rotate(0deg);
}
.pause .bar-2 {
transform: translateX(24px) translateY(0px) rotate(0deg);
}
.play .bar-1{
transform: translateX(20px) translateY(-5px) rotate(-55deg);
}
.play .bar-2 {
transform: translateX(20px) translateY(5px) rotate(-125deg);
}
</style>
<body>
<div class="music-container">
<iframe id="art" src="https://assets.pinterest.com/ext/embed.html?id=55802482874299806" height="400" width="300" frameborder="0" scrolling="no"></iframe>
<iframe id="player" width="0" height="0" src="https://www.youtube.com/embed/8UlayxF0XMk?controls=0&disablekb=1&modestbranding=1&showinfo=0&rel=0&iv_load_policy=3&loop=0&start=0&enablejsapi=1" title="YouTube video player" frameborder="0"></iframe>
<div>
<!-- <button onclick="playMusic(this)">Play</button>
<button onclick="pauseMusic(this)">Pause</button> -->
<div class="btn play" onclick="playPause(this)">
<span class="bar bar-1"></span>
<span class="bar bar-2"></span>
</div>
</div>
<div id="progress"></div>
</div>
<style>
#progress{
height: 6px;
border-radius: 3px;
background-color: red;
}
</style>
<script>
var player
var duration;
var progressInterval;
const urlParams = new URLSearchParams(window.location.search);
const queryString = window.location.search;
const params = queryString.substring(1).split('&');
const link1 = decodeURIComponent(params[0]);
const link2 = decodeURIComponent(params[1]);
document.getElementById('art').src='https://assets.pinterest.com/ext/embed.html?id='+link2;
// function onYouTubeIframeAPIReady(){
// player = new YT.Player('player', {
// videoId: link1,
// events: {
// 'onReady': onPlayerReady
// }
// });
// }
function onYouTubeIframeAPIReady(){
player = new YT.Player('player', {
videoId: link1,
events: {
'onReady': onPlayerReady
}
});
}
// function getVideoIdFromUrl(url) {
// var videoId;
// var match = url.match(/^[^v]+v.(.{11}).*/);
// if (match) {
// videoId = match[1];
// }
// return videoId;
// }
function onPlayerReady(event) {
duration = player.getDuration();
progressInterval = setInterval(updateProgress, 100);
}
function updateProgress() {
var currentTime = player.getCurrentTime();
var percentage = (currentTime / duration) * 1000;
document.getElementById('progress').style.width = percentage + '%';
}
function playPause(elem){
if ( elem.classList.contains('play') ) {
elem.classList.replace('play', 'pause');
player.playVideo();
} else {
elem.classList.replace('pause', 'play');
player.pauseVideo();
}
}
// function playMusic(){
// player.playVideo();
// }
// function pauseMusic(){
// player.pauseVideo();
// }
</script>
</body>
</html>