soiz1 commited on
Commit
eb2d501
ยท
verified ยท
1 Parent(s): 47f161c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +233 -24
index.html CHANGED
@@ -20,14 +20,126 @@
20
  text-shadow: 0 0 5px #0066ff;
21
  border-bottom: 1px solid #0066ff;
22
  padding-bottom: 10px;
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
  video {
26
- max-width: 100%;
27
- height: auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  margin-bottom: 10px;
29
- border: 2px solid #0066ff;
30
- box-shadow: 0 0 10px #0066ff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  .controls {
@@ -110,13 +222,6 @@
110
  padding: 5px;
111
  }
112
 
113
- .video-selector {
114
- margin-top: 15px;
115
- display: flex;
116
- align-items: center;
117
- gap: 10px;
118
- }
119
-
120
  input[type="checkbox"] {
121
  -webkit-appearance: none;
122
  width: 18px;
@@ -141,7 +246,6 @@
141
  transform: translate(-50%, -50%);
142
  }
143
  </style>
144
-
145
  </head>
146
  <body>
147
  <h1>ใƒฉใ‚ธใ‚ชไฝ“ๆ“ๅ‹•็”ปใƒ—ใƒฌใ‚คใƒคใƒผ<br>For Kushihara</h1>
@@ -174,7 +278,28 @@
174
  <button onclick="goFullscreen()">ๅ…จ็”ป้ข</button>
175
  </div>
176
 
177
- <video id="videoPlayer" src="v.mp4" controls></video>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  <script>
179
  const video = document.getElementById('videoPlayer');
180
  const videoSelect = document.getElementById('videoSelect');
@@ -183,6 +308,17 @@
183
  const volumeRange = document.getElementById('volumeRange');
184
  const volumeInput = document.getElementById('volumeInput');
185
  const loopCheckbox = document.getElementById('loopCheckbox');
 
 
 
 
 
 
 
 
 
 
 
186
 
187
  function updatePlaybackRate(value) {
188
  const speed = parseFloat(value);
@@ -195,7 +331,17 @@
195
  const volume = parseFloat(value);
196
  volumeInput.value = volume;
197
  volumeRange.value = volume;
 
198
  video.volume = volume;
 
 
 
 
 
 
 
 
 
199
  }
200
 
201
  function handleVideoChange() {
@@ -204,16 +350,75 @@
204
  if (selected === 'v-2.mp4') {
205
  const confirmPlay = confirm("ใ“ใฎๅ‹•็”ปใฏ้Ÿณ้‡ใŒๅคงใใ„ใงใ™ใ€‚ใ‚ใ‚‰ใ‹ใ˜ใ‚ใ€ใƒ‡ใƒใ‚คใ‚นใฎ้Ÿณ้‡ใ‚’ใ‚ใ‚‹็จ‹ๅบฆไธ‹ใ’ใฆใใ ใ•ใ„ใ€‚ใพใŸใ€้Ÿณๅ‰ฒใ‚ŒใŒ่ตทใใพใ™ใ€‚ๅ†็”Ÿใ—ใฆใ‚‚ใ‚ˆใ‚ใ—ใ„ใงใ™ใ‹๏ผŸ");
206
  if (!confirmPlay) {
207
- videoSelect.value = video.src.split('/').pop(); // ๅ…ƒใซๆˆปใ™
208
  return;
209
  }
210
  }
211
 
212
  video.src = selected;
213
  video.load();
214
- video.play();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  videoSelect.addEventListener('change', handleVideoChange);
218
 
219
  ['input', 'change', 'mouseup'].forEach(eventName => {
@@ -228,20 +433,24 @@
228
  video.loop = loopCheckbox.checked;
229
  });
230
 
231
- function goFullscreen() {
232
- if (video.requestFullscreen) {
233
- video.requestFullscreen();
234
- } else if (video.webkitRequestFullscreen) {
235
- video.webkitRequestFullscreen();
236
- } else if (video.msRequestFullscreen) {
237
- video.msRequestFullscreen();
238
- }
239
- }
 
 
 
240
 
241
  video.addEventListener('loadedmetadata', () => {
242
  updatePlaybackRate(speedRange.value);
243
  updateVolume(volumeRange.value);
244
  video.loop = loopCheckbox.checked;
 
245
  });
246
  </script>
247
  </body>
 
20
  text-shadow: 0 0 5px #0066ff;
21
  border-bottom: 1px solid #0066ff;
22
  padding-bottom: 10px;
23
+ text-align: center;
24
+ }
25
+
26
+ .video-container {
27
+ position: relative;
28
+ max-width: 800px;
29
+ margin-bottom: 20px;
30
+ border: 2px solid #0066ff;
31
+ box-shadow: 0 0 15px rgba(0, 102, 255, 0.5);
32
+ background: #000;
33
  }
