Spaces:
Running
Running
Update index.html
Browse files- index.html +34 -14
index.html
CHANGED
@@ -40,8 +40,18 @@
|
|
40 |
</head>
|
41 |
<body>
|
42 |
<h1>ๅ็ปใใฌใคใคใผ</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
<video id="videoPlayer" src="v.mp4" controls></video>
|
44 |
-
|
45 |
<div class="controls">
|
46 |
<div class="control-group">
|
47 |
<label for="speedRange">ๅ็้ๅบฆ๏ผ</label>
|
@@ -65,6 +75,7 @@
|
|
65 |
|
66 |
<script>
|
67 |
const video = document.getElementById('videoPlayer');
|
|
|
68 |
const speedRange = document.getElementById('speedRange');
|
69 |
const speedInput = document.getElementById('speedInput');
|
70 |
const volumeRange = document.getElementById('volumeRange');
|
@@ -85,23 +96,32 @@
|
|
85 |
video.volume = volume;
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
updatePlaybackRate(speedRange.value);
|
91 |
-
});
|
92 |
-
volumeRange.addEventListener(eventName, () => {
|
93 |
-
updateVolume(volumeRange.value);
|
94 |
-
});
|
95 |
-
});
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
103 |
});
|
104 |
|
|
|
|
|
|
|
105 |
loopCheckbox.addEventListener('change', () => {
|
106 |
video.loop = loopCheckbox.checked;
|
107 |
});
|
|
|
40 |
</head>
|
41 |
<body>
|
42 |
<h1>ๅ็ปใใฌใคใคใผ</h1>
|
43 |
+
|
44 |
+
<div class="control-group">
|
45 |
+
<label for="videoSelect">ๅ็ปใ้ธๆ๏ผ</label>
|
46 |
+
<select id="videoSelect">
|
47 |
+
<option value="v.mp4">v.mp4๏ผ้ๅธธ้ณ้๏ผ</option>
|
48 |
+
<option value="v-1.mp4">v-1.mp4๏ผไธญ้ณ้๏ผ</option>
|
49 |
+
<option value="v-2.mp4">v-2.mp4๏ผๅคง้ณ้๏ผ</option>
|
50 |
+
</select>
|
51 |
+
</div>
|
52 |
+
|
53 |
<video id="videoPlayer" src="v.mp4" controls></video>
|
54 |
+
|
55 |
<div class="controls">
|
56 |
<div class="control-group">
|
57 |
<label for="speedRange">ๅ็้ๅบฆ๏ผ</label>
|
|
|
75 |
|
76 |
<script>
|
77 |
const video = document.getElementById('videoPlayer');
|
78 |
+
const videoSelect = document.getElementById('videoSelect');
|
79 |
const speedRange = document.getElementById('speedRange');
|
80 |
const speedInput = document.getElementById('speedInput');
|
81 |
const volumeRange = document.getElementById('volumeRange');
|
|
|
96 |
video.volume = volume;
|
97 |
}
|
98 |
|
99 |
+
function handleVideoChange() {
|
100 |
+
const selected = videoSelect.value;
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
if (selected === 'v-2.mp4') {
|
103 |
+
const confirmPlay = confirm("ใใฎๅ็ปใฏ้ณ้ใๅคงใใใงใใใใใใใใใใใคในใฎ้ณ้ใใใ็จๅบฆไธใใฆใใ ใใใใพใใ้ณๅฒใใ่ตทใใพใใๅ็ใใฆใใใใใใงใใ๏ผ");
|
104 |
+
if (!confirmPlay) {
|
105 |
+
videoSelect.value = video.src.split('/').pop(); // ๅ
ใซๆปใ
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
video.src = selected;
|
111 |
+
video.load();
|
112 |
+
video.play();
|
113 |
+
}
|
114 |
|
115 |
+
videoSelect.addEventListener('change', handleVideoChange);
|
116 |
+
|
117 |
+
['input', 'change', 'mouseup'].forEach(eventName => {
|
118 |
+
speedRange.addEventListener(eventName, () => updatePlaybackRate(speedRange.value));
|
119 |
+
volumeRange.addEventListener(eventName, () => updateVolume(volumeRange.value));
|
120 |
});
|
121 |
|
122 |
+
speedInput.addEventListener('input', () => updatePlaybackRate(speedInput.value));
|
123 |
+
volumeInput.addEventListener('input', () => updateVolume(volumeInput.value));
|
124 |
+
|
125 |
loopCheckbox.addEventListener('change', () => {
|
126 |
video.loop = loopCheckbox.checked;
|
127 |
});
|