@lalalic/markcut 3.2.22 → 3.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@ import {SceneThumbnails} from '../player/components/SceneThumbnails';
7
7
  import {useWebAudioPreview} from './web-audio-preview';
8
8
  import {useBrowserSpeechPreview} from './browser-speech-preview';
9
9
  const PLAYER_VERSION='v25';
10
+ const contextTime=(scene:{start:number;end:number}|undefined,time:number)=>
11
+ Math.round(Math.max(scene?.start??0,Math.min(scene?.end??time,time))*10)/10;
10
12
  function App(){
11
13
  const [revision,setRevision]=React.useState<any>(()=>(window as any).__markcutRevision||null);
12
14
  const ref=React.useRef<PlayerRef|null>(null);
@@ -35,7 +37,7 @@ function App(){
35
37
  const fps=data?.fps||30;
36
38
  const scenes=React.useMemo(()=>{
37
39
  const children=(data?.children||[]).filter((x:any)=>x.type==='scene'&&x.visible!==false);
38
- const overlap=Math.max(0,Number(data?.transitionTime)||0);
40
+ const overlap=data?.transition?Math.max(0,Number(data?.transitionTime)||0):0;
39
41
  let start=0;
40
42
  return children.map((scene:any,index:number)=>{
41
43
  const duration=Math.max(0,Number(scene.durationInSeconds)||0);
@@ -54,12 +56,12 @@ function App(){
54
56
  const active=[...scenes].reverse().find(scene=>currentTime>=scene.start);
55
57
  (window as any).__markcutPlaybackContext={
56
58
  sceneId:active?.id||null,sceneName:active?.name||null,
57
- timeSeconds:Math.round(currentTime*10)/10
59
+ timeSeconds:contextTime(active,currentTime)
58
60
  };
59
61
  },[scenes,currentTime]);
60
62
  const activeScene=[...scenes].reverse().find(scene=>currentTime>=scene.start);
61
63
  React.useEffect(()=>{
62
- window.dispatchEvent(new CustomEvent('markcut:scene-change',{detail:{sceneId:activeScene?.id||null,sceneName:activeScene?.name||null,timeSeconds:Math.round(currentTime*10)/10}}));
64
+ window.dispatchEvent(new CustomEvent('markcut:scene-change',{detail:{sceneId:activeScene?.id||null,sceneName:activeScene?.name||null,timeSeconds:contextTime(activeScene,currentTime)}}));
63
65
  },[revision?.revisionId,activeScene?.id,activeScene?.name]);
64
66
  React.useEffect(()=>{
65
67
  const listener=(event:Event)=>{const context=(event as CustomEvent).detail;const scene=scenes.find(x=>x.id===context?.sceneId||x.name===context?.sceneName);