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 new data attributes to amp-jwplayer #35163

Merged
merged 15 commits into from
Sep 9, 2021

Conversation

mamaddox
Copy link
Contributor

@mamaddox mamaddox commented Jul 9, 2021

This PR will...

  • Add support for additional data attributes for the amp-jwplayer extension.
  • Gather consent data.
  • Fix duplicate analytic events being emitted during ad playback by removing incorrect event mappings.

Relates to:

@CLAassistant
Copy link

CLAassistant commented Jul 9, 2021

CLA assistant check
All committers have signed the CLA.

@mamaddox mamaddox changed the title ✨ βœ… πŸ› Add new data attributes to amp-jwplayer ✨ βœ… πŸ› πŸ“– Add new data attributes to amp-jwplayer Jul 12, 2021
@mamaddox mamaddox changed the title ✨ βœ… πŸ› πŸ“– Add new data attributes to amp-jwplayer ✨ βœ… πŸ› Add new data attributes to amp-jwplayer Jul 12, 2021
@mamaddox mamaddox marked this pull request as ready for review July 12, 2021 15:21
@amp-owners-bot amp-owners-bot bot requested a review from dmanek July 12, 2021 15:21
@kristoferbaxter
Copy link
Contributor

Adding @alanorozco to the issue, and I should be able to look tomorrow.

Copy link
Contributor

@kristoferbaxter kristoferbaxter left a comment

Choose a reason for hiding this comment

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

Left a few comments and a nit, adding @alanorozco to review as well.

extensions/amp-jwplayer/0.1/amp-jwplayer.js Outdated Show resolved Hide resolved
extensions/amp-jwplayer/0.1/amp-jwplayer.js Show resolved Hide resolved
const configJSON = element.getAttribute('data-config-json');
const config = tryParseJson(configJSON) || {};

Object.keys(configAttributes).forEach((attr) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@alanorozco Thoughts? This appears to be a filter + copy.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like data-config-json and data-config-json-* are equivalent with the latter overriding specific properties in the former. It's the same case with data-ad-cust-params and adMacro*

I would suggest that we stick to a single API, either a single attribute with all properties, or single attributes setting every property. But not both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are actually only three options for the data-config-* attribute, data-config-skin, data-config-plugin, and data-config-json, so data-config-json-* attributes are not expected. They follow that data-config-* naming convention because they are player config settings.

getDataParamsFromAttributes was used to grab those first two together, but they can instead be explicitly grabbed like this:

const configSkin = element.getAttribute('data-config-skin');
const configPlugin = element.getAttribute('data-config-plugin');

The data-ad-* attributes are similar in that they are player ad settings. So data-ad-cust-params is standalone, but multiple adMacros can be set with data-ad-macro-*.

All these attributes are set on the config object to be sent together to the player, but that object can be renamed or a separate one can be used to make it more clear.
Open to any thoughts and ideas.

@kristoferbaxter kristoferbaxter removed the request for review from dmanek July 21, 2021 17:33
@kristoferbaxter
Copy link
Contributor

I've kicked off the systems to run CI/CD as well.

@kristoferbaxter
Copy link
Contributor

@mamaddox Can you follow the instructions here to get this build running on CI?

Pasted for convenience.

ERROR: pull/35163 is missing the latest CircleCI config revision e1c2d0fbaf2e37c36e57474f74129601714c3795.


This can be fixed in three ways:


1. Click the "Update branch" button on GitHub and follow instructions.
   β€· It can be found towards the bottom of the PR, after the list of checks.


2. Pull the latest commits from main and re-push the PR branch.
   β€· Follow these steps:

      git checkout main
      git pull
      git checkout <PR branch>
      git merge main
      git push origin


3. Rebase on main and re-push the PR branch.
   β€· Follow these steps:

      git checkout main
      git pull
      git checkout <PR branch>
      git rebase main
      git push origin --force

Zack Haigh and others added 7 commits July 27, 2021 16:33
* Add setup method

* create separate postMessage method and add setup test

* adding support for data-params and querystring

* updating tests for data-params

* re-adding unit test i accidentally removed

* Pass custom config added through amp to player

* Use correct import format

* updated attribute names

* adding code suggestions

* Add test coverage and fix formatting

* Move test config to above assertation

* Update media id and player id for vast ad config

* Add cust-params data attribute for ads

* testing

* Integrate with amp-consent and add custom macros

* Lint fixes

Co-authored-by: Daniel Lee <[email protected]>
@mamaddox
Copy link
Contributor Author

@kristoferbaxter Rebased the branch and fixed the other CircleCI issues, so should be good now.

@kristoferbaxter
Copy link
Contributor

Approved the CI pipeline.

mamaddox and others added 2 commits August 2, 2021 10:31
    Update our amp-jwplayer docs with the new attributes
    Add amp-jwplayer in the docs where it applies
@aliciahurst
Copy link
Contributor

hi @kristoferbaxter! just a quick nudge from the JW Player side, any update on when this will be merged and released?

@kristoferbaxter kristoferbaxter merged commit e73aba1 into ampproject:main Sep 9, 2021
rbeckthomas pushed a commit to rbeckthomas/amphtml that referenced this pull request Sep 14, 2021
* Add JW Player to documentation that applies

* Revert "Add JW Player to documentation that applies"

This reverts commit 5aeba5a.

* Extend AMP Params (ampproject#62)

* Add setup method

* create separate postMessage method and add setup test

* adding support for data-params and querystring

* updating tests for data-params

* re-adding unit test i accidentally removed

* Pass custom config added through amp to player

* Use correct import format

* updated attribute names

* adding code suggestions

* Add test coverage and fix formatting

* Move test config to above assertation

* Update media id and player id for vast ad config

* Add cust-params data attribute for ads

* testing

* Integrate with amp-consent and add custom macros

* Lint fixes

Co-authored-by: Daniel Lee <[email protected]>

* Remove bad import

* Clean up consentgdpr

* Add comment about appending querystring

* Clean up from rebase

* Remove trailing whitespaces

* Remove controls attribute

* πŸ“–  [JW8-11873] Update JW Player AMP Docs (ampproject#61)


    Update our amp-jwplayer docs with the new attributes
    Add amp-jwplayer in the docs where it applies

* cleanup rebase

* lint fixes

Co-authored-by: Zack Haigh <[email protected]>
Co-authored-by: Daniel Lee <[email protected]>
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.

6 participants