seawolf2357 commited on
Commit
73dcfd7
·
verified ·
1 Parent(s): 1b3b2af

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +31 -47
index.html CHANGED
@@ -802,24 +802,18 @@ body{font-family:'Outfit',sans-serif;background:var(--bg);color:var(--text);marg
802
  <!-- ===== LEFT: ANCHOR VIDEO ===== -->
803
  <div class="ln-video-col">
804
  <div class="ln-video-wrap">
805
- <video id="lnVideo" muted playsinline autoplay loop></video>
806
  <div class="ln-video-live-badge"><span class="dot"></span>ON AIR</div>
807
  <div class="ln-video-progress" id="lnVideoProgress"></div>
808
  <div class="ln-video-overlay">
809
  <div class="ln-video-anchor-name" id="lnVideoAnchorName">P&D LIVE ANCHOR</div>
810
- <div class="ln-video-clip-info" id="lnVideoClipInfo">Clip 1/4 · Studio Broadcast</div>
811
  </div>
812
  </div>
813
  <div class="ln-video-meta">
814
- <div class="ln-video-indicator" id="lnVideoIndicator">
815
- <div class="ln-video-dot active" data-clip="0" onclick="switchVideoClip(0)"></div>
816
- <div class="ln-video-dot" data-clip="1" onclick="switchVideoClip(1)"></div>
817
- <div class="ln-video-dot" data-clip="2" onclick="switchVideoClip(2)"></div>
818
- <div class="ln-video-dot" data-clip="3" onclick="switchVideoClip(3)"></div>
819
- </div>
820
  <div class="ln-video-studio-info">
821
  🎬 P&D LIVE STUDIO<br>
822
- <span style="color:rgba(255,255,255,0.35)">4 Camera Angles · Auto Rotation</span>
823
  </div>
824
  <!-- Mini counters under video -->
825
  <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;margin-top:auto;">
@@ -2780,11 +2774,8 @@ async function fetchNpcProfile(agentId){
2780
 
2781
  /* ====== 🔴 P&D LIVE NEWS ====== */
2782
 
2783
- /* ── Video Clip Rotation Engine ── */
2784
  const LN_VIDEO_CLIPS = [
2785
- {src:'/videos/V1.mp4', label:'Studio Broadcast', anchor:'LIVE ANCHOR'},
2786
- {src:'/videos/V2.mp4', label:'Breaking Alert', anchor:'ALERT DESK'},
2787
- {src:'/videos/V3.mp4', label:'Production Floor', anchor:'FIELD REPORT'},
2788
  {src:'/videos/V4.mp4', label:'Newsroom Command', anchor:'NEWSROOM'},
2789
  ];
2790
  let lnVideoIdx = 0, lnVideoRotateTimer = null, lnVideoProgressTimer = null, lnVideoReady = false;
@@ -2792,65 +2783,58 @@ let lnVideoIdx = 0, lnVideoRotateTimer = null, lnVideoProgressTimer = null, lnVi
2792
  function initVideoPlayer(){
2793
  const vid = document.getElementById('lnVideo');
2794
  if(!vid) return;
2795
- // Load first clip
2796
  vid.src = LN_VIDEO_CLIPS[0].src;
2797
- vid.muted = true;
 
2798
  vid.playsInline = true;
2799
  vid.load();
2800
- // On canplay, start playback
2801
  vid.addEventListener('canplay', function onFirstPlay(){
2802
- vid.play().catch(()=>{});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2803
  lnVideoReady = true;
2804
  vid.removeEventListener('canplay', onFirstPlay);
2805
  });
2806
- // On ended (if not loop), go to next clip
2807
- vid.addEventListener('ended', ()=> switchVideoClip((lnVideoIdx+1) % LN_VIDEO_CLIPS.length));
2808
- // Auto-rotate every 15s regardless of video length
2809
- startVideoRotation();
2810
  // Progress bar
2811
  vid.addEventListener('timeupdate', updateVideoProgress);
2812
- updateVideoIndicator(0);
2813
  updateVideoLabel(0);
2814
  }
2815
 
2816
  function startVideoRotation(){
2817
- if(lnVideoRotateTimer) clearInterval(lnVideoRotateTimer);
2818
- lnVideoRotateTimer = setInterval(()=>{
2819
- if(cTab !== 'livenews') return; // only rotate when visible
2820
- switchVideoClip((lnVideoIdx + 1) % LN_VIDEO_CLIPS.length);
2821
- }, 15000);
2822
  }
2823
 
2824
  function switchVideoClip(idx){
2825
- const vid = document.getElementById('lnVideo');
2826
- if(!vid || idx === lnVideoIdx && lnVideoReady) return;
2827
- lnVideoIdx = idx;
2828
- // Fade out
2829
- vid.classList.add('fade-out');
2830
- setTimeout(()=>{
2831
- vid.src = LN_VIDEO_CLIPS[idx].src;
2832
- vid.load();
2833
- vid.play().then(()=>{
2834
- vid.classList.remove('fade-out');
2835
- }).catch(()=> vid.classList.remove('fade-out'));
2836
- }, 400);
2837
- updateVideoIndicator(idx);
2838
- updateVideoLabel(idx);
2839
- // Reset rotation timer on manual switch
2840
- startVideoRotation();
2841
  }
2842
 
2843
  function updateVideoIndicator(idx){
2844
- const dots = document.querySelectorAll('.ln-video-dot');
2845
- dots.forEach((d,i)=> d.classList.toggle('active', i===idx));
2846
  }
2847
 
2848
  function updateVideoLabel(idx){
2849
- const clip = LN_VIDEO_CLIPS[idx];
2850
  const nameEl = document.getElementById('lnVideoAnchorName');
2851
  const infoEl = document.getElementById('lnVideoClipInfo');
2852
  if(nameEl) nameEl.textContent = clip.anchor;
2853
- if(infoEl) infoEl.textContent = `Clip ${idx+1}/${LN_VIDEO_CLIPS.length} · ${clip.label}`;
2854
  }
2855
 
2856
  function updateVideoProgress(){
 
802
  <!-- ===== LEFT: ANCHOR VIDEO ===== -->
803
  <div class="ln-video-col">
804
  <div class="ln-video-wrap">
805
+ <video id="lnVideo" playsinline autoplay loop></video>
806
  <div class="ln-video-live-badge"><span class="dot"></span>ON AIR</div>
807
  <div class="ln-video-progress" id="lnVideoProgress"></div>
808
  <div class="ln-video-overlay">
809
  <div class="ln-video-anchor-name" id="lnVideoAnchorName">P&D LIVE ANCHOR</div>
810
+ <div class="ln-video-clip-info" id="lnVideoClipInfo">NEWSROOM · Live Broadcast</div>
811
  </div>
812
  </div>
813
  <div class="ln-video-meta">
 
 
 
 
 
 
814
  <div class="ln-video-studio-info">
815
  🎬 P&D LIVE STUDIO<br>
816
+ <span style="color:rgba(255,255,255,0.35)">NEWSROOM · Continuous Broadcast</span>
817
  </div>
818
  <!-- Mini counters under video -->
819
  <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;margin-top:auto;">
 
2774
 
2775
  /* ====== 🔴 P&D LIVE NEWS ====== */
2776
 
2777
+ /* ── Video Player: V4 Single Clip with Sound ── */
2778
  const LN_VIDEO_CLIPS = [
 
 
 
2779
  {src:'/videos/V4.mp4', label:'Newsroom Command', anchor:'NEWSROOM'},
2780
  ];
2781
  let lnVideoIdx = 0, lnVideoRotateTimer = null, lnVideoProgressTimer = null, lnVideoReady = false;
 
2783
  function initVideoPlayer(){
2784
  const vid = document.getElementById('lnVideo');
2785
  if(!vid) return;
2786
+ // Load V4 clip only
2787
  vid.src = LN_VIDEO_CLIPS[0].src;
2788
+ vid.muted = false; // Sound ON
2789
+ vid.loop = true; // Continuous loop
2790
  vid.playsInline = true;
2791
  vid.load();
2792
+ // On canplay, start playback with sound
2793
  vid.addEventListener('canplay', function onFirstPlay(){
2794
+ vid.muted = false;
2795
+ vid.play().catch(()=>{
2796
+ // Browser may block unmuted autoplay; try muted first then unmute
2797
+ vid.muted = true;
2798
+ vid.play().then(()=>{
2799
+ // Unmute after a short delay or on user interaction
2800
+ vid.muted = false;
2801
+ }).catch(()=>{});
2802
+ // Also try unmuting on first user interaction
2803
+ const unmuteOnClick = ()=>{
2804
+ vid.muted = false;
2805
+ vid.play().catch(()=>{});
2806
+ document.removeEventListener('click', unmuteOnClick);
2807
+ document.removeEventListener('touchstart', unmuteOnClick);
2808
+ };
2809
+ document.addEventListener('click', unmuteOnClick, {once:true});
2810
+ document.addEventListener('touchstart', unmuteOnClick, {once:true});
2811
+ });
2812
  lnVideoReady = true;
2813
  vid.removeEventListener('canplay', onFirstPlay);
2814
  });
 
 
 
 
2815
  // Progress bar
2816
  vid.addEventListener('timeupdate', updateVideoProgress);
 
2817
  updateVideoLabel(0);
2818
  }
2819
 
2820
  function startVideoRotation(){
2821
+ // No rotation needed - single clip with loop
 
 
 
 
2822
  }
2823
 
2824
  function switchVideoClip(idx){
2825
+ // Single clip only - no switching needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2826
  }
2827
 
2828
  function updateVideoIndicator(idx){
2829
+ // No indicators needed
 
2830
  }
2831
 
2832
  function updateVideoLabel(idx){
2833
+ const clip = LN_VIDEO_CLIPS[0];
2834
  const nameEl = document.getElementById('lnVideoAnchorName');
2835
  const infoEl = document.getElementById('lnVideoClipInfo');
2836
  if(nameEl) nameEl.textContent = clip.anchor;
2837
+ if(infoEl) infoEl.textContent = `NEWSROOM · Live Broadcast`;
2838
  }
2839
 
2840
  function updateVideoProgress(){