@@ -1187,6 +1187,43 @@ describe("initSandboxRuntimeModular", () => {
11871187 expect ( video . style . visibility ) . toBe ( "visible" ) ;
11881188 } ) ;
11891189
1190+ it ( "keeps a long video starting at zero local to its delayed composition host" , ( ) => {
1191+ const root = document . createElement ( "div" ) ;
1192+ root . setAttribute ( "data-composition-id" , "main" ) ;
1193+ root . setAttribute ( "data-root" , "true" ) ;
1194+ root . setAttribute ( "data-start" , "0" ) ;
1195+ root . setAttribute ( "data-duration" , "120" ) ;
1196+ document . body . appendChild ( root ) ;
1197+
1198+ const host = document . createElement ( "div" ) ;
1199+ host . setAttribute ( "data-composition-id" , "nested-video" ) ;
1200+ host . setAttribute ( "data-composition-file" , "compositions/nested.html" ) ;
1201+ host . setAttribute ( "data-start" , "39.233" ) ;
1202+ host . setAttribute ( "data-duration" , "80" ) ;
1203+ root . appendChild ( host ) ;
1204+
1205+ const video = document . createElement ( "video" ) ;
1206+ video . setAttribute ( "data-start" , "0" ) ;
1207+ video . setAttribute ( "data-duration" , "80" ) ;
1208+ video . load = ( ) => { } ;
1209+ host . appendChild ( video ) ;
1210+
1211+ window . __timelines = {
1212+ main : createMockTimeline ( 120 ) ,
1213+ "nested-video" : createMockTimeline ( 80 ) ,
1214+ } ;
1215+
1216+ initSandboxRuntimeModular ( ) ;
1217+
1218+ for ( const globalTime of [
1219+ 42.353 , 49.412 , 56.471 , 63.529 , 70.588 , 77.647 , 84.706 , 91.765 , 98.824 , 105.882 , 112.941 ,
1220+ ] ) {
1221+ window . __player ?. renderSeek ( globalTime ) ;
1222+ expect ( video . style . visibility , `global ${ globalTime } s` ) . toBe ( "visible" ) ;
1223+ }
1224+ expect ( window . __hfResolveMediaStartSeconds ?.( video ) ) . toBeCloseTo ( 39.233 ) ;
1225+ } ) ;
1226+
11901227 it ( "uses the canonical resolver for reference starts, auto-start media, and inline hosts" , ( ) => {
11911228 const root = document . createElement ( "div" ) ;
11921229 root . setAttribute ( "data-composition-id" , "main" ) ;
0 commit comments