@param ReplayInterface $replay
@param int             $keyframeId

@return bool
177511
private function downloadKeyframe(ReplayInterface $replay, $keyframeId)
    {
        $keyframe = $this->client->downloadKeyframe($replay->getRegion(), $replay->getGameId(), $keyframeId);

        if (false === $keyframe) {
            try {
                if (
                    $keyframeId > $this->findKeyframeByChunkId(
                        $replay->getMetas(),
                        $this->findFirstChunkId($replay->getMetas()
                    ))
                    && isset($replay->getMetas()['pendingAvailableKeyFrameInfo'][0])
                ) {
                    $replay->addDownloadRetry();

                    if ($this->options['replay.download.retry'] == $replay->getDownloadRetry()) {
                        return false;
                    } else {
                        sleep(1);

                        return $this->downloadChunk($replay, $keyframeId);
                    }
                }
            } catch (\RuntimeException $e) {
                // No first chunk id was created, so it's the first download : we do nothing
            }

            // Clear retries
            $replay->resetDownloadRetry();

            return false;
        }

        $pathFolder = $this->getReplayDirPath($replay->getRegion(), $replay->getGameId()) . '/keyframes';
        file_put_contents($pathFolder . '/' . $keyframeId, $keyframe);

        // Update metas
        $metas = $replay->getMetas();
        $metas['pendingAvailableKeyFrameInfo'][] = array(
            'id'           => $keyframeId,
            'receivedTime' => date('M n, Y g:i:s A'),
            'nextChunkId'  => ($keyframeId - 1) * 2 + $metas['startGameChunkId'],
        );

        $replay->setMetas($metas);

        if ($this->options['replay.decoder.enable']) {
            $crypt = new ReplayCrypt($replay);

            if (
                !$this->onReplayFileDecrypted(
                    $replay,
                    self::FILETYPE_KEYFRAME,
                    $keyframeId,
                    $crypt->getBinary($replay, $pathFolder, $keyframeId, $this->options['replay.decoder.save_files'])
                )
            ) {
                return false;
            }
        }

        return true;
    }
144442
def replay_block(self, block_to_replay, limit=5):
        

        if block_to_replay == 'latest':
            if self.verbose:
                print("Getting latest %s block header" % source.upper())
            block = get_block(self.source, latest=True, verbose=self.verbose)
            if self.verbose:
                print("Latest %s block is #%s" % (self.source.upper(), block['block_number']))
        else:
            blocknum = block_to_replay if type(block_to_replay) == int else block_to_replay['block_number']
            if blocknum < self.parent_fork_block or blocknum < self.child_fork_block:
                raise Exception("Can't replay blocks mined before the fork")

        if type(block_to_replay) is not dict:
            if self.verbose:
                print("Getting %s block header #%s" % (self.source.upper(), block_to_replay))
            block = get_block(self.source, block_number=int(block_to_replay), verbose=self.verbose)
        else:
            block = block_to_replay

        if self.verbose:
            print("Using %s for pushing to %s" % (self.pusher.name, self.destination.upper()))
            print("Using %s for getting %s transactions" % (self.tx_fetcher.name, self.source.upper()))
            print("Finished getting block header,", len(block['txids']), "transactions in block, will replay", (limit or "all of them"))

        results = []
        enforced_limit = (limit or len(block['txids']))

        for i, txid in enumerate(block['txids'][:enforced_limit]):
            print("outside", txid)
            self._replay_tx(txid, i)
170535
public static WaybackRequest createReplayRequest(String url, String replay, String start, String end) {
		WaybackRequest r = new WaybackRequest();
		r.setReplayRequest();
		r.setRequestUrl(url);
		r.setReplayTimestamp(replay);
		r.setStartTimestamp(start);
		r.setEndTimestamp(end);
		return r;
	}
1138654
function (replayData) {
    var data = this.data;
    var self = this;
    var sceneEl = this.el;

    if (this.isReplaying) { return; }

    // Wait for camera.
    if (!this.el.camera) {
      this.el.addEventListener('camera-set-active', function waitForCamera () {
        self.startReplaying(replayData);
        self.el.removeEventListener('camera-set-active', waitForCamera);
      });
      return;
    }

    this.replayData = replayData;
    this.isReplaying = true;

    this.cameraEl.removeAttribute('motion-capture-replayer');

    Object.keys(replayData).forEach(function setReplayer (key) {
      var replayingEl;

      if (key === 'camera') {
        // Grab camera.
        replayingEl = self.cameraEl;
      } else {
        // Grab other entities.
        replayingEl = sceneEl.querySelector('#' + key);
        if (!replayingEl) {
          error('No element found with ID ' + key + '.');
          return;
        }
      }

      log('Setting motion-capture-replayer on ' + key + '.');
      replayingEl.setAttribute('motion-capture-replayer', {loop: data.loop});
      replayingEl.components['motion-capture-replayer'].startReplaying(replayData[key]);
    });
  }
762431
def valid_replay(info, ping):
  """"""
  if (info.HasField("error") or
      info.base_build != ping.base_build or  # different game version
      info.game_duration_loops < 1000 or
      len(info.player_info) != 2):
    # Probably corrupt, or just not interesting.
    return False
  for p in info.player_info:
    if p.player_apm < 10 or p.player_mmr < 1000:
      # Low APM = player just standing around.
      # Low MMR = corrupt replay or player who is weak.
      return False
  return True
1099128
public function getEndStats($region, $gameId)
    {
        $filePath = $this->getReplayDirPath($region, $gameId) . '/endstats';

        if (!is_file($filePath)) {
            throw new ReplayEndStatsNotFoundException('The endstats for game #' . $gameId . ' is not found');
        }

        return $filePath;
    }
688932
public function isValid(ReplayInterface $replay, OutputInterface $output = null, $tries = 0)
    {
        $hasOutput = null != $output;

        if ($hasOutput) {
            $output->write("Validate game criterias...\t\t");
        }

        if (null == $replay->getMetas()) {
            throw new \RuntimeException('You must call downloadMetas() method first');
        }

        // Download the new available metas to validate the game, only if retry
        if (0 < $tries) {
            $metas = $this->downloadMetas($replay);
        } else {
            $metas = $replay->getMetas();
        }

        $size = sizeof($metas);

        // Retries
        if (1 < $size && !isset($metas['pendingAvailableKeyFrameInfo'][0])) {
            if ($hasOutput && 0 === $tries) {
                $output->writeln('<comment>Game not started</comment>');
                $output->write("Waiting for the ingame ~3rd minute...\t");
            }

            if ($tries < 20) {
                sleep(30);
                ++$tries;

                return $this->isValid($replay, $output, $tries);
            }

            if ($hasOutput) {
                $output->write('<error>FAILURE</error>');
            }

            throw new GameNotStartedException('The game is not yet available for spectator, please wait tree minutes');
        }

        if (1 == $size && isset($metas['encryptionKey']) || $metas['gameEnded']) {
            if ($hasOutput) {
                $output->write('<error>FAILURE</error>');
            }

            throw new GameEndedException('The game has already ended, cannot download it');
        }

        if ($hasOutput) {
            $output->writeln('<info>OK</info>');
        }

        return true;
    }
1341078
function () {
    var data = this.data;
    var recordingdb = this.el.systems.recordingdb;;
    var recordingNames;
    var src;
    var self = this;

    // Allow override to display replayer from query param.
    if (new URLSearchParams(window.location.search).get('avatar-replayer-disabled') !== null) {
      return;
    }

    recordingdb.getRecordingNames().then(function (recordingNames) {
      // See if recording defined in query parameter.
      var queryParamSrc = self.getSrcFromSearchParam();

      // 1. Try `avatar-recorder` query parameter as recording name from IndexedDB.
      if (recordingNames.indexOf(queryParamSrc) !== -1) {
        log('Replaying `' + queryParamSrc + '` from IndexedDB.');
        recordingdb.getRecording(queryParamSrc).then(bind(self.startReplaying, self));
        return;
      }

      // 2. Use `avatar-recorder` query parameter or `data.src` as URL.
      src = queryParamSrc || self.data.src;
      if (src) {
        if (self.data.src) {
          log('Replaying from component `src`', src);
        } else if (queryParamSrc) {
          log('Replaying from query parameter `recording`', src);
        }
        self.loadRecordingFromUrl(src, false, bind(self.startReplaying, self));
        return;
      }

      // 3. Use `data.recordingName` as recording name from IndexedDB.
      if (recordingNames.indexOf(self.data.recordingName) !== -1) {
        log('Replaying `' + self.data.recordingName + '` from IndexedDB.');
        recordingdb.getRecording(self.data.recordingName).then(bind(self.startReplaying, self));
      }
    });
  }
1095907
public GDomainQuery replayGenericQuery(RecordedQuery recordedQuery, IGenericDomainAccess domainAccess) {
		Boolean br_old = null;
		GDomainQuery query;
		try {
			if (!Settings.TEST_MODE) {
				br_old = QueryRecorder.blockRecording.get();
				if (this.createNew)
					QueryRecorder.blockRecording.set(Boolean.FALSE);
				else
					QueryRecorder.blockRecording.set(Boolean.TRUE);
			}
			this.generic = true;
			this.replayedQueryContext = new ReplayedQueryContext(recordedQuery);
			query = ((IIntDomainAccess)domainAccess).getInternalDomainAccess().createRecordedGenQuery(this.replayedQueryContext,
					this.createNew); // do record
			this.id2ObjectMap.put(QueryRecorder.QUERY_ID, query);
			
			for (Statement stmt : recordedQuery.getStatements()) {
				replayStatement(stmt);
			}
		} finally {
			if (!Settings.TEST_MODE)
				QueryRecorder.blockRecording.set(br_old);
		}
		
		return query;
	}
