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(
136136 }
137137 video.src = src;
138138 video.controls = true;
139 onCloverVideoInit?.(id, video);
139 window.onCloverVideoInit?.(id, video);
140140 return;
141141 }
142142 if (mode === "av1" && !hasDash) {
......@@ -239,10 +239,10 @@ function hydrateVideoInner(
239239 enableSafariAirplay();
240240 player.attachView(video);
241241 if (objectUrl) video.play();
242 onCloverVideoInit?.(id, video);
242 window.onCloverVideoInit?.(id, video);
243243 });
244244 video.controls = true;
245 onCloverVideoInit?.(id, video);
245 window.onCloverVideoInit?.(id, video);
246246
247247 // This proxying is for ManagedMediaSource, exposing the HLS stream for AirPlay
248248 function enableSafariAirplay() {
......@@ -273,7 +273,7 @@ function hydrateVideoInner(
273273 hlsSource.src = hlsFile;
274274 video.appendChild(hlsSource);
275275 video.controls = true;
276 onCloverVideoInit?.(id, video);
276 window.onCloverVideoInit?.(id, video);
277277 } else if (mode === "hls-polyfill") {
278278 hls!.then((hls) => {
279279 // @ts-expect-error suspicious
......@@ -281,12 +281,12 @@ function hydrateVideoInner(
281281 player.loadSource(hlsFile);
282282 player.attachMedia(video);
283283 video.controls = true;
284 onCloverVideoInit?.(id, video);
284 window.onCloverVideoInit?.(id, video);
285285 });
286286 } else {
287287 video.src = src;
288288 video.controls = true;
289 onCloverVideoInit?.(id, video);
289 window.onCloverVideoInit?.(id, video);
290290 }
291291}
292292