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

AMP.setState not working on amp-youtube PLAY event #12210

Closed
SoleSS opened this issue Nov 27, 2017 · 2 comments
Closed

AMP.setState not working on amp-youtube PLAY event #12210

SoleSS opened this issue Nov 27, 2017 · 2 comments
Assignees

Comments

@SoleSS
Copy link

SoleSS commented Nov 27, 2017

Steps to reproduce problem:

add amp-youtube object
add any other object <amp-img src=... [class]="objClass">
add on event to amp-youtube
but when you click play button of youtube object - nothing happens... (on="tap:..." - works perfect)

<amp-youtube
                    on="play:AMP.setState({prom: 'hidden'})"
                    data-param-controls=0 data-param-rel=0 data-param-showinfo=0 data-videoid="SOME VIDEO ID" layout="responsive" width="1200" height="550"></amp-youtube>

<div class="width-100pc block-overlay top-20pc absolute" [class]="prom">SOME TEXT</div>

idea is: on play button click hide all elements which are positioned above video and of course on pause\end of video elements have to be returned to unhidden state... (with on="pause... event)

@aghassemi
Copy link
Contributor

@SoleSS There is no play event exposed on amp-youtube. #8971 is the feature request for it however until we can reliability confirm that the play event is based on a user-interactin ( e.g. not autoplay ) it will not be allowed to setState regardless.

As mentioned on #12165 , you can use a custom overlay to capture the first tap to hide your container. See https://ampbyexample.com/advanced/click-to-play_overlay_for_amp-video/ for a sample.

@aghassemi aghassemi self-assigned this Nov 27, 2017
@aghassemi
Copy link
Contributor

Closing in favor of #8971

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

No branches or pull requests

2 participants