Skip to content

✨ Add firstPlay event#15074

Merged
alanorozco merged 4 commits intoampproject:masterfrom
alanorozco:firstplay
May 4, 2018
Merged

✨ Add firstPlay event#15074
alanorozco merged 4 commits intoampproject:masterfrom
alanorozco:firstplay

Conversation

@alanorozco
Copy link
Copy Markdown
Member

No description provided.

@alanorozco alanorozco requested a review from aghassemi May 3, 2018 23:12
element.signals().whenSignal(VideoEvents.REGISTERED)
.then(() => this.onRegister_());

//
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.

rm

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

* Trigger event for first manual play.
* @private @const {!function()}
*/
this.triggerFirstPlayOrNoop_ = once(() => {
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.

let's make the naming and location of the method match existing timeUpdateActionEvent_ method.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The event is fired per-video, so it should be at the entry level. Unless you mean firstPlay should be triggered once per document?

* Trigger event for first manual play.
* @private @const {!function()}
*/
this.triggerFirstPlayOrNoop_ = once(() => {
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.

🙇 for adding once to our library, so useful.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's been handy once or twice before 🤓

*/
this.triggerFirstPlayOrNoop_ = once(() => {
const trust = ActionTrust.LOW;
const event = createCustomEvent(this.ampdoc_.win, 'firstPlay',
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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

const trust = ActionTrust.LOW;
const event = createCustomEvent(this.ampdoc_.win, 'firstPlay',
/* detail */ {});
const actions = Services.actionServiceForDoc(this.ampdoc_);
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.actions_ should be available.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's available at the manager level, see comment above.

*/
this.triggerFirstPlayOrNoop_ = once(() => {
const trust = ActionTrust.LOW;
const event = createCustomEvent(this.ampdoc_.win, 'firstPlay',
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.

const for firstPlay (mostly yo make it consistent with timeUpdateActionEvent_)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants