Skip to content

Skip the demo transcript and intro media at boot when a project will replace them #498

Description

@maboa

index.html ships the demo transcript inline and points #hyperplayer at the remote intro mp3. When a saved project exists, all of that is loaded, rendered and captioned — and then thrown away moments later by the OPFS restore.

#473 already established the signal: a synchronous hyperaudioHasProjects localStorage hint, written at the library's single write choke point, which an inline head script reads to hide the demo transcript before first paint. Today it only hides. The proposal is to also skip the work: don't promote the intro media src, and don't run the boot caption pass, when the hint says a project is coming.

Why

  • Removes a class of race. A caption pass over a document that is about to be discarded parks a loadedmetadata listener holding that document's captions — the cause of the late-write bug fixed in Double captions on the Recents route: the paint flush was never added there (#356/#287) #493 (part 3). That fix is a local defence at the caption door; not doing the pointless work in the first place removes the opportunity rather than defending against it.
  • Drops a wasted remote fetch of lab.hyperaud.io/audio/HLE_Intro_3.mp3 on every boot for every returning user, on a path where the media is guaranteed to be replaced.
  • Less work between load and usable editor for the common case.

What makes it non-trivial

The restore is async and can fail — the boot path explicitly falls back to leaving the demo. So the demo can't simply be removed; it has to be deferred and promoted if the restore fails or times out. #473's ha-restoring class has a 4s failsafe for the transcript; the media would need an equivalent, and the failure mode of getting it wrong is an editor with no media at all. Shape that looks right: hold the intro URL in a data- attribute and promote it to src on the same paths that call revealTranscript() when nothing was restored.

SEO

Worth stating explicitly since the demo transcript is real indexable content. The hint is per-browser localStorage, and #473's own comment notes that crawlers have clean storage — so a crawler still receives the demo transcript and intro media exactly as today, and indexed content is unchanged by this. If we ever wanted to go further and remove the inline demo entirely, SEO would need handling another way (prerendered or static content), which is worth deciding deliberately rather than as a side effect of a boot optimisation.

Related: #493 (the late caption write this reduces the surface for), #473 (the hint and anti-flash machinery).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions