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

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +23 -38
index.html CHANGED
@@ -707,7 +707,6 @@
707
  const subtitleTrackElement = document.getElementById('subtitleTrackElement');
708
  const videoContainer = document.querySelector('.video-container');
709
  const controls = document.querySelector('.controls');
710
- const previewVideo = document.getElementById("previewVideo");
711
 
712
  // 初期設定
713
  video.controls = false;
@@ -716,37 +715,27 @@
716
  let normalVideoWidth = videoContainer.clientWidth;
717
  let audioOnlyMode = false;
718
 
719
-
720
- previewVideo.src = video.src;
721
- previewVideo.preload = "auto";
722
-
723
- // プログレスバーのホバーイベントを更新
724
- progressContainer.addEventListener("mousemove", (e) => {
725
- if (!video.duration) return;
726
-
727
- const rect = progressContainer.getBoundingClientRect();
728
- const pos = (e.clientX - rect.left) / rect.width;
729
- const hoverTimeSec = pos * video.duration;
730
-
731
- // 時間表示
732
- const minutes = Math.floor(hoverTimeSec / 60);
733
- const seconds = Math.floor(hoverTimeSec % 60).toString().padStart(2, '0');
734
- hoverTime.textContent = `${minutes}:${seconds}`;
735
- hoverTime.style.display = 'block';
736
- hoverTime.style.left = `${e.clientX - rect.left}px`;
737
-
738
- // プレビュー表示
739
- previewVideo.currentTime = hoverTimeSec;
740
- previewVideo.style.display = "block";
741
- previewVideo.style.left = `${e.clientX - 80}px`; // 中央揃え調整
742
- previewVideo.style.bottom = "40px"; // プログレスバーの上に表示
743
- });
744
-
745
- progressContainer.addEventListener('mouseleave', () => {
746
- hoverTime.style.display = 'none';
747
- previewVideo.style.display = 'none';
748
- });
749
-
750
 
751
  function updatePlaybackRate(value) {
752
  const speed = parseFloat(value);
@@ -989,12 +978,8 @@ progressContainer.addEventListener('mouseleave', () => {
989
  document.addEventListener('webkitfullscreenchange', updateSubtitleScaleForFullscreen);
990
  document.addEventListener('mozfullscreenchange', updateSubtitleScaleForFullscreen);
991
  document.addEventListener('MSFullscreenChange', updateSubtitleScaleForFullscreen);
992
-
993
-
994
- // メイン動画のソースをプレビュー用にも設定
995
- video.addEventListener('loadedmetadata', () => {
996
- previewVideo.src = video.src;
997
- previewVideo.preload = "auto";
998
  updatePlaybackRate(speedRange.value);
999
  updateVolume(volumeRange.value);
1000
  updateSubtitleSize(subtitleSize.value);
 
707
  const subtitleTrackElement = document.getElementById('subtitleTrackElement');
708
  const videoContainer = document.querySelector('.video-container');
709
  const controls = document.querySelector('.controls');
 
710
 
711
  // 初期設定
712
  video.controls = false;
 
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);
 
978
  document.addEventListener('webkitfullscreenchange', updateSubtitleScaleForFullscreen);
979
  document.addEventListener('mozfullscreenchange', updateSubtitleScaleForFullscreen);
980
  document.addEventListener('MSFullscreenChange', updateSubtitleScaleForFullscreen);
981
+
982
+ video.addEventListener('loadedmetadata', () => {
 
 
 
 
983
  updatePlaybackRate(speedRange.value);
984
  updateVolume(volumeRange.value);
985
  updateSubtitleSize(subtitleSize.value);