-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebplayer
More file actions
91 lines (81 loc) · 2.15 KB
/
Webplayer
File metadata and controls
91 lines (81 loc) · 2.15 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Video Player</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
}
h1 {
text-align: center;
}
#videoPlayer {
display: block;
margin: 0 auto 20px;
max-width: 100%;
height: auto;
}
.controls {
display: flex;
justify-content: center;
gap: 20px;
align-items: center;
}
button, select {
font-size: 16px;
padding: 8px 16px;
cursor: pointer;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #fff;
}
button:hover, select:hover {
background-color: #e0e0e0;
}
</style>
</head>
<body>
<h1>Custom Video Player</h1>
<!-- Video Player -->
<video id="videoPlayer" width="600">
<source id="videoSource" src="path_to_your_clipped_video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<!-- Custom Controls -->
<div class="controls">
<button id="playPauseBtn">Play</button>
<label for="speedControl">Speed:</label>
<select id="speedControl">
<option value="0.5">0.5x</option>
<option value="1" selected>1x</option>
<option value="1.5">1.5x</option>
<option value="2">2x</option>
</select>
</div>
<script>
const video = document.getElementById("videoPlayer");
const playPauseBtn = document.getElementById("playPauseBtn");
const speedControl = document.getElementById("speedControl");
// Play/Pause functionality
playPauseBtn.addEventListener("click", () => {
if (video.paused) {
video.play();
playPauseBtn.textContent = "Pause";
} else {
video.pause();
playPauseBtn.textContent = "Play";
}
});
// Speed control functionality
speedControl.addEventListener("change", (event) => {
const selectedSpeed = event.target.value;
video.playbackRate = parseFloat(selectedSpeed); // Set the playback speed
});
</script>
</body>
</html>