amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[Story format] Greatly increase timeout before dispatching "storyContentLoaded" event

Open gmajoulet opened this issue 5 years ago • 1 comments

The storyContentLoaded event has the same timeout as the amp-story-renderer service, which is 2900ms. This event is used by Players to know when the initial content is loaded. Use cases include:

  1. The open source Story Web Player uses it as a heuristic to start prerendering the following story
  2. Some players could use it to show an animation (eg: loading spinner) or a preview before revealing the fully loaded content

(1) makes performance really bad because on a slow initial story load, we'd bloat the network even more by prerendering the next story. (2) just doesn't work for half the users, as the story would get revealed too early because of the timeout.

We should keep a timeout for code safety, I suggest 8000ms which seems to be the 95th percentile according to the metrics we have.

cc @ampproject/wg-stories

gmajoulet avatar Jan 20 '21 18:01 gmajoulet

8k LGTM

flaviori avatar Jan 20 '21 19:01 flaviori