question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add autoplay mode for amp-story

See original GitHub issue

amp-story Autoplay Mode

Overview

We would like to have stories play inline in embedded contexts (e.g. feeds), automatically advancing through all pages in the story without any user interaction. If the user taps on the story, it can open full-screen, at which point the document is opened “normally”, where the user can manually navigate between pages, and the story is most likely shown in a larger container.

Requirements

  • The embedding context must be able to initialize the document in this state, so that there is no transition between the normal document state and the “autoplay” mode
  • The embedding context must be able to subsequently toggle the document between states after it has been initialized

API Design

Option 1: New PREVIEW VisibilityState

We add a new generic enum value to VisibilityState, like PREVIEW, where each component can optionally change its logic depending on its value. By default, PREVIEW can be equivalent to VISIBLE, unless the component overrides this behavior. amp-story’s autoplay mode then just becomes an implementation detail of how the amp-story component chooses to implement the PREVIEW VisibilityState.

The PREVIEW state can be defined as the document being visible to the user, but being passively consumed (whereas VISIBLE would mean the document is visible and actively consumed).

VISIBILITY_STATES = {
  HIDDEN: 'hidden',
  INACTIVE: 'inactive',
  PAUSED: 'paused',
  PRERENDER: 'prerender',
  PREVIEW: 'preview',
  VISIBLE: 'visible',
};

Option 2: New fragment parameter and request name

We can add autoplay mode as its own new fragment parameter and message/request name. For example we can append #autoplay=1 to the URL to initialize the state; to modify this state, the embedding context can send a message like autoplayMode with e.g. a boolean payload enabling/disabling the mode. /cc @flaviori @christianbersch

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
newmuiscommented, Sep 15, 2022

/to @coreymasanto can this be closed?

0reactions
newmuiscommented, Jul 22, 2021

Reviving this – we’d like to reconsider option 1 and determine the amount of effort needed to support this. The primary change to what is written above is that we’d like to, instead, make this PREVIEW equivalent to PRERENDER by default.

However, given that previews are indeed user-visible, this new state would allow further customization to ensure that each component looks as users would expect while this state is active (e.g. videos can be played (assuming that their source(s) were able to be loaded))

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set your story to autoplay on load - Flourish Help
By adding an additional HTML attribute to your embed code, your stories can autoplay when the page where they are embedded is loaded....
Read more >
Documentation: <amp-story> - amp.dev
An AMP story is a complete AMP HTML document that is comprised of pages, within the pages ... We still recommend adding Structured...
Read more >
Google AMP - Video - Tutorialspoint
Having this attribute on amp-video will autoplay the video if browser supports .The video will play in a muted mode and user will...
Read more >
HTML video autoplay Attribute - W3Schools
Add muted after autoplay to let your video file start playing automatically (but muted). Browser Support. The numbers in the table specify the...
Read more >
AMP Story video - CodePen
Add Class(es) to <html>. Adding Classes. In CodePen, whatever you write in the HTML editor is what goes within the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found