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
Description
Stories send a viewer message
storyContentLoadedfor our definition of "initial content is loaded and playback is ready". It is only sent when thevisibilitystateisvisibleand never whenprerender, which we do need now.The event is blocked by
storyLayoutPromisehere:amphtml/extensions/amp-story/1.0/amp-story.js
Lines 991 to 998 in ca6f01c
We do need to run this code after
this.initializePages_(), but no need to block onthis.getAmpDoc().whenFirstVisible(), cf:amphtml/extensions/amp-story/1.0/amp-story.js
Lines 941 to 944 in ca6f01c
cc @ampproject/wg-stories
Alternatives Considered
Additional Context
No response