-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
103 lines (88 loc) · 2.54 KB
/
test.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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shorts do YouTube</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
height: 100vh;
background-color: #f9f9f9;
}
iframe {
width: 342px;
height: 608px;
border: none;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
margin: 5px;
font-size: 16px;
border: none;
border-radius: 5px;
background: #007bff;
color: white;
cursor: pointer;
top: -350px;
position: relative;
opacity: 0.8;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}
button:hover {
background: #0056b3;
}
button,
#prev {
left: -150px;
}
button,
#next {
left: 150px;
}
</style>
</head>
<body>
<iframe id="youtube-short" src="https://www.youtube.com/embed/6uO72zt3WBk?autoplay=1"
allow="autoplay; encrypted-media" allowfullscreen></iframe>
<div>
<button id="prev">⬅️</button>
<button id="next">➡️</button>
</div>
<script>
// Lista de vídeos (IDs dos shorts)
const shorts = [
"6uO72zt3WBk", // Primeiro vídeo
"faXzF9AWc7c" // Segundo vídeo
];
let currentIndex = 0; // Índice inicial
// Elementos
const iframe = document.getElementById('youtube-short');
const prevButton = document.getElementById('prev');
const nextButton = document.getElementById('next');
// Função para mudar o vídeo
function updateVideo(index) {
iframe.src = `https://www.youtube.com/embed/${shorts[index]}?autoplay=1`;
}
// Eventos dos botões
prevButton.addEventListener('click', () => {
if (currentIndex > 0) {
currentIndex--;
updateVideo(currentIndex);
}
});
nextButton.addEventListener('click', () => {
if (currentIndex < shorts.length - 1) {
currentIndex++;
updateVideo(currentIndex);
}
});
</script>
</body>
</html>