Skip to content

Commit

Permalink
Async measure: remove getLayoutSize from video-manager-impl (ampproje…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Voytenko authored and rochapablo committed Aug 30, 2021
1 parent f7cac69 commit 37b1c6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion build-system/test-configs/forbidden-terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,6 @@ const forbiddenTermsSrcInclusive = {
'src/iframe-helper.js',
'src/service/mutator-impl.js',
'src/service/resources-impl.js',
'src/service/video-manager-impl.js',
'extensions/amp-a4a/0.1/amp-a4a.js',
'extensions/amp-fx-flying-carpet/0.1/amp-fx-flying-carpet.js',
'extensions/amp-script/0.1/amp-script.js',
Expand Down
8 changes: 6 additions & 2 deletions src/service/video-manager-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,12 @@ class VideoEntry {
*/
getAnalyticsDetails() {
const {video} = this;
return this.supportsAutoplay_().then((supportsAutoplay) => {
const {width, height} = video.element.getLayoutSize();
const supportsAutoplay = this.supportsAutoplay_();
const intersection = measureIntersection(video.element);
return Promise.all([supportsAutoplay, intersection]).then((responses) => {
const supportsAutoplay = /** @type {boolean} */ (responses[0]);
const intersection = /** @type {!IntersectionObserverEntry} */ (responses[1]);
const {width, height} = intersection.boundingClientRect;
const autoplay = this.hasAutoplay && supportsAutoplay;
const playedRanges = video.getPlayedRanges();
const playedTotal = playedRanges.reduce(
Expand Down

0 comments on commit 37b1c6e

Please sign in to comment.