@@ -414,98 +414,116 @@ describe("runProbeStage — forceScreenshot threading", () => {
414414 } ) ;
415415
416416 // Scene in-point 5 and clip trim 1: the collector starts picture and sound at source 6.
417- it . each ( [
418- { tagName : "video" , existing : false } ,
419- { tagName : "audio" , existing : false } ,
420- { tagName : "video" , existing : true } ,
421- { tagName : "audio" , existing : true } ,
422- ] ) ( "retains a runtime $tagName rate (existing: $existing)" , async ( { tagName, existing } ) => {
423- resetRetryMocks ( ) ;
424- browserMediaResults = [
425- {
417+ const runtimeRates = [
418+ 1.5 ,
419+ {
420+ target : "rate" ,
421+ points : [
422+ { t : 0 , v : 1 } ,
423+ { t : 3 , v : 2 } ,
424+ ] ,
425+ } satisfies RateSpec ,
426+ ] ;
427+ it . each (
428+ runtimeRates . flatMap ( ( playbackRate ) => [
429+ { tagName : "video" , existing : false , playbackRate } ,
430+ { tagName : "audio" , existing : false , playbackRate } ,
431+ { tagName : "video" , existing : true , playbackRate } ,
432+ { tagName : "audio" , existing : true , playbackRate } ,
433+ ] ) ,
434+ ) (
435+ "retains a runtime $tagName rate (existing: $existing, rate: $playbackRate)" ,
436+ async ( { tagName, existing, playbackRate } ) => {
437+ resetRetryMocks ( ) ;
438+ browserMediaResults = [
439+ {
440+ id : "clip" ,
441+ tagName,
442+ src : "clip.mp4" ,
443+ start : 0 ,
444+ end : 3 ,
445+ duration : 3 ,
446+ mediaStart : 0.5 ,
447+ playbackRate,
448+ loop : false ,
449+ hasAudio : true ,
450+ volume : 1 ,
451+ muted : false ,
452+ } ,
453+ ] ;
454+ const { runProbeStage } = await import ( "./probeStage.js" ) ;
455+ const input = makeProbeInput ( { } ) ;
456+ const clip = {
426457 id : "clip" ,
427- tagName,
428458 src : "clip.mp4" ,
429459 start : 0 ,
430460 end : 3 ,
431- duration : 3 ,
432461 mediaStart : 0.5 ,
433- playbackRate : 1.5 ,
434- loop : false ,
435- hasAudio : true ,
436- volume : 1 ,
437- muted : false ,
438- } ,
439- ] ;
440- const { runProbeStage } = await import ( "./probeStage.js" ) ;
441- const input = makeProbeInput ( { } ) ;
442- const clip = {
443- id : "clip" ,
444- src : "clip.mp4" ,
445- start : 0 ,
446- end : 3 ,
447- mediaStart : 0.5 ,
448- playbackRate : 1 ,
449- } ;
450- if ( existing && tagName === "video" ) {
451- input . composition . videos . push ( { ...clip , loop : false , hasAudio : true } ) ;
452- input . composition . audios . push ( { ...clip , id : "clip-audio" , layer : 0 , type : "video" } ) ;
453- }
454- if ( existing && tagName === "audio" ) {
455- input . composition . audios . push ( { ...clip , layer : 0 , type : "audio" } ) ;
456- }
462+ playbackRate : 1 ,
463+ } ;
464+ if ( existing && tagName === "video" ) {
465+ input . composition . videos . push ( { ...clip , loop : false , hasAudio : true } ) ;
466+ input . composition . audios . push ( { ...clip , id : "clip-audio" , layer : 0 , type : "video" } ) ;
467+ }
468+ if ( existing && tagName === "audio" ) {
469+ input . composition . audios . push ( { ...clip , layer : 0 , type : "audio" } ) ;
470+ }
457471
458- await runProbeStage ( input ) ;
472+ await runProbeStage ( input ) ;
459473
460- const media = tagName === "video" ? input . composition . videos : input . composition . audios ;
461- expect ( media [ 0 ] ) . toMatchObject ( { playbackRate : 1.5 , mediaStart : 0.5 } ) ;
462- if ( existing && tagName === "video" ) {
463- expect ( input . composition . audios [ 0 ] ) . toMatchObject ( { playbackRate : 1.5 , mediaStart : 0.5 } ) ;
464- }
465- } ) ;
474+ const media = tagName === "video" ? input . composition . videos : input . composition . audios ;
475+ expect ( media [ 0 ] ) . toMatchObject ( { playbackRate, mediaStart : 0.5 } ) ;
476+ if ( existing && tagName === "video" ) {
477+ expect ( input . composition . audios [ 0 ] ) . toMatchObject ( { playbackRate, mediaStart : 0.5 } ) ;
478+ }
479+ } ,
480+ ) ;
466481
467- it ( "preserves a collected speed ramp during scalar browser reconciliation" , async ( ) => {
468- resetRetryMocks ( ) ;
469- browserMediaResults = [
470- {
482+ it . each ( runtimeRates ) (
483+ "preserves a collected speed ramp during browser rate %j reconciliation" ,
484+ async ( browserRate ) => {
485+ resetRetryMocks ( ) ;
486+ browserMediaResults = [
487+ {
488+ id : "clip" ,
489+ tagName : "video" ,
490+ src : "clip.mp4" ,
491+ start : 0 ,
492+ end : 3 ,
493+ duration : 3 ,
494+ mediaStart : 0 ,
495+ playbackRate : browserRate ,
496+ loop : false ,
497+ hasAudio : false ,
498+ volume : 1 ,
499+ muted : false ,
500+ } ,
501+ ] ;
502+ const { runProbeStage } = await import ( "./probeStage.js" ) ;
503+ const input = makeProbeInput ( { } ) ;
504+ const playbackRate = {
505+ target : "rate" ,
506+ points : [
507+ { t : 0 , v : 1.25 } ,
508+ { t : 2 , v : 2 } ,
509+ ] ,
510+ } satisfies RateSpec ;
511+ input . composition . videos . push ( {
471512 id : "clip" ,
472- tagName : "video" ,
473513 src : "clip.mp4" ,
474514 start : 0 ,
475515 end : 3 ,
476- duration : 3 ,
477516 mediaStart : 0 ,
478- playbackRate : 1 ,
517+ playbackRate,
479518 loop : false ,
480519 hasAudio : false ,
481- volume : 1 ,
482- muted : false ,
483- } ,
484- ] ;
485- const { runProbeStage } = await import ( "./probeStage.js" ) ;
486- const input = makeProbeInput ( { } ) ;
487- const playbackRate = {
488- target : "rate" ,
489- points : [
490- { t : 0 , v : 1 } ,
491- { t : 3 , v : 2 } ,
492- ] ,
493- } satisfies RateSpec ;
494- input . composition . videos . push ( {
495- id : "clip" ,
496- src : "clip.mp4" ,
497- start : 0 ,
498- end : 3 ,
499- mediaStart : 0 ,
500- playbackRate,
501- loop : false ,
502- hasAudio : false ,
503- } ) ;
520+ } ) ;
504521
505- await runProbeStage ( input ) ;
522+ await runProbeStage ( input ) ;
506523
507- expect ( input . composition . videos [ 0 ] ?. playbackRate ) . toEqual ( playbackRate ) ;
508- } ) ;
524+ expect ( input . composition . videos [ 0 ] ?. playbackRate ) . toEqual ( playbackRate ) ;
525+ } ,
526+ ) ;
509527
510528 it . each ( [
511529 { pageStart : 1 , expected : 6 } ,
0 commit comments