@@ -1164,15 +1164,47 @@ describe("VirtualPreview replay", () => {
11641164 } ) ;
11651165
11661166 it . each ( [
1167- { initiallyPlaying : true , firstIntent : undefined , nextIntent : undefined , shouldPlay : true } ,
1168- { initiallyPlaying : true , firstIntent : true , nextIntent : undefined , shouldPlay : true } ,
1169- { initiallyPlaying : true , firstIntent : true , nextIntent : false , shouldPlay : false } ,
1170- { initiallyPlaying : false , firstIntent : undefined , nextIntent : undefined , shouldPlay : false } ,
1171- ] ) ( "keeps a source-switch scrub playing unless explicitly paused: $firstIntent → $nextIntent" , ( {
1167+ {
1168+ initiallyPlaying : true ,
1169+ firstIntent : undefined ,
1170+ nextIntent : undefined ,
1171+ shouldPlay : true ,
1172+ intermediateImplicitSeek : false ,
1173+ } ,
1174+ {
1175+ initiallyPlaying : true ,
1176+ firstIntent : true ,
1177+ nextIntent : undefined ,
1178+ shouldPlay : true ,
1179+ intermediateImplicitSeek : false ,
1180+ } ,
1181+ {
1182+ initiallyPlaying : true ,
1183+ firstIntent : true ,
1184+ nextIntent : false ,
1185+ shouldPlay : false ,
1186+ intermediateImplicitSeek : false ,
1187+ } ,
1188+ {
1189+ initiallyPlaying : false ,
1190+ firstIntent : undefined ,
1191+ nextIntent : undefined ,
1192+ shouldPlay : false ,
1193+ intermediateImplicitSeek : false ,
1194+ } ,
1195+ {
1196+ initiallyPlaying : true ,
1197+ firstIntent : true ,
1198+ nextIntent : false ,
1199+ shouldPlay : false ,
1200+ intermediateImplicitSeek : true ,
1201+ } ,
1202+ ] ) ( "keeps source-switch intent (playing $initiallyPlaying; intermediate $intermediateImplicitSeek; next $nextIntent)" , ( {
11721203 initiallyPlaying,
11731204 firstIntent,
11741205 nextIntent,
11751206 shouldPlay,
1207+ intermediateImplicitSeek,
11761208 } ) => {
11771209 const sources : VideoSource [ ] = [
11781210 { id : "a1" , src : "file:///tmp/a1.mp4" , label : "a1" } ,
@@ -1204,11 +1236,23 @@ describe("VirtualPreview replay", () => {
12041236 if ( ! nextElement || nextElement === firstElement ) throw new Error ( "source did not switch" ) ;
12051237 const nextVideo = driveVideo ( nextElement ) ;
12061238 expect ( nextElement . paused ) . toBe ( true ) ;
1239+ if ( intermediateImplicitSeek ) {
1240+ act ( ( ) => {
1241+ seekTarget = { timeSec : 6.25 , requestId : 2 } ;
1242+ view . rerender (
1243+ < VirtualPreview videoSources = { sources } clips = { clips } seekTarget = { seekTarget } /> ,
1244+ ) ;
1245+ } ) ;
1246+ }
12071247
12081248 // Pointerup or a later drag position arrives while the new decoder is
12091249 // still paused before metadata. It must retain the scrub's play intent.
12101250 act ( ( ) => {
1211- seekTarget = { timeSec : 6.5 , requestId : 2 , preservePlayback : nextIntent } ;
1251+ seekTarget = {
1252+ timeSec : 6.5 ,
1253+ requestId : intermediateImplicitSeek ? 3 : 2 ,
1254+ preservePlayback : nextIntent ,
1255+ } ;
12121256 view . rerender (
12131257 < VirtualPreview videoSources = { sources } clips = { clips } seekTarget = { seekTarget } /> ,
12141258 ) ;
0 commit comments