Skip to content

Commit

Permalink
Fix progress bar synchronization with amp-audio. (#27361)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmajoulet committed Mar 24, 2020
1 parent 71f933d commit 2d76d6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extensions/amp-story/1.0/page-advancement.js
Expand Up @@ -966,12 +966,17 @@ class MediaBasedAdvancement extends AdvancementConfig {
this.mediaElement_,
'Media element was unspecified.'
);

this.unlistenFns_.push(
listenOnce(mediaElement, 'ended', () => this.onAdvance())
);
this.unlistenFns_.push(
listenOnce(mediaElement, 'timeupdate', () => this.onProgressUpdate())
);

this.onProgressUpdate();

this.timer_.poll(POLL_INTERVAL_MS, () => {
this.onProgressUpdate();
return !this.isRunning();
});
}

/** @private */
Expand Down

0 comments on commit 2d76d6f

Please sign in to comment.