Skip to content

Making amp-video an extension + backwards compatibility (the real one!) (used git mv here)#6686

Closed
chenshay wants to merge 10 commits intoampproject:masterfrom
chenshay:goodvideo
Closed

Making amp-video an extension + backwards compatibility (the real one!) (used git mv here)#6686
chenshay wants to merge 10 commits intoampproject:masterfrom
chenshay:goodvideo

Conversation

@chenshay
Copy link
Copy Markdown
Contributor

@chenshay chenshay commented Dec 15, 2016

  1. Moving all functionality to amp-video extension
  2. Backwards compatibility
  3. Create Video Manager only when you need it and only once

@chenshay chenshay changed the title Making amp-video an extension + backwards compatibility Making amp-video an extension + backwards compatibility - the real one. Used git mv here. Dec 15, 2016
@cramforce
Copy link
Copy Markdown
Member

Could you run
gulp dist and
gulp size
to see the size impact of this?

Thanks!

Copy link
Copy Markdown
Member

@cramforce cramforce left a comment

Choose a reason for hiding this comment

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

Nice. This was simpler than I thought :) See comment above about assessing size impact.

I think @aghassemi figured out a way for adding a warnings that sites can use to add the script tag.

import * as sinon from 'sinon';

describe('amp-video', () => {
describe('amp-video, backwards compatibility', () => {
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.

Can/should we add any assertions here?

@chenshay chenshay changed the title Making amp-video an extension + backwards compatibility - the real one. Used git mv here. Making amp-video an extension + backwards compatibility (the real one!) (used git mv here) Dec 15, 2016
@cramforce
Copy link
Copy Markdown
Member

@chenshay The tool actually generated a file that you can commit into the change to see a diff. Or just use git diff to see changed lines.

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.

This is looking great! Just a few more requests.

Files still are not showing up as a move but that's okay, we can leave with that history is not lost anyway, there are ways to get to it.

/** @private {?Function} */
this.playerReadyResolver_ = null;

const ampdoc = ampdocServiceFor(this.win).getAmpDoc();
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 move this to buildCallback and keep constructor purely for declarations

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.

done

/** @private {?Element} */
this.video_ = null;

const ampdoc = ampdocServiceFor(this.win).getAmpDoc();
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.

ditto, move to buildCallback

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.

done

# See the License for the specific language governing permissions and
# limitations under the license.
#

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.

we still need the "script" section you had in the previous PR. with unique_warning: true changed to unique: true as @honeybadgerdontcare suggested.

(The script section is about validation rules on the <script src=..amp-video-0.1-> itself, something that did no exist before but now is needed since amp-video is its own extension now)

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.

done

/** @private {?Function} */
this.playerReadyResolver_ = null;

const ampdoc = ampdocServiceFor(this.win).getAmpDoc();
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.

ditto, buildCallback

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.

done

attrs: { name: "height" }
attrs: { name: "width" }
}
# 4.7.6 The video element
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.

don't remove this section. This one is about <video> not <amp-video>

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.

done

html_format: AMP4ADS
tag_name: "AMP-VIDEO"
disallowed_ancestor: "AMP-SIDEBAR"
also_requires_tag_warning: "amp-video extension .js script"
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.

@cramforce This rule is the one that creates the warning if users don't include the <script> tag.

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.

ack

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.

validation lgtm

@aghassemi
Copy link
Copy Markdown
Contributor

@chenshay For the failing tests:
1- we have a Fake Video Player in test-video-manager.js which also needs the installVideoManager code you added to the other video players.
2- amp-video autoplay tests failing might be related to the testing framework trying to load the wrong script tag for amp-video. Try adding the amp-video script tag to video-players.html.

tag_name: "AMP-VIDEO"
spec_name: "amp-video extension .js script"
mandatory_parent: "HEAD"
unique_warning: true
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 needs to be unique: true. It shouldn't be a warning if it is new.

Copy link
Copy Markdown
Contributor

@honeybadgerdontcare honeybadgerdontcare Dec 15, 2016

Choose a reason for hiding this comment

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

Please move unique, mandatory_parent and spec_name to SCRIPT instead of AMP-VIDEO. Add also_requires_tag: amp-video to SCRIPT.

}
attrs: { name: "width" }
spec_url: "https://www.ampproject.org/docs/reference/amp-video.html"
}
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.

Looks like erroneous whitespace and tabs got introduced here. Please fix.

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.

done

@aghassemi
Copy link
Copy Markdown
Contributor

Note that #6680 made changes to old amp-video, needs to be merged with this one

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 great. Let's just merge the changes from #6680 here as well and we should be good to merge Thanks!

@chenshay
Copy link
Copy Markdown
Contributor Author

tried git mv another time:
#6743

@chenshay chenshay closed this Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants