MCPcopy
hub / github.com/midrender/revideo / run

Method run

packages/core/src/app/Player.ts:396–441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394 }
395
396 private async run() {
397 const state = await this.prepare();
398 const previousState = this.playback.state;
399 this.playback.state = state.paused
400 ? PlaybackState.Paused
401 : PlaybackState.Playing;
402
403 // Seek to the given frame
404 if (state.seek >= 0 || !this.isInUserRange(this.status.frame)) {
405 const seekFrame = state.seek < 0 ? this.status.frame : state.seek;
406 const clampedFrame = this.clampRange(seekFrame);
407 this.logger.profile('seek time');
408 await this.playback.seek(clampedFrame);
409 this.logger.profile('seek time');
410 }
411 // Do nothing if paused
412 else if (state.paused) {
413 if (
414 state.render ||
415 (state.paused && previousState !== PlaybackState.Paused)
416 ) {
417 // Tells the stage to render the current frame
418 await this.render.dispatch();
419 }
420
421 this.request();
422 return;
423 }
424
425 // Simply move forward one frame
426 else if (this.status.frame < this.endFrame) {
427 await this.playback.progress();
428 }
429
430 // Pause if a new slide has just started.
431 if (!state.paused && this.playback.currentScene.slides.isWaiting()) {
432 this.togglePlayback(false);
433 state.paused = true;
434 }
435
436 // Draw the project
437 await this.render.dispatch();
438 this.frame.current = this.playback.frame;
439
440 this.request();
441 }
442
443 private request() {
444 if (!this.active) return;

Callers 3

requestMethod · 0.95
downloadVideoChunkMethod · 0.45
startMethod · 0.45

Calls 10

prepareMethod · 0.95
isInUserRangeMethod · 0.95
clampRangeMethod · 0.95
requestMethod · 0.95
togglePlaybackMethod · 0.95
seekMethod · 0.80
progressMethod · 0.80
isWaitingMethod · 0.80
profileMethod · 0.45
dispatchMethod · 0.45

Tested by

no test coverage detected