soiz1 commited on
Commit
5855458
ยท
verified ยท
1 Parent(s): 1eb0af6

Update index.html

Browse files
Files changed (1) hide show
  1. 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
- ['input', 'change', 'mouseup'].forEach(eventName => {
89
- speedRange.addEventListener(eventName, () => {
90
- updatePlaybackRate(speedRange.value);
91
- });
92
- volumeRange.addEventListener(eventName, () => {
93
- updateVolume(volumeRange.value);
94
- });
95
- });
96
 
97
- speedInput.addEventListener('input', () => {
98
- updatePlaybackRate(speedInput.value);
99
- });
 
 
 
 
 
 
 
 
 
100
 
101
- volumeInput.addEventListener('input', () => {
102
- updateVolume(volumeInput.value);
 
 
 
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
  });