@@ -104,20 +104,10 @@ export const SessionPlayer = ({
104104 }
105105 return { window : entry . window , from : toSession ( entry . at ) , to } ;
106106 } ) ;
107- } , [
108- timeline ,
109- sessionStart ,
110- terminalAnchor ,
111- browserAnchor ,
112- castDuration ,
113- videoDuration ,
114- ] ) ;
107+ } , [ timeline , sessionStart , terminalAnchor , browserAnchor , castDuration , videoDuration ] ) ;
115108
116109 const duration = acts . at ( - 1 ) ?. to ?? 0 ;
117- const ready =
118- castDuration !== null &&
119- videoDuration !== null &&
120- Number . isFinite ( duration ) ;
110+ const ready = castDuration !== null && videoDuration !== null && Number . isFinite ( duration ) ;
121111
122112 const actAt = ( time : number ) : number => {
123113 for ( let i = acts . length - 1 ; i >= 0 ; i -= 1 ) {
@@ -133,9 +123,7 @@ export const SessionPlayer = ({
133123 const mediaTime = ( window : Act [ "window" ] , time : number ) : number =>
134124 Math . max (
135125 0 ,
136- ( sessionStart +
137- time * 1000 -
138- ( window === "terminal" ? terminalAnchor : browserAnchor ) ) /
126+ ( sessionStart + time * 1000 - ( window === "terminal" ? terminalAnchor : browserAnchor ) ) /
139127 1000 ,
140128 ) ;
141129
@@ -178,22 +166,15 @@ export const SessionPlayer = ({
178166 if ( act . window === "browser" ) {
179167 cast ?. pause ( ) ;
180168 if ( video ) {
181- const target = Math . min (
182- mediaTime ( "browser" , time ) ,
183- ( videoDuration ?? Infinity ) - 0.05 ,
184- ) ;
185- if ( Math . abs ( video . currentTime - target ) > 0.25 )
186- video . currentTime = target ;
169+ const target = Math . min ( mediaTime ( "browser" , time ) , ( videoDuration ?? Infinity ) - 0.05 ) ;
170+ if ( Math . abs ( video . currentTime - target ) > 0.25 ) video . currentTime = target ;
187171 if ( play ) await video . play ( ) . catch ( ( ) => { } ) ;
188172 else video . pause ( ) ;
189173 }
190174 } else {
191175 videoRef . current ?. pause ( ) ;
192176 if ( cast ) {
193- const target = Math . min (
194- mediaTime ( "terminal" , time ) ,
195- ( castDuration ?? Infinity ) - 0.05 ,
196- ) ;
177+ const target = Math . min ( mediaTime ( "terminal" , time ) , ( castDuration ?? Infinity ) - 0.05 ) ;
197178 const current = cast . getCurrentTime ( ) ;
198179 const now = typeof current === "number" ? current : await current ;
199180 if ( Math . abs ( now - target ) > 0.25 ) await cast . seek ( target ) ;
@@ -220,9 +201,7 @@ export const SessionPlayer = ({
220201 const current = castPlayer . current ?. getCurrentTime ( ) ?? 0 ;
221202 media = typeof current === "number" ? current : await current ;
222203 }
223- const wall =
224- ( act . window === "terminal" ? terminalAnchor : browserAnchor ) +
225- media * 1000 ;
204+ const wall = ( act . window === "terminal" ? terminalAnchor : browserAnchor ) + media * 1000 ;
226205 let next = Math . max ( tRef . current , ( wall - sessionStart ) / 1000 ) ;
227206 if ( next >= act . to - 0.05 ) {
228207 if ( index === acts . length - 1 ) {
@@ -263,9 +242,7 @@ export const SessionPlayer = ({
263242 // Live URL: the last main-frame navigation at-or-before "now" (wall).
264243 const wallNow = sessionStart + t * 1000 ;
265244 const currentUrl =
266- [ ...( timeline . nav ?? [ ] ) ]
267- . reverse ( )
268- . find ( ( entry ) => entry . at <= wallNow + 250 ) ?. url ?? "" ;
245+ [ ...( timeline . nav ?? [ ] ) ] . reverse ( ) . find ( ( entry ) => entry . at <= wallNow + 250 ) ?. url ?? "" ;
269246
270247 // Trace markers in session time (only the ones inside the session).
271248 const traceMarks = useMemo (
@@ -346,9 +323,7 @@ export const SessionPlayer = ({
346323 muted
347324 playsInline
348325 preload = "auto"
349- onLoadedMetadata = { ( event ) =>
350- setVideoDuration ( event . currentTarget . duration )
351- }
326+ onLoadedMetadata = { ( event ) => setVideoDuration ( event . currentTarget . duration ) }
352327 />
353328 </ div >
354329 </ div >
@@ -361,9 +336,7 @@ export const SessionPlayer = ({
361336 className = "scrub"
362337 onClick = { ( event ) => {
363338 const rect = event . currentTarget . getBoundingClientRect ( ) ;
364- void seekTo (
365- ( ( event . clientX - rect . left ) / rect . width ) * duration ,
366- ) ;
339+ void seekTo ( ( ( event . clientX - rect . left ) / rect . width ) * duration ) ;
367340 } }
368341 >
369342 { ready &&
@@ -387,12 +360,7 @@ export const SessionPlayer = ({
387360 title = { `${ mark . url . replace ( / ^ h t t p s ? : \/ \/ [ ^ / ] + / , "" ) } → trace ${ mark . id . slice ( 0 , 8 ) } ` }
388361 />
389362 ) ) }
390- { ready && (
391- < span
392- className = "head"
393- style = { { left : `${ ( t / duration ) * 100 } %` } }
394- />
395- ) }
363+ { ready && < span className = "head" style = { { left : `${ ( t / duration ) * 100 } %` } } /> }
396364 </ div >
397365 < span className = "clock" >
398366 { fmt ( t ) } / { ready ? fmt ( duration ) : "…" }
@@ -432,9 +400,7 @@ export const SessionPlayer = ({
432400 </ span >
433401 < span
434402 className = { `trace-ms${ slow ? " slow" : "" } ${
435- mark . status !== undefined && mark . status >= 400
436- ? " err"
437- : ""
403+ mark . status !== undefined && mark . status >= 400 ? " err" : ""
438404 } `}
439405 >
440406 { mark . ms !== undefined ? `${ mark . ms } ms` : "·" }
0 commit comments