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

Click to play not working #1361

Closed
maxhartshorn opened this issue Jan 8, 2016 · 2 comments
Closed

Click to play not working #1361

maxhartshorn opened this issue Jan 8, 2016 · 2 comments

Comments

@maxhartshorn
Copy link

As I understand it, the idea of Click To Play iframe functionality is to display a placeholder image which the user needs to click on in order to display the iframe content. A use case would be displaying a placeholder screenshot over an iframed video player. Clicking the screenshot would trigger the video player.

This is not how it is currently working in Chrome. When I run test/manual/amp-iframe-clicktoplay.html. The specified iframe loads with the placeholder image as one would expect. Once the iframe is loaded the placeholder is removed and the rest of the iframe is loaded automatically. This is useful in many cases, but it is certainly not "click" to play functionality.

Looking at the code it's apparent that the Click To Play placeholder is simply being removed the iframe's onload event:

 iframe.onload = () => {
      // Chrome does not reflect the iframe readystate.
      iframe.readyState = 'complete';
      this.activateIframe_();
 };

...

/**
   * Makes the iframe visible.
   * @private
   */
  activateIframe_() {
    this.getVsync().mutate(() => {
      if (this.placeholder_) {
        this.iframe_.style.zIndex = '';
        removeElement(this.placeholder_);
        this.placeholder_ = null;
      }
    });
  }

Is your intention to implement Click To Play functionality on our iframes eventually? That would be a useful feature. If not, why call it Click to Play?

@rudygalfi
Copy link
Contributor

@maxhartshorn Thanks for raising this. For context, raised this in the original Intent to Implement (#571 (comment)).

Yes, I think we should either update the docs to avoid using the "click-to-play" terminology (since there's no click required) or implement behavior where the rendering of the iframe will block on a click/tap. Or do both.

@rudygalfi
Copy link
Contributor

Closed by #1386

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

No branches or pull requests

3 participants