Travor278 commited on
Commit
0195933
·
verified ·
1 Parent(s): d6d6d08

Sync task-browser source with deployed camera playback controls

Browse files
Files changed (1) hide show
  1. browser/index.html +3 -1
browser/index.html CHANGED
@@ -89,11 +89,13 @@ function bindVideos(){
89
  el.querySelector('[data-play]').onclick=async()=>{
90
  const time=vs[0].currentTime;vs.forEach(v=>{if(v.readyState)v.currentTime=time});
91
  try{await Promise.all(vs.map(v=>v.play()));clearInterval(timer);timer=setInterval(()=>{if(!el.isConnected){clearInterval(timer);return}for(const v of vs.slice(1))if(v.readyState&&Math.abs(v.currentTime-vs[0].currentTime)>.25)v.currentTime=vs[0].currentTime},400)}
92
- catch(e){error.hidden=false;error.textContent='无法同步启动,请点击各播放器播放按钮,或切换到三视角同步 MP4。'}
93
  };
94
  el.querySelector('[data-pause]').onclick=pause;
95
  el.querySelector('[data-reset]').onclick=()=>{pause();vs.forEach(v=>{if(v.readyState)v.currentTime=0})};
96
  vs[0].addEventListener('ended',pause);
 
 
97
  });
98
  }
99
  function drawReference(){
 
89
  el.querySelector('[data-play]').onclick=async()=>{
90
  const time=vs[0].currentTime;vs.forEach(v=>{if(v.readyState)v.currentTime=time});
91
  try{await Promise.all(vs.map(v=>v.play()));clearInterval(timer);timer=setInterval(()=>{if(!el.isConnected){clearInterval(timer);return}for(const v of vs.slice(1))if(v.readyState&&Math.abs(v.currentTime-vs[0].currentTime)>.25)v.currentTime=vs[0].currentTime},400)}
92
+ catch(e){pause();error.hidden=false;error.textContent='无法同步启动,请点击各播放器播放按钮,或切换到三视角同步 MP4。'}
93
  };
94
  el.querySelector('[data-pause]').onclick=pause;
95
  el.querySelector('[data-reset]').onclick=()=>{pause();vs.forEach(v=>{if(v.readyState)v.currentTime=0})};
96
  vs[0].addEventListener('ended',pause);
97
+ vs[0].addEventListener('pause',pause);
98
+ vs[0].addEventListener('seeked',()=>{for(const v of vs.slice(1))if(v.readyState&&Math.abs(v.currentTime-vs[0].currentTime)>.05)v.currentTime=vs[0].currentTime});
99
  });
100
  }
101
  function drawReference(){