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

♻️ Consolidate players as .i-amphtml-media-component #26967

Merged
merged 3 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/video-autoplay.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ i-amphtml-video-mask {
}

amp-video[controls] .amp-video-eq,
.i-amphtml-video-component:not(amp-video) .amp-video-eq,
.i-amphtml-video-interface:not(amp-video) .amp-video-eq,
amp-story .amp-video-eq {
display: flex;
}
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-audio/0.1/amp-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class AmpAudio extends AMP.BaseElement {
this.buildAudioElement();
}

this.element.classList.add('i-amphtml-media-component');

this.registerAction('play', this.play_.bind(this));
this.registerAction('pause', this.pause_.bind(this));
}
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-connatix-player/0.1/amp-connatix-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class AmpConnatixPlayer extends AMP.BaseElement {
buildCallback() {
const {element} = this;

element.classList.add('i-amphtml-media-component');

// Player id is mandatory
this.playerId_ = userAssert(
element.getAttribute('data-player-id'),
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-hulu/0.1/amp-hulu.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class AmpHulu extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');

this.eid_ = userAssert(
this.element.getAttribute('data-eid'),
'The data-eid attribute is required for <amp-hulu> %s',
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-izlesene/0.1/amp-izlesene.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class AmpIzlesene extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');

this.videoid_ = userAssert(
this.element.getAttribute('data-videoid'),
'The data-videoid attribute is required for <amp-izlesene> %s',
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-jwplayer/0.1/amp-jwplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class AmpJWPlayer extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');

const {element} = this;
this.contentid_ = userAssert(
element.getAttribute('data-playlist-id') ||
Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-kaltura-player/0.1/amp-kaltura-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class AmpKaltura extends AMP.BaseElement {
this.element
);

this.element.classList.add('i-amphtml-media-component');

this.entryId_ = this.element.getAttribute('data-entryid') || 'default';
}

Expand Down
1 change: 1 addition & 0 deletions extensions/amp-megaphone/0.1/amp-megaphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class AmpMegaphone extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');
this.updateBaseUrl_();
}

Expand Down
2 changes: 2 additions & 0 deletions extensions/amp-o2-player/0.1/amp-o2-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class AmpO2Player extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');

this.pid_ = userAssert(
this.element.getAttribute('data-pid'),
'data-pid attribute is required for <amp-o2-player> %s',
Expand Down
5 changes: 5 additions & 0 deletions extensions/amp-reach-player/0.1/amp-reach-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class AmpReachPlayer extends AMP.BaseElement {
return isLayoutSizeDefined(layout);
}

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');
}

/** @override */
layoutCallback() {
const embedId = this.element.getAttribute('data-embed-id') || 'default';
Expand Down
5 changes: 5 additions & 0 deletions extensions/amp-soundcloud/0.1/amp-soundcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class AmpSoundcloud extends AMP.BaseElement {
return isLayoutSizeDefined(layout);
}

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');
}

/**@override*/
layoutCallback() {
const height = this.element.getAttribute('height');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class AmpSpringboardPlayer extends AMP.BaseElement {

/** @override */
buildCallback() {
this.element.classList.add('i-amphtml-media-component');

this.mode_ = userAssert(
this.element.getAttribute('data-mode'),
'The data-mode attribute is required for <amp-springboard-player> %s',
Expand Down
2 changes: 1 addition & 1 deletion src/service/video-manager-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class VideoManager {
const {element} = entry.video;
element.dispatchCustomEvent(VideoEvents.REGISTERED);

element.classList.add('i-amphtml-video-component');
element.classList.add('i-amphtml-media-component');

// Unlike events, signals are permanent. We can wait for `REGISTERED` at any
// moment in the element's lifecycle and the promise will resolve
Expand Down
6 changes: 3 additions & 3 deletions test/visual-diff/visual-tests
Original file line number Diff line number Diff line change
Expand Up @@ -772,21 +772,21 @@
"name": "amp-video-docking (left-to-right)",
"viewport": {"width": 800, "height": 600},
"interactive_tests": "examples/visual-tests/amp-video-docking/amp-video-docking.js",
"loading_complete_selectors": [".i-amphtml-video-component"],
"loading_complete_selectors": [".i-amphtml-video-interface"],
},
{
"url": "examples/visual-tests/amp-video-docking/rtl.html",
"name": "amp-video-docking (right-to-left)",
"viewport": {"width": 800, "height": 600},
"interactive_tests": "examples/visual-tests/amp-video-docking/amp-video-docking.js",
"loading_complete_selectors": [".i-amphtml-video-component"],
"loading_complete_selectors": [".i-amphtml-video-interface"],
},
{
"url": "examples/visual-tests/amp-video-docking/slot.html",
"name": "amp-video-docking (slot)",
"viewport": {"width": 800, "height": 600},
"interactive_tests": "examples/visual-tests/amp-video-docking/amp-video-docking.js",
"loading_complete_selectors": [".i-amphtml-video-component"],
"loading_complete_selectors": [".i-amphtml-video-interface"],
},
]
}