soiz1 commited on
Commit
364f7cd
·
verified ·
1 Parent(s): 8552b20

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +34 -26
index.html CHANGED
@@ -443,19 +443,19 @@
443
  .audio-only-mode .controls {
444
  margin-top: 0;
445
  }
446
- /* プレビュー用スタイル */
447
- .preview-video {
448
  position: absolute;
449
  width: 160px;
450
  height: 90px;
451
- bottom: 40px;
452
- left: 0;
453
  background: #000;
454
  border: 2px solid #00aaff;
455
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
456
  display: none;
457
  pointer-events: none;
458
  z-index: 10;
 
 
459
  }
460
  </style>
461
  </head>
@@ -657,7 +657,6 @@
657
  <track id="subtitleTrackElement" kind="subtitles" src="v.vtt" srclang="ja" label="日本語" default>
658
  </track>
659
  </video>
660
- <video id="previewVideo" class="preview-video"></video>
661
  <div class="custom-controls">
662
  <div class="progress-container" id="progressContainer">
663
  <div class="progress-bar" id="progressBar">
@@ -715,27 +714,36 @@
715
  let normalVideoWidth = videoContainer.clientWidth;
716
  let audioOnlyMode = false;
717
 
718
- // ホバー時の時間表示
719
- function setupHoverTime() {
720
- progressContainer.addEventListener('mousemove', (e) => {
721
- if (!video.duration) return;
722
-
723
- const rect = progressContainer.getBoundingClientRect();
724
- const pos = (e.clientX - rect.left) / rect.width;
725
- const time = pos * video.duration;
726
-
727
- hoverTime.style.display = 'block';
728
- hoverTime.style.left = `${e.clientX - rect.left}px`;
729
-
730
- const minutes = Math.floor(time / 60);
731
- const seconds = Math.floor(time % 60).toString().padStart(2, '0');
732
- hoverTime.textContent = `${minutes}:${seconds}`;
733
- });
734
 
735
- progressContainer.addEventListener('mouseleave', () => {
736
- hoverTime.style.display = 'none';
737
- });
738
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
 
740
  function updatePlaybackRate(value) {
741
  const speed = parseFloat(value);
@@ -1001,4 +1009,4 @@
1001
  </script>
1002
  </body>
1003
 
1004
- </html>
 
443
  .audio-only-mode .controls {
444
  margin-top: 0;
445
  }
446
+ /* サムネイルプレビュー用スタイル */
447
+ .thumbnail-preview {
448
  position: absolute;
449
  width: 160px;
450
  height: 90px;
 
 
451
  background: #000;
452
  border: 2px solid #00aaff;
453
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
454
  display: none;
455
  pointer-events: none;
456
  z-index: 10;
457
+ bottom: 40px; /* プログレスバーの上に表示 */
458
+ transform: translateX(-50%);
459
  }
460
  </style>
461
  </head>
 
657
  <track id="subtitleTrackElement" kind="subtitles" src="v.vtt" srclang="ja" label="日本語" default>
658
  </track>
659
  </video>
 
660
  <div class="custom-controls">
661
  <div class="progress-container" id="progressContainer">
662
  <div class="progress-bar" id="progressBar">
 
714
  let normalVideoWidth = videoContainer.clientWidth;
715
  let audioOnlyMode = false;
716
 
717
+ const previewVideo = document.getElementById("previewVideo");
718
+ previewVideo.src = video.src;
719
+ previewVideo.preload = "auto";
720
+
721
+ // プログレスバーのイベントリスナーを更新
722
+ progressContainer.addEventListener("mousemove", (e) => {
723
+ if (!video.duration) return;
724
+
725
+ const rect = progressContainer.getBoundingClientRect();
726
+ const pos = (e.clientX - rect.left) / rect.width;
727
+ const time = pos * video.duration;
 
 
 
 
 
728
 
729
+ // 時間表示
730
+ const minutes = Math.floor(time / 60);
731
+ const seconds = Math.floor(time % 60).toString().padStart(2, '0');
732
+ hoverTime.textContent = `${minutes}:${seconds}`;
733
+ hoverTime.style.display = 'block';
734
+ hoverTime.style.left = `${e.clientX - rect.left}px`;
735
+
736
+ // サムネイルプレビュー
737
+ previewVideo.currentTime = time;
738
+ previewVideo.style.display = "block";
739
+ previewVideo.style.left = `${e.clientX}px`;
740
+ previewVideo.style.bottom = `${rect.height + 10}px`;
741
+ });
742
+
743
+ progressContainer.addEventListener("mouseleave", () => {
744
+ hoverTime.style.display = "none";
745
+ previewVideo.style.display = "none";
746
+ });
747
 
748
  function updatePlaybackRate(value) {
749
  const speed = parseFloat(value);
 
1009
  </script>
1010
  </body>
1011
 
1012
+ </html>