34
 
35
  video {
36
+ width: 100%;
37
+ display: block;
38
+ }
39
+
40
+ /* ใ‚ซใ‚นใ‚ฟใƒ ๅ‹•็”ปใ‚ณใƒณใƒˆใƒญใƒผใƒซ */
41
+ video::-webkit-media-controls {
42
+ display: none !important;
43
+ }
44
+
45
+ .custom-controls {
46
+ position: absolute;
47
+ bottom: 0;
48
+ left: 0;
49
+ right: 0;
50
+ background: linear-gradient(to top, rgba(0, 20, 40, 0.9), transparent);
51
+ padding: 10px;
52
+ display: flex;
53
+ flex-direction: column;
54
+ opacity: 0;
55
+ transition: opacity 0.3s;
56
+ }
57
+
58
+ .video-container:hover .custom-controls {
59
+ opacity: 1;
60
+ }
61
+
62
+ .progress-container {
63
+ width: 100%;
64
+ height: 8px;
65
+ background: #001133;
66
  margin-bottom: 10px;
67
+ cursor: pointer;
68
+ }
69
+
70
+ .progress-bar {
71
+ height: 100%;
72
+ background: #00aaff;
73
+ width: 0%;
74
+ position: relative;
75
+ }
76
+
77
+ .progress-bar::after {
78
+ content: '';
79
+ position: absolute;
80
+ right: -5px;
81
+ top: 50%;
82
+ transform: translateY(-50%);
83
+ width: 10px;
84
+ height: 10px;
85
+ background: #00ccff;
86
+ border-radius: 50%;
87
+ box-shadow: 0 0 5px #00ccff;
88
+ }
89
+
90
+ .buttons-container {
91
+ display: flex;
92
+ align-items: center;
93
+ justify-content: space-between;
94
+ }
95
+
96
+ .left-controls, .right-controls {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 15px;
100
+ }
101
+
102
+ .control-btn {
103
+ background: none;
104
+ border: none;
105
+ color: #00ccff;
106
+ font-size: 16px;
107
+ cursor: pointer;
108
+ transition: all 0.3s;
109
+ }
110
+
111
+ .control-btn:hover {
112
+ color: #00ffcc;
113
+ text-shadow: 0 0 5px #00ffcc;
114
+ }
115
+
116
+ .time-display {
117
+ font-size: 14px;
118
+ color: #00aaff;
119
+ font-family: 'Courier New', monospace;
120
+ }
121
+
122
+ .volume-container {
123
+ display: flex;
124
+ align-items: center;
125
+ gap: 5px;
126
+ }
127
+
128
+ .volume-slider {
129
+ width: 80px;
130
+ -webkit-appearance: none;
131
+ height: 4px;
132
+ background: #001133;
133
+ outline: none;
134
+ }
135
+
136
+ .volume-slider::-webkit-slider-thumb {
137
+ -webkit-appearance: none;
138
+ width: 12px;
139
+ height: 12px;
140
+ background: #00aaff;
141
+ border-radius: 50%;
142
+ cursor: pointer;
143
  }
144
 
145
  .controls {
 
222
  padding: 5px;
223
  }
224
 
 
 
 
 
 
 
 
225
  input[type="checkbox"] {
226
  -webkit-appearance: none;
227
  width: 18px;
 
246
  transform: translate(-50%, -50%);
247
  }
