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

Dynamic playlist tag support (amp-brid-player) #21264

Merged
merged 3 commits into from
Mar 13, 2019

Conversation

grajzer
Copy link
Contributor

@grajzer grajzer commented Mar 5, 2019

Added support for tags in dynamic playlists, and updated documentation for new attribute (#19190)

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@grajzer
Copy link
Contributor Author

grajzer commented Mar 5, 2019

CLA signed.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Mar 5, 2019
@@ -49,7 +49,10 @@ tags: { # <amp-brid-player>
attrs: {
name: "data-playlist"
mandatory_oneof: "['data-outstream', 'data-playlist', 'data-video']"
value_regex: "[0-9]+"
Copy link
Contributor

Choose a reason for hiding this comment

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

I see in the example that data-playlist has text which may be why this restriction is being removed. However removing this restriction allows the value to be anything (including nothing). That doesn't seem ideal. Would (\\d|\\w)+ be sufficient for a valid value? Are there other valid characters in a non-id playlist name?

May also need to update the documentation for data-playlist stating what is allowed. Currently it states ID which till now was just a number.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be OK if we put .+ because we would like to enable users to put anything there? Will update the documentation as you suggested. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is fine. I just want to be sure it's what one would want as it's to prevent someone from doing something wrong unintentionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The requested changes are implemented now.

@alanorozco
Copy link
Member

HI @grajzer. Thanks for contributing.

I see this only makes validator changes. I assume this is already handled in the current src resolution logic?

const itemsNum = this.element.hasAttribute('data-dynamic') ? '10' : '1';
if (this.element.hasAttribute('data-video')) {
feedType = 'video';
} else if (this.element.hasAttribute('data-dynamic')) {
feedType = this.element.getAttribute('data-dynamic');
} else if (this.element.hasAttribute('data-playlist')) {
feedType = 'playlist';
} else if (this.element.hasAttribute('data-outstream')) {
feedType = 'outstream';
}
//Create iframe
const src = 'https://services.brid.tv/services/iframe/' +
encodeURIComponent(feedType) +
'/' + encodeURIComponent(this.feedID_) +
'/' + encodeURIComponent(this.partnerID_) +
'/' + encodeURIComponent(this.playerID_) + '/0/' + itemsNum + '/?amp=1';
this.videoIframeSrc_ = assertAbsoluteHttpOrHttpsUrl(src);
return this.videoIframeSrc_;

If so, we should probably rename itemsNum to something more appropriate.

@grajzer
Copy link
Contributor Author

grajzer commented Mar 6, 2019

Hi @alanorozco, you're right... everything was already handled there and we only need to fix the validation.

The itemsNum really tells how many items to request from our backend and can be 1 or 10, so it would be great if we can keep the name:

const itemsNum = this.element.hasAttribute('data-dynamic') ? '10' : '1';

Thanks for taking a look.

@alanorozco
Copy link
Member

Right! I confused myself with the param order. Nothing on my end from the runtime side, just waiting for validation approval so I can merge. 👍

Copy link
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

@grajzer
Copy link
Contributor Author

grajzer commented Mar 13, 2019

Hi guys, need to ask if I have to do anything else, or you're going to take the merging/deploying process from here? If latter, how long it usually take for code to go live? This is my first change, so please don't mind the question.

@alanorozco alanorozco merged commit 28515b3 into ampproject:master Mar 13, 2019
@alanorozco
Copy link
Member

@grajzer Merged! Please track our releases for this feature.

Gregable pushed a commit that referenced this pull request Mar 20, 2019
 - cl/239414441 Revision bump for #21463
 - cl/239234304 Add deprecation warning for manufactured body caused by non-ASCII whitespace.
 - cl/239228383 Explicitly disallow `<template>` outside the document `<body>`.
 - cl/239220081 Add a feature test case for a non-amp document.
 - cl/239050986 Revision bump for #21459
 - cl/239048160 Fix corner case of ancestor marker tracking.
 - cl/238487968 Revision bump for #21107
 - cl/238483735 Revision bump for #21264
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
Added support for tags in dynamic playlists, and updated documentation for new attribute (ampproject#19190)
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
 - cl/239414441 Revision bump for ampproject#21463
 - cl/239234304 Add deprecation warning for manufactured body caused by non-ASCII whitespace.
 - cl/239228383 Explicitly disallow `<template>` outside the document `<body>`.
 - cl/239220081 Add a feature test case for a non-amp document.
 - cl/239050986 Revision bump for ampproject#21459
 - cl/239048160 Fix corner case of ancestor marker tracking.
 - cl/238487968 Revision bump for ampproject#21107
 - cl/238483735 Revision bump for ampproject#21264
bramanudom pushed a commit to bramanudom/amphtml that referenced this pull request Mar 22, 2019
Added support for tags in dynamic playlists, and updated documentation for new attribute (ampproject#19190)
bramanudom pushed a commit to bramanudom/amphtml that referenced this pull request Mar 22, 2019
 - cl/239414441 Revision bump for ampproject#21463
 - cl/239234304 Add deprecation warning for manufactured body caused by non-ASCII whitespace.
 - cl/239228383 Explicitly disallow `<template>` outside the document `<body>`.
 - cl/239220081 Add a feature test case for a non-amp document.
 - cl/239050986 Revision bump for ampproject#21459
 - cl/239048160 Fix corner case of ancestor marker tracking.
 - cl/238487968 Revision bump for ampproject#21107
 - cl/238483735 Revision bump for ampproject#21264
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.

None yet

5 participants