authorclover caruso <git@paperclover.net> 2026-10-16 01:01:32-07:00
committerclover caruso <git@paperclover.net> 2026-10-16 19:37:07-07:00
log62d00c88cc019087d79d6ac2fbb0d4ea4b56ad0e
tree547489fb3726e1e57fd1daccd2896762dad16da2
parent7cd13df720d3e3b96d29bdb8f8b2507840fa3b90
signature Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs (~clover)

fix(clover-video): call onCloverVideoInit through window

a bare optional call still throws ReferenceError when the global was never declared, which is every page but history-of-japan-reanimated. Assisted-by: claude-opus-5.5

1 files changed, 6 insertions(+), 6 deletions(-)

src/tags/clover-video.client.ts+6-6
...@@ -136,7 +136,7 @@ function hydrateVideoInner(...@@ -136,7 +136,7 @@ function hydrateVideoInner(
136 }136 }
137 video.src = src;137 video.src = src;
138 video.controls = true;138 video.controls = true;
139 onCloverVideoInit?.(id, video);139 window.onCloverVideoInit?.(id, video);
140 return;140 return;
141 }141 }
142 if (mode === "av1" && !hasDash) {142 if (mode === "av1" && !hasDash) {
...@@ -239,10 +239,10 @@ function hydrateVideoInner(...@@ -239,10 +239,10 @@ function hydrateVideoInner(
239 enableSafariAirplay();239 enableSafariAirplay();
240 player.attachView(video);240 player.attachView(video);
241 if (objectUrl) video.play();241 if (objectUrl) video.play();
242 onCloverVideoInit?.(id, video);242 window.onCloverVideoInit?.(id, video);
243 });243 });
244 video.controls = true;244 video.controls = true;
245 onCloverVideoInit?.(id, video);245 window.onCloverVideoInit?.(id, video);
246246
247 // This proxying is for ManagedMediaSource, exposing the HLS stream for AirPlay247 // This proxying is for ManagedMediaSource, exposing the HLS stream for AirPlay
248 function enableSafariAirplay() {248 function enableSafariAirplay() {
...@@ -273,7 +273,7 @@ function hydrateVideoInner(...@@ -273,7 +273,7 @@ function hydrateVideoInner(
273 hlsSource.src = hlsFile;273 hlsSource.src = hlsFile;
274 video.appendChild(hlsSource);274 video.appendChild(hlsSource);
275 video.controls = true;275 video.controls = true;
276 onCloverVideoInit?.(id, video);276 window.onCloverVideoInit?.(id, video);
277 } else if (mode === "hls-polyfill") {277 } else if (mode === "hls-polyfill") {
278 hls!.then((hls) => {278 hls!.then((hls) => {
279 // @ts-expect-error suspicious279 // @ts-expect-error suspicious
...@@ -281,12 +281,12 @@ function hydrateVideoInner(...@@ -281,12 +281,12 @@ function hydrateVideoInner(
281 player.loadSource(hlsFile);281 player.loadSource(hlsFile);
282 player.attachMedia(video);282 player.attachMedia(video);
283 video.controls = true;283 video.controls = true;
284 onCloverVideoInit?.(id, video);284 window.onCloverVideoInit?.(id, video);
285 });285 });
286 } else {286 } else {
287 video.src = src;287 video.src = src;
288 video.controls = true;288 video.controls = true;
289 onCloverVideoInit?.(id, video);289 window.onCloverVideoInit?.(id, video);
290 }290 }
291}291}
292292