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

Add poster frame support to amp-youtube #1656

Closed
cramforce opened this issue Jan 29, 2016 · 6 comments
Closed

Add poster frame support to amp-youtube #1656

cramforce opened this issue Jan 29, 2016 · 6 comments
Assignees
Milestone

Comments

@cramforce
Copy link
Member

Youtube has an API for retrieving a poster frame. The URL is like this: http://img.youtube.com/vi/{{ videoId }}/maxresdefault.jpg

If AMP is in prerender mode, we currently don't render YT embeds. We should render the poster frame instead.

You can do that by implementing

/** @override */
    prerenderAllowed() {
      return true;
    }

in amp-youtube and then returning true from layoutCallback if only the poster frame was added. When the user goes to the page, layoutCallback should then be called again (I think :).

@jridgewell
Copy link
Contributor

Related to #1175?

@cramforce
Copy link
Member Author

@jridgewell Yeah, I knew I had it already, but didn't find it :)

@cramforce
Copy link
Member Author

Lets do #1657 first, though. They are very similar.

@rudygalfi rudygalfi added this to the M2 milestone Jan 30, 2016
@mkhatib
Copy link
Contributor

mkhatib commented Feb 1, 2016

@cramforce what do you mean by "if only the poster frame was added"? Do we expect the users to manually add amp-img for the amp-youtube or do we automatically add that for them?

I've just sent #1718 PR for addressing #1657 - If I am to follow the same logic there I'd probably check if we're in prerender mode and insert an image (or an amp-img) and return from layoutCallback before inserting the iframe. Does that make sense or am I missing something?

@dvoytenko
Copy link
Contributor

I'd assume we can just add one ourselves - no need for "poster" attribute or "amp-img" tag set manually.

@cramforce
Copy link
Member Author

@mkhatib Yes, the logic is the same. The main difference is that we can compute the URL ourselves, so there is no need for an additional attribute.

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

5 participants