Skip to content

[Story] Send storyContentLoaded event during prerendering #36288

@gmajoulet

Description

@gmajoulet

Description

Stories send a viewer message storyContentLoaded for our definition of "initial content is loaded and playback is ready". It is only sent when the visibilitystate is visible and never when prerender, which we do need now.

The event is blocked by storyLayoutPromise here:

storyLayoutPromise
.then(() =>
this.whenInitialContentLoaded_(INITIAL_CONTENT_LOAD_TIMEOUT_MS)
)
.then(() => {
this.markStoryAsLoaded_();
this.initializeLiveStory_();
});

We do need to run this code after this.initializePages_(), but no need to block on this.getAmpDoc().whenFirstVisible(), cf:

const storyLayoutPromise = Promise.all([
this.getAmpDoc().whenFirstVisible(), // Pauses execution during prerender.
this.initializePages_(),
])

cc @ampproject/wg-stories

Alternatives Considered

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions