vendor/web-animations.js
function(inheritedTime) {
    this._inheritedTime = inheritedTime;
    this._updateTimeMarkers();

    // The polyfill uses a sampling model whereby time values are propagated
    // down the tree at each sample. However, for the media item, we need to use
    // play() and pause().

    // Handle the case of being outside our effect interval.
    if (this._iterationTime === null) {
      this._ensureIsAtUnscaledTime(0);
      this._ensurePaused();
      return;
    }

    if (this._iterationTime >= this._intrinsicDuration()) {
      // Our iteration time exceeds the media element's duration, so just make
      // sure the media element is at the end. It will stop automatically, but
      // that could take some time if the seek below is significant, so force
      // it.
      this._ensureIsAtUnscaledTime(this._intrinsicDuration());
      this._ensurePaused();
      return;
    }

    var finalIteration = this._floorWithOpenClosedRange(
        this.timing.iterationStart + this.timing._iterations(), 1.0);
    var endTimeFraction = this._modulusWithOpenClosedRange(
        this.timing.iterationStart + this.timing._iterations(), 1.0);
    if (this.currentIteration === finalIteration &&
        this._timeFraction === endTimeFraction &&
        this._intrinsicDuration() >= this.duration) {
      // We have reached the end of our final iteration, but the media element
      // is not done.
      this._ensureIsAtUnscaledTime(this.duration * endTimeFraction);
      this._ensurePaused();
      return;
    }

    // Set the appropriate playback rate.
    var playbackRate =
        this._media.defaultPlaybackRate * this._netEffectivePlaybackRate();
    if (this._media.playbackRate !== playbackRate) {
      this._media.playbackRate = playbackRate;
    }

    // Set the appropriate play/pause state. Note that we may not be able to
    // seek to the desired time. In this case, the media element's seek
    // algorithm repositions the seek to the nearest seekable time. This is OK,
    // but in this case, we don't want to play the media element, as it prevents
    // us from synchronising properly.
    if (this.player.paused ||
        !this._isSeekableUnscaledTime(this._iterationTime)) {
      this._ensurePaused();
    } else {
      this._ensurePlaying();
    }

    // Seek if required. This could be due to our AnimationPlayer being seeked,
    // or video slippage. We need to handle the fact that the video may not play
    // at exactly the right speed. There's also a variable delay when the video
    // is first played.
    // TODO: What's the right value for this delta?
    var delta = isDefinedAndNotNull(this._delta) ? this._delta :
        0.2 * Math.abs(this._media.playbackRate);
    if (Math.abs(this._iterationTime - this._unscaledMediaCurrentTime()) >
        delta) {
      this._ensureIsAtUnscaledTime(this._iterationTime);
    }
  }
function(inheritedTime) {
    this._inheritedTime = inheritedTime;
    this._updateTimeMarkers();

    // The polyfill uses a sampling model whereby time values are propagated
    // down the tree at each sample. However, for the media item, we need to use
    // play() and pause().

    // Handle the case of being outside our effect interval.
    if (this._iterationTime === null) {
      this._ensureIsAtUnscaledTime(0);
      this._ensurePaused();
      return;
    }

    if (this._iterationTime >= this._intrinsicDuration()) {
      // Our iteration time exceeds the media element's duration, so just make
      // sure the media element is at the end. It will stop automatically, but
      // that could take some time if the seek below is significant, so force
      // it.
      this._ensureIsAtUnscaledTime(this._intrinsicDuration());
      this._ensurePaused();
      return;
    }

    var finalIteration = this._floorWithOpenClosedRange(
        this.timing.iterationStart + this.timing._iterations(), 1.0);
    var endTimeFraction = this._modulusWithOpenClosedRange(
        this.timing.iterationStart + this.timing._iterations(), 1.0);
    if (this.currentIteration === finalIteration &&
        this._timeFraction === endTimeFraction &&
        this._intrinsicDuration() >= this.duration) {
      // We have reached the end of our final iteration, but the media element
      // is not done.
      this._ensureIsAtUnscaledTime(this.duration * endTimeFraction);
      this._ensurePaused();
      return;
    }

    // Set the appropriate playback rate.
    var playbackRate =
        this._media.defaultPlaybackRate * this._netEffectivePlaybackRate();
    if (this._media.playbackRate !== playbackRate) {
      this._media.playbackRate = playbackRate;
    }

    // Set the appropriate play/pause state. Note that we may not be able to
    // seek to the desired time. In this case, the media element's seek
    // algorithm repositions the seek to the nearest seekable time. This is OK,
    // but in this case, we don't want to play the media element, as it prevents
    // us from synchronising properly.
    if (this.player.paused ||
        !this._isSeekableUnscaledTime(this._iterationTime)) {
      this._ensurePaused();
    } else {
      this._ensurePlaying();
    }

    // Seek if required. This could be due to our AnimationPlayer being seeked,
    // or video slippage. We need to handle the fact that the video may not play
    // at exactly the right speed. There's also a variable delay when the video
    // is first played.
    // TODO: What's the right value for this delta?
    var delta = isDefinedAndNotNull(this._delta) ? this._delta :
        0.2 * Math.abs(this._media.playbackRate);
    if (Math.abs(this._iterationTime - this._unscaledMediaCurrentTime()) >
        delta) {
      this._ensureIsAtUnscaledTime(this._iterationTime);
    }
  }
function ( inheritedTime ) { this . _inheritedTime = inheritedTime ; this . _updateTimeMarkers ( ) ; // The polyfill uses a sampling model whereby time values are propagated // down the tree at each sample. However, for the media item, we need to use // play() and pause(). // Handle the case of being outside our effect interval. if ( this . _iterationTime === null ) { this . _ensureIsAtUnscaledTime ( 0 ) ; this . _ensurePaused ( ) ; return ; } if ( this . _iterationTime >= this . _intrinsicDuration ( ) ) { // Our iteration time exceeds the media element's duration, so just make // sure the media element is at the end. It will stop automatically, but // that could take some time if the seek below is significant, so force // it. this . _ensureIsAtUnscaledTime ( this . _intrinsicDuration ( ) ) ; this . _ensurePaused ( ) ; return ; } var finalIteration = this . _floorWithOpenClosedRange ( this . timing . iterationStart + this . timing . _iterations ( ) , 1.0 ) ; var endTimeFraction = this . _modulusWithOpenClosedRange ( this . timing . iterationStart + this . timing . _iterations ( ) , 1.0 ) ; if ( this . currentIteration === finalIteration && this . _timeFraction === endTimeFraction && this . _intrinsicDuration ( ) >= this . duration ) { // We have reached the end of our final iteration, but the media element // is not done. this . _ensureIsAtUnscaledTime ( this . duration * endTimeFraction ) ; this . _ensurePaused ( ) ; return ; } // Set the appropriate playback rate. var playbackRate = this . _media . defaultPlaybackRate * this . _netEffectivePlaybackRate ( ) ; if ( this . _media . playbackRate !== playbackRate ) { this . _media . playbackRate = playbackRate ; } // Set the appropriate play/pause state. Note that we may not be able to // seek to the desired time. In this case, the media element's seek // algorithm repositions the seek to the nearest seekable time. This is OK, // but in this case, we don't want to play the media element, as it prevents // us from synchronising properly. if ( this . player . paused || ! this . _isSeekableUnscaledTime ( this . _iterationTime ) ) { this . _ensurePaused ( ) ; } else { this . _ensurePlaying ( ) ; } // Seek if required. This could be due to our AnimationPlayer being seeked, // or video slippage. We need to handle the fact that the video may not play // at exactly the right speed. There's also a variable delay when the video // is first played. // TODO: What's the right value for this delta? var delta = isDefinedAndNotNull ( this . _delta ) ? this . _delta : 0.2 * Math . abs ( this . _media . playbackRate ) ; if ( Math . abs ( this . _iterationTime - this . _unscaledMediaCurrentTime ( ) ) > delta ) { this . _ensureIsAtUnscaledTime ( this . _iterationTime ) ; } }
This is called by the polyfill on each tick when our AnimationPlayer's tree is active.
This is called by the polyfill on each tick when our AnimationPlayer s tree is active .