-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-bind: Support amp-youtube #8067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a new test for this on the bind integration tests?
mutatedAttributesCallback(mutations) { | ||
if (mutations['data-videoid'] !== undefined) { | ||
this.videoid_ = this.getVideoId_(); | ||
if (this.iframe_) { // `null` if element hasn't been laid out yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to refresh the iframe, YouTube supports dynamically loading a video which should be much faster than a full reload, the following should work (not tested though)
this.playerReadyPromise_.then(() => {
this.sendCommand_('loadVideoById', this.videoid_);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for pointing this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is short amount of time (actually a good 2 seconds, so not that short :) ) when this.iframe_ is not null but player is not loaded either (meaning commands will be ignored) wrapping the sendCommand_
in the this.playerReadyPromise_.then
will queue it up in those cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually moved the this.playerReadyPromise_.then
to within sendCommand_
to reduce duplication. I assume that we never want to call sendCommand_
before the player is ready as you mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
8fd9509
to
538b9ce
Compare
mutatedAttributesCallback(mutations) { | ||
if (mutations['data-videoid'] !== undefined) { | ||
this.videoid_ = this.getVideoId_(); | ||
if (this.iframe_) { // `null` if element hasn't been laid out yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is short amount of time (actually a good 2 seconds, so not that short :) ) when this.iframe_ is not null but player is not loaded either (meaning commands will be ignored) wrapping the sendCommand_
in the this.playerReadyPromise_.then
will queue it up in those cases.
Done, though the added value isn't great since it doesn't test any logic within |
bd5d8fc
to
b3f6922
Compare
b3f6922
to
6599424
Compare
@kmh287 Gentle ping. |
6599424
to
a3865e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: do we need to also update the bind-validator to specify allowed protocols for amp-youtube like we do for amp-video?
I don't think so since |
* support binding to amp-youtube's data-videoid * unit test * use loadVideoById instead of changing iframe src * fix lint error * add integration test
Partial for #7825.
amp-youtube
'sdata-videoid
attribute./to @aghassemi