htmlamp-htmlamp-story

amp-story-player in a popup doesn't load the video


I embedded an amp-story in a webpage with the amp-story-player and it worked perfectly... until I moved it into a popup modal box. Since then the video isn't loading when the modal is displayed. (Initially the modal is in display: none; state, and after clicking a button it becomes display: flex;.)

However if I resize the browser window, the video suddenly starts playing.

How could I tell the player to start playing the story when the modal is shown?


Solution

  • I've found a solution.

    If the amp-story-player is added to the DOM only when the modal is displayed (for example with the createElement and appendChild JavaScript methods, or appended to the innerHTML content of the modal), then this problem isn't present