@@ -393,14 +393,9 @@ function outPointHoldTime(el: HTMLMediaElement, outPoint: number, watched: boole
393393 return last ?. outPoint === outPoint ? last . at : outPoint ;
394394}
395395
396- // A muted video starts 0.04 to 0.4 s after play() and cannot be timed from the last start, so an upcoming
397- // video is played from its pre-roll, hidden, and catches up on the playhead at a speed the eye never sees.
398396const VIDEO_PREROLL_SECONDS = 1 ;
399- // A clip with no source before its first frame starts on that frame this far ahead; half the lead hold keeps a
400- // clip that starts instantly under it, since the hold would pause the clip at the cut and it would restart late.
401397const VIDEO_MIN_LEAD_SECONDS = VIDEO_LEAD_HOLD_SECONDS / 2 ;
402398
403- /** A render (export or frame-injected) paints video from its own frames, so a pre-roll would only seek it. */
404399const isRenderDriven = ( el : HTMLMediaElement ) : boolean =>
405400 ! ! findInjectedRenderFrame ( el ) ||
406401 ( "__HF_EXPORT_RENDER_SEEK_CONFIG" in window && ! ! window . __HF_EXPORT_RENDER_SEEK_CONFIG ) ;
@@ -491,8 +486,6 @@ export function syncRuntimeMedia(params: {
491486 ! inWindow &&
492487 ( params . timeSeconds >= clip . end || sameInstant ( params . timeSeconds , clip . end ) ) &&
493488 isClipVisibleAt ( params . timeSeconds , clip . start , clip . end , params . getCompositionDuration ( ) ) ;
494- // A pre-rolled video's target runs up to its first frame from before it (not before the file's start),
495- // where the clip's own time is clamped.
496489 const relTime =
497490 startsEarly && isNonLoopVideo
498491 ? Math . max ( 0 , clip . mediaStart - dueIn * rateAt ( clipRate , 0 ) )
@@ -726,10 +719,10 @@ export function syncRuntimeMedia(params: {
726719 strictDriftSamples . set ( el , 0 ) ;
727720 }
728721 const forceSync = ! isPlayingMedia && ! holdingAhead && params . forceSync && drift > 0.02 ;
729- // A pre-rolled video is steered hard, which assumes the visibility pass hides it until its clip starts.
722+ const isHiddenPreRoll = el . tagName === "VIDEO" && startedEarly . has ( el ) ;
730723 const steered =
731724 isPlayingMedia && ! hardSync
732- ? steerMedia ( el , offset , baseRate , offsetStabilized , undefined , startedEarly . has ( el ) )
725+ ? steerMedia ( el , offset , baseRate , offsetStabilized , undefined , isHiddenPreRoll )
733726 : null ;
734727 const steerSeeks = steered ?. seek === true ;
735728 const dipped = steerSeeks && params . seekUnderDip ?.( el , relTime ) === true ;
@@ -743,7 +736,6 @@ export function syncRuntimeMedia(params: {
743736 // ignore unsupported playbackRate
744737 swallow ( "runtime.media.site1" , err ) ;
745738 }
746- // A pre-rolled video is seeked to its pre-roll before it plays, once.
747739 const prerollSeek =
748740 startsEarly &&
749741 isNonLoopVideo &&
0 commit comments