705390
def qteReplayKeysequenceHook(self, msgObj):
        

        # Quit if there is nothing to replay.
        if self.recorded_keysequence.toString() == '':
            return

        # Stop the recording before the replay, if necessary.
        if self.qteRecording:
            return

        # Simulate the key presses.
        self.qteMain.qteEmulateKeypresses(self.recorded_keysequence)
318796
public function getLastChunkInfo($region, $gameId, $currentChunkId, &$keyframeId = null)
    {
        $metas = $this->getMetas($region, $gameId);

        // Game loading information
        //$firstChunkId = $replayManager->findFirstChunkId($metas);
        $firstChunkId = $metas['firstChunkId'];

        // A bug appears when endStartupChunkId = 3 and startGameChunkId = 5, the game won't load
        if ($metas['endStartupChunkId'] + 2 == $firstChunkId) {
            $firstChunkId = $metas['startGameChunkId'] + 2;
        }

        $keyframeId = $this->findKeyframeByChunkId($metas, $firstChunkId);

        $lastChunkInfo = array(
            'chunkId'            => $firstChunkId,
            'availableSince'     => 30000,
            'nextAvailableChunk' => 30000,
            'keyFrameId'         => $keyframeId,
            'nextChunkId'        => $firstChunkId,
            'endStartupChunkId'  => $metas['endStartupChunkId'],
            'startGameChunkId'   => $metas['startGameChunkId'],
            'endGameChunkId'     => 0,
            'duration'           => 30000
        );

        // In game information
        if ($firstChunkId != $metas['startGameChunkId'] && $currentChunkId - 1 == $metas['startGameChunkId']) {
            $currentChunkId = $firstChunkId;
        }

        if ($currentChunkId > $metas['startGameChunkId']) {
            if ($currentChunkId > $metas['lastChunkId']) {
                $currentChunkId = $metas['lastChunkId'];
            } elseif ($currentChunkId < $metas['firstChunkId']) {
                $currentChunkId = $metas['firstChunkId'];
            }

            $keyframeId = $this->findKeyframeByChunkId($metas, $currentChunkId);

            $lastChunkInfo['chunkId']            = $currentChunkId;
            $lastChunkInfo['nextChunkId']        = $metas['lastChunkId'];
            $lastChunkInfo['keyFrameId']         = $keyframeId;
            $lastChunkInfo['nextAvailableChunk'] = $currentChunkId == $firstChunkId + 6 ? 30000 : 100; // wait for full loading
        }

        // End game, stop downloading
        if ($currentChunkId == $metas['lastChunkId']) {
            $lastChunkInfo['nextAvailableChunk'] = 90000;
            $lastChunkInfo['endGameChunkId']     = $metas['endGameChunkId'];
        }

        return $lastChunkInfo;
    }
925075
def replay_sync(self, live=False):
        ''
        self.cursorRowIndex = 0
        CommandLog.currentReplay = self
        with Progress(total=len(self.rows)) as prog:
            while self.cursorRowIndex < len(self.rows):
                if CommandLog.currentReplay is None:
                    status('replay canceled')
                    return

                vd().statuses.clear()
                try:
                    if self.replayOne(self.cursorRow):
                        self.cancel()
                        return
                except Exception as e:
                    self.cancel()
                    exceptionCaught(e)
                    status('replay canceled')
                    return

                self.cursorRowIndex += 1
                prog.addProgress(1)

                sync(1 if live else 0)  # expect this thread also if playing live
                while not self.delay():
                    pass

        status('replay complete')
        CommandLog.currentReplay = None
736385
private function composeQueryString($replayable, $remove_proxies)
    {
        return http_build_query(array_filter([
            self::PARAM_REPLAYABLE     => $replayable ? 'true' : null,
            self::PARAM_REMOVE_PROXIES => $remove_proxies ? 'true' : null,
        ]));
    }
746039
public function recover($requeue = true)
    {
        $outputFrame = Basic\BasicRecoverFrame::create($requeue);
        $outputFrame->frameChannelId = $this->id;
        $this->connection->command($outputFrame);
    }
418121
def start_replay(self, match):
        
        self.out.log("replay ready!")
        url = match.group(1)
        new_webbrowser_profile().open(url, new=1, autoraise=True)
497339
public function requireOccurrenceRegeneration($repetitions1, $repetitions2)
    {
        if (count($repetitions1) != count($repetitions2)) {
            return true;
        }

        $comparator = new Comparator();

        for ($i = 0; $i < count($repetitions1); $i++) {
            if (!$comparator->areEqual($repetitions1[$i]->getRepetitionObject(), $repetitions2[$i]->getRepetitionObject())) {
                return true;
            }
        }

        return false;
    }
1168493
public function addPlayReplay($name, $url)
    {
        $replayElement = new PlayReplay($name, $url);
        return $this->addElement($replayElement);
    }