248
  </style>
 
249
  </head>
250
  <body>
251
  <h1>ใƒฉใ‚ธใ‚ชไฝ“ๆ“ๅ‹•็”ปใƒ—ใƒฌใ‚คใƒคใƒผ<br>For Kushihara</h1>
 
278
  <button onclick="goFullscreen()">ๅ…จ็”ป้ข</button>
279
  </div>
280
 
281
+ <div class="video-container">
282
+ <video id="videoPlayer" src="v.mp4"></video>
283
+ <div class="custom-controls">
284
+ <div class="progress-container" id="progressContainer">
285
+ <div class="progress-bar" id="progressBar"></div>
286
+ </div>
287
+ <div class="buttons-container">
288
+ <div class="left-controls">
289
+ <button class="control-btn" id="playPauseBtn">โ–ถ</button>
290
+ <span class="time-display" id="timeDisplay">00:00 / 00:00</span>
291
+ </div>
292
+ <div class="right-controls">
293
+ <div class="volume-container">
294
+ <button class="control-btn" id="volumeBtn">๐Ÿ”Š</button>
295
+ <input type="range" class="volume-slider" id="volumeSlider" min="0" max="1" step="0.01" value="1">
296
+ </div>
297
+ <button class="control-btn" id="fullscreenBtn">โ›ถ</button>
298
+ </div>
299
+ </div>
300
+ </div>
301
+ </div>
302
+
303
  <script>
304
  const video = document.getElementById('videoPlayer');
305
  const videoSelect = document.getElementById('videoSelect');
 
308
  const volumeRange = document.getElementById('volumeRange');
309
  const volumeInput = document.getElementById('volumeInput');
310
  const loopCheckbox = document.getElementById('loopCheckbox');
311
+ const playPauseBtn = document.getElementById('playPauseBtn');
312
+ const progressBar = document.getElementById('progressBar');
313
+ const progressContainer = document.getElementById('progressContainer');
314
+ const timeDisplay = document.getElementById('timeDisplay');
315
+ const volumeBtn = document.getElementById('volumeBtn');
316
+ const volumeSlider = document.getElementById('volumeSlider');
317
+ const fullscreenBtn = document.getElementById('fullscreenBtn');
318
+
319
+ // ๅˆๆœŸ่จญๅฎš
320
+ video.controls = false;
321
+ let isDragging = false;
322
 
323
  function updatePlaybackRate(value) {
324
  const speed = parseFloat(value);
 
331
  const volume = parseFloat(value);
332
  volumeInput.value = volume;
333
  volumeRange.value = volume;
334
+ volumeSlider.value = volume;
335
  video.volume = volume;
336
+
337
+ // ้Ÿณ้‡ใƒœใ‚ฟใƒณใฎใ‚ขใ‚คใ‚ณใƒณๆ›ดๆ–ฐ
338
+ if (volume === 0) {
339
+ volumeBtn.textContent = '๐Ÿ”‡';
340
+ } else if (volume < 0.5) {
341
+ volumeBtn.textContent = '๐Ÿ”ˆ';
342
+ } else {
343
+ volumeBtn.textContent = '๐Ÿ”Š';
344
+ }
345
  }
346
 
347
  function handleVideoChange() {
 
350
  if (selected === 'v-2.mp4') {
351
  const confirmPlay = confirm("ใ“ใฎๅ‹•็”ปใฏ้Ÿณ้‡ใŒๅคงใใ„ใงใ™ใ€‚ใ‚ใ‚‰ใ‹ใ˜ใ‚ใ€ใƒ‡ใƒใ‚คใ‚นใฎ้Ÿณ้‡ใ‚’ใ‚ใ‚‹็จ‹ๅบฆไธ‹ใ’ใฆใใ ใ•ใ„ใ€‚ใพใŸใ€้Ÿณๅ‰ฒใ‚ŒใŒ่ตทใใพใ™ใ€‚ๅ†็”Ÿใ—ใฆใ‚‚ใ‚ˆใ‚ใ—ใ„ใงใ™ใ‹๏ผŸ");
352
  if (!confirmPlay) {
353
+ videoSelect.value = video.src.split('/').pop();
354
  return;
355
  }
356
  }
357
 
358
  video.src = selected;
359
  video.load();
360
+ video.play().then(() => {
361
+ playPauseBtn.textContent = 'โธ';
362
+ }).catch(e => console.log(e));
363
+ }
364
+
365
+ function togglePlayPause() {
366
+ if (video.paused) {
367
+ video.play();
368
+ playPauseBtn.textContent = 'โธ';
369
+ } else {
370
+ video.pause();
371
+ playPauseBtn.textContent = 'โ–ถ';
372
+ }
373
+ }
374
+
375
+ function updateProgress() {
376
+ const percent = (video.currentTime / video.duration) * 100;
377
+ progressBar.style.width = `${percent}%`;
378
+
379
+ // ๆ™‚้–“่กจ็คบๆ›ดๆ–ฐ
380
+ const currentMinutes = Math.floor(video.currentTime / 60);
381
+ const currentSeconds = Math.floor(video.currentTime % 60).toString().padStart(2, '0');
382
+ const durationMinutes = Math.floor(video.duration / 60);
383
+ const durationSeconds = Math.floor(video.duration % 60).toString().padStart(2, '0');
384
+
385
+ timeDisplay.textContent = `${currentMinutes}:${currentSeconds} / ${durationMinutes}:${durationSeconds}`;
386
+ }
387
+
388
+ function setProgress(e) {
389
+ const width = progressContainer.clientWidth;
390
+ const clickX = e.offsetX;
391
+ const duration = video.duration;
392
+ video.currentTime = (clickX / width) * duration;
393
  }
394
 
395
+ function toggleMute() {
396
+ video.muted = !video.muted;
397
+ if (video.muted) {
398
+ volumeBtn.textContent = '๐Ÿ”‡';
399
+ volumeSlider.value = 0;
400
+ } else {
401
+ updateVolume(video.volume);
402
+ }
403
+ }
404
+
405
+ function handleVolumeChange() {
406
+ video.muted = false;
407
+ updateVolume(volumeSlider.value);
408
+ }
409
+
410
+ function goFullscreen() {
411
+ const container = document.querySelector('.video-container');
412
+ if (container.requestFullscreen) {
413
+ container.requestFullscreen();
414
+ } else if (container.webkitRequestFullscreen) {
415
+ container.webkitRequestFullscreen();
416
+ } else if (container.msRequestFullscreen) {
417
+ container.msRequestFullscreen();
418
+ }
419
+ }
420
+
421
+ // ใ‚คใƒ™ใƒณใƒˆใƒชใ‚นใƒŠใƒผ
422
  videoSelect.addEventListener('change', handleVideoChange);
423
 
424
  ['input', 'change', 'mouseup'].forEach(eventName => {
 
433
  video.loop = loopCheckbox.checked;
434
  });
435
 
436
+ playPauseBtn.addEventListener('click', togglePlayPause);
437
+ video.addEventListener('click', togglePlayPause);
438
+ video.addEventListener('play', () => playPauseBtn.textContent = 'โธ');
439
+ video.addEventListener('pause', () => playPauseBtn.textContent = 'โ–ถ');
440
+ video.addEventListener('timeupdate', updateProgress);
441
+ progressContainer.addEventListener('click', setProgress);
442
+ progressContainer.addEventListener('mousedown', () => isDragging = true);
443
+ document.addEventListener('mouseup', () => isDragging = false);
444
+ progressContainer.addEventListener('mousemove', (e) => isDragging && setProgress(e));
445
+ volumeBtn.addEventListener('click', toggleMute);
446
+ volumeSlider.addEventListener('input', handleVolumeChange);
447
+ fullscreenBtn.addEventListener('click', goFullscreen);
448
 
449
  video.addEventListener('loadedmetadata', () => {
450
  updatePlaybackRate(speedRange.value);
451
  updateVolume(volumeRange.value);
452
  video.loop = loopCheckbox.checked;
453
+ updateProgress();
454
  });
455
  </script>
456
  </body>