fix(playback): retain readiness feedback for embedded Native pages

Show the existing loading state in the playback position row after the Native
page is mounted. Let its slot shrink inside the fitted picture so controls and
the footer remain visible.

Verified the actual shared preview in Chrome at 390 and 1280 pixels with
controlled Native placement acknowledgements, readiness transitions, screenshots
and control hit tests. The actual Windows WebView mount was not exercised.
This commit is contained in:
AAA committed 2026-11-27 14:01:41 -05:00
1 parent 7f5d722147
commit 7e63bad359
2 files changed
+8 -3

No files matched your search

@@ -122,6 +122,7 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
const outputFailed = useSyncExternalStore(playbackOutput.subscribe, () => playbackOutput.failedFor(player.video), () => false);
const showOutputRecovery = outputFailed && !player.error && !player.blocked;
const waiting = player.waitingForPicture && !player.error && !player.blocked;
const nativeWaiting = native.mounted && waiting;
const ownerPaused = player.video?.paused ?? mediaState?.paused ?? paused;
const audioAvailable = player.media.audioAvailable?.() !== false;
const [htmlMedia, setMedia] = useState({ position: 0, duration: 0, volume: 1, muted: false, rate: 1 });
@@ -149,7 +150,7 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
const openOriginal = !owned && website && originalPageAvailable ? onAppWatch : undefined;
const settingsOriginal = !player.error && surface.kind !== "external" && openOriginal;
const localControls = !!player.video || !!receivingSettings || !!settingsOriginal || owned && !embedded;
const hasControls = localControls || !embedded && !thumbnail && !!mediaState;
const hasControls = nativeWaiting || localControls || !embedded && !thumbnail && !!mediaState;
const failure = channelErrorPresentation(player.error, t,
receiving?.mode === "peer" ? "watch.forward.failed" : website && player.video ? "watch.browserFailed" : "watch.failed").message;
const diagnosis = player.error ? diagnoseChannelFact({ area: "error", code: player.error }) : null;
@@ -225,7 +226,7 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
document.addEventListener("fullscreenchange", sync); sync();
return () => { for (const name of events) video.removeEventListener(name, sync); document.removeEventListener("fullscreenchange", sync); };
}, [player]);
return <div ref={slot} className="c3-video c3-mini-player c3-watch-player" data-tooltip-player data-native-page={pageId ? true : undefined} data-external={surface.kind === "external" || undefined} data-embed={embedded || undefined} data-failed={!!player.error || undefined}
return <div ref={slot} className="c3-video c3-mini-player c3-watch-player" data-tooltip-player data-native-page={pageId ? true : undefined} data-native-mounted={native.mounted || undefined} data-external={surface.kind === "external" || undefined} data-embed={embedded || undefined} data-failed={!!player.error || undefined}
data-diagnosis={showDiagnosis || showOutputRecovery && !thumbnail ? true : undefined}
data-standalone={!embedded && (!player.video || !!player.error && player.error !== "watch_update_failed") || undefined} data-thumbnail={!embedded && presentation === "thumbnail" || undefined}
data-controls-hidden={!embedded && visibility.hidden} inert={presentation === "background"}>
@@ -290,6 +291,9 @@ export function ChannelWatchVideo({ player, owned, paused, label, presentation,
{owned && <Btn icon={ownerPaused ? "play" : "pause"} quiet size="dense"
title={ownerPaused ? "watch.play" : "watch.pause"} disabled={disabled} onClick={() => onPlayback({ paused: !ownerPaused })} />}
{!thumbnail && <div className="c3-watch-position" data-seeking={seekPreview !== null || undefined}>
{nativeWaiting && <span className="c3-watch-status" role="status">
<BrandMark size={16} motion="loop" />{t("watch.waiting")}
</span>}
{ended && <span className="c3-watch-status" role="status">{t("watch.ended")}</span>}
{live?.active && !seekAvailable && <span className="c3-watch-status">{t("watch.live")}</span>}
{(!live || seekAvailable) && <span className="c3-watch-time" data-live={!!live || undefined} title={timeLabel}>{live ? timeReadout : <><strong>{formatMediaTime(position)}</strong>{` / ${formatMediaTime(media.duration || Number.NaN)}`}</>}</span>}
@@ -81,7 +81,7 @@
.c3-watch-timeline input { height: 32px; border-radius: 6px; cursor: pointer; touch-action: pan-y; }
.c3-watch-timeline input:disabled { cursor: default; }
.c3-watch-position { display: flex; align-items: center; gap: 6px; min-width: 0; padding-inline: 2px; font-size: 12px; line-height: 1.2; }
.c3-watch-status { flex: none; white-space: nowrap; font-weight: 650; }
.c3-watch-status { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; font-weight: 650; }
.c3-watch-time { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.c3-watch-time[data-live] { white-space: normal; text-overflow: clip; }
.c3-watch-position[data-seeking] .c3-watch-time { color: var(--action); }
@@ -266,6 +266,7 @@
.c3-watch-page-thumbnail > svg { flex: none; }
.c3-watch-native-slot { flex: 1 0 180px; min-width: 0; aspect-ratio: 16 / 9; }
.c3-watch-player[data-native-mounted] > .c3-watch-native-slot { flex-shrink: 1; min-height: 0; }
.c3-watch-player[data-native-page] > .c3-mini-message { position: absolute; inset: 0 0 auto; pointer-events: none; }
.c3-watch-player[data-native-page] > .c3-mini-message button { pointer-events: auto; }
.c3-watch-output .lr-capture-device { width: 100%; padding: 0; pointer-events: auto; }