Skip to content

Powr player component#19043

Merged
aghassemi merged 7 commits intoampproject:masterfrom
powrvideo:powr-player
Nov 2, 2018
Merged

Powr player component#19043
aghassemi merged 7 commits intoampproject:masterfrom
powrvideo:powr-player

Conversation

@chadladensack
Copy link
Copy Markdown
Contributor

This is an amp-powr-player component to implement a Powr player as outlined in #18960.

@alanorozco
Copy link
Copy Markdown
Member

Hi @chadladensack. Thanks for opening your PR again. I see you're still making changes so please ping me here once this is good to go!

@Gregable
Copy link
Copy Markdown
Member

Validator changes look good.

@chadladensack
Copy link
Copy Markdown
Contributor Author

Hey @alanorozco, when I opened this new PR, the travis build was failing due to a node version update that existed in the master branch. The only difference between this PR and the original was the master merge in 128ebc4.

We don't anticipate any modifications to the PR. If you notice anything during the review, let me know and I can jump on them right away.

Copy link
Copy Markdown
Member

@alanorozco alanorozco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good, only a few change requests.

this.muted_ = false;

/** @private {?boolean} */
this.hasAmpSupport_ = false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one took me a second to figure out :) Consider renaming to frameHasAmpSupport_.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the amp-powr-player component would always have AMP support lol. +1 for the rename.

this.playing_ = false;
}

if (redispatch(element, eventType, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: define as top-level constant so the dictionary doesn't get recreated each time a message gets received.

'<amp-powr-player> %s',
el);

const src = 'https://player.powr.com/iframe.html?' +
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use addParamsToUrl:

const srcPrefix = 'https://player.powr.com/iframe.html';

const srcParams = dict({
  'account': account,
  'player': this.playerId_,
});

if (video) {
   srcParams['video'] = video;
}
if (terms) {
   srcParams['terms'] = terms;
}

const src = addParamsToUrl(srcPrefix, srcParams);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid idea. Makes it a lot easier to follow.

@alanorozco
Copy link
Copy Markdown
Member

Thanks for your changes! Looks pretty solid to me.

/to @aghassemi for a second pair of eyes and we should be good to go!

Copy link
Copy Markdown
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very close to finish line. A few requests. Thanks!

@@ -0,0 +1,446 @@
/**
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018

' Ensure it has the iframe plugin.', this.playerId_);
}, 3000);

this.playerReadyResolver_(this.iframe_);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolving the ready promise too early. You wanna resolve inside your onReady. Maybe this was meant to be inside the timer above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Moved the resolve into onReady_.

this.playerReadyResolver_ = deferred.resolve;

// Warn if the player does not have video interface support
this.readyTimeout_ = Services.timerFor(window).delay(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timer should start after the iframe is loaded. I think <1000ms between iframe loaded and readyMessage received should be enough to detect whether player is supporting the interface or not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This readyTimeout_ was meant to prompt the publisher to configure their powr player to use the required iframe plugin.

We recently modified the amp-powr-player iframe src ( https://player.powr.com/iframe.html) to automatically include the player iframe plugin, rendering readyTimeout_ obsolete. I'll be removing it shortly.

@@ -0,0 +1,233 @@
/**
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all dates to 2018

@@ -0,0 +1,62 @@
#
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: "data-terms"
mandatory_oneof: "['data-video', 'data-terms']"
}
attrs: { name: "[data-referrer]" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to list data- unless mandatory or wanna enforce pattern for the value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one would be necessary since it's an amp-bind attribute and not just a data- attribute value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure we're all on the same page, I will leave data-referrer in the validation since it's an amp-bind attribute.

Copy link
Copy Markdown
Contributor

@honeybadgerdontcare honeybadgerdontcare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validation looks good with some change requests.

@@ -0,0 +1,62 @@
#
# Copyright 2016 The AMP HTML Authors. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure years in the licenses are the current year. In this case it should be 2018 not 2016.

mandatory_oneof: "['data-video', 'data-terms']"
value_regex: "[0-9a-zA-Z-]+"
}
attrs: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please list attributes alphabetically by name, IOW data-terms should go before data-video.

name: "data-terms"
mandatory_oneof: "['data-video', 'data-terms']"
}
attrs: { name: "[data-referrer]" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one would be necessary since it's an amp-bind attribute and not just a data- attribute value.

Copy link
Copy Markdown
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aghassemi aghassemi merged commit d605aff into ampproject:master Nov 2, 2018
twifkak added a commit to twifkak/amphtml that referenced this pull request Nov 2, 2018
twifkak added a commit to twifkak/amphtml that referenced this pull request Nov 2, 2018
@twifkak twifkak mentioned this pull request Nov 2, 2018
twifkak added a commit that referenced this pull request Nov 3, 2018
* cl/219531121 Revision bump for #17481

* cl/219850294 Allow `http` scheme for links in email spec

* cl/219866890 Revision bump for #19043

* cl/219867113 Revision bump for #18981

* cl/219877087 Make ESlint happy.

* cl/219882876 Fix lint for #19096
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
* cl/219531121 Revision bump for ampproject#17481

* cl/219850294 Allow `http` scheme for links in email spec

* cl/219866890 Revision bump for ampproject#19043

* cl/219867113 Revision bump for ampproject#18981

* cl/219877087 Make ESlint happy.

* cl/219882876 Fix lint for ampproject#19096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants