¿Cómo hacer que el video se detenga cuando selecciono el otro video o cuando lo reproduzco?
Publicado por Enrique (3 intervenciones) el 02/07/2021 21:32:30
Hola gente, tengo un detalle con mi página. Estoy haciendo un slider de videos y no consigo hacer que cuando estoy reproduciendo un video y me muevo al siguiente, se detenga el video que se está reproduciendo. ¿Qué debo poner en mi página para lograrlo y cómo lo hago?
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
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="videos">
<div class="vids">
<input type="radio" name="video-slide" id="vid1" checked>
<input type="radio" name="video-slide" id="vid2">
<video src="Videos/aprendiendo juntos(1).mp4" controls class="v1" alt="vid1"></video>
<video src="Videos/InteligenciaEmocional.mp4" controls class="v2" alt="vid2"></video>
<div class="dots">
<label for="vid1" id="btn1"></label>
<label for="vid2" id="btn2"></label>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js"></script>
</body>
</html>
<style>
.videos{
background-color: coral;
width: 60%;
position: relative;
margin: 0 auto;
}
.vids{
background-color: cornflowerblue;
width: 80%;
display: flex;
height: 400px;
overflow: hidden;
margin: 0 auto;
}
.vids video{
width: 100%;
height: 380px;
}
.vids input{
display: none;
}
.dots{
display: flex;
justify-content: center;
width: 80%;
position: absolute;
bottom: 0;
}
.dots label{
height: 12px;
width: 12px;
background-color: darkslategray;
border-radius: 50%;
cursor: pointer;
margin: 0 8px;
}
.dots label:hover{
background-color: gray;
}
#vid1:checked ~ .v1{
margin-left: 0;
}
#vid2:checked ~ .v2{
margin-left: -100%;
}
#vid1:checked ~ .dots #btn1{
background-color: white;
}
#vid2:checked ~ .dots #btn2{
background-color: white;
}
</style>
Valora esta pregunta


0