amphtml
amphtml copied to clipboard
amp-youtube stops videos after initial video load in amp-lightbox
What's the issue?
When using the amp-youtube element inside of amp-lightbox, after the initial video has played - any videos to play after will just freeze and continuously stop working.
How do we reproduce the issue?
I have created a JSFiddle which reproduces this issue: https://jsfiddle.net/f4rjn2wg/2/
- Click any button to open the lightbox with the video in it.
- Close the lightbox
- Open another video (or the same one) by clicking one of the buttons
- The video will then continuously freeze rather than play as intended
I have created another example below it outside of the lightbox to demonstrate what sort of result I would expect.
What browsers are affected?
All major browsers I have tested
Which AMP version is affected?
Latest version
This reproduces more simply without amp-bind:
<button on="tap: lightbox">Open</button>
<amp-lightbox id="lightbox" layout="nodisplay">
<div>
<amp-youtube
width="480"
height="270"
layout="responsive"
data-videoid="5IZrYeUX3MI"
></amp-youtube>
<button on="tap: lightbox.close">close</button>
</div>
</amp-lightbox>
- When closing the lightbox, the
<amp-youtube>element is unlaid out. - When opening the lightbox a second time, the
<amp-youtube>element is laid out again.
The VideoManager then incorrectly stores two entries. When playing for a second time it will pauseOtherVideos(), incorrectly pausing itself—so the video never plays.
Fix on #32220