Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Story Player] Load player iframes sequentially when starting from other than first story #31212

Closed
mszylkowski opened this issue Nov 17, 2020 · 2 comments · Fixed by #32153
Closed

Comments

@mszylkowski
Copy link
Contributor

mszylkowski commented Nov 17, 2020

Describe the new feature or change to an existing feature you'd like to see

The player loads too many stories at once and there is code to optimize the loading for the first story, but if you start with the second Story it takes forever to load.

We need to change the logic from:
load the current story as visible + 2 others as prerender
to:
load the current story as visible, and once it's done, load the next one as prerender

Additional context

Publishers load a story using show()

  • in that show() method, there's this line that finds the adjascent stories
  • And this line will start the logic that will position + preload the stories
  • the story will prerender, or load, when you call this line here
  • it's gated behind navigationPromise that's a deferred that waits for the visible story to send its storyContentLoaded event

Related to #31562, #31925

@gmajoulet
Copy link
Contributor

Crossposting:

Objective

Improve LCP of the visible Story when using the show() method on the non first Story.
Calling show() to display the n-th story should be just as fast as displaying the first Story.

How

Loading a Story is using quite some bandwidth, and loading several at once introduces significant delays on the LCP of the visible one.
We should always:

  1. Load the visible story, and wait for storyContentLoaded event, then
  2. Load the N + 1 story with a prerender visibilitystate. No need to prerender the previous one until user tries swiping to it

@gmajoulet
Copy link
Contributor

cc @ampproject/wg-stories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants