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

Method constructor

packages/core/src/app/Player.ts:119–162  ·  view source on GitHub ↗
(
    private project: Project,
    private settings: Partial<PlayerSettings> = {},
    private initialState: Partial<PlayerState> = {},
    private initialFrame = -1,
  )

Source from the content-addressed store, hash-verified

117 }
118
119 public constructor(
120 private project: Project,
121 private settings: Partial<PlayerSettings> = {},
122 private initialState: Partial<PlayerState> = {},
123 private initialFrame = -1,
124 ) {
125 this.playerState = new ValueDispatcher<PlayerState>({
126 loop: true,
127 muted: true,
128 volume: 1,
129 speed: 1,
130 ...initialState,
131 paused: true,
132 });
133
134 this.sharedWebGLContext = new SharedWebGLContext(this.project.logger);
135 this.requestedSeek = initialFrame;
136 this.logger = this.project.logger;
137 this.playback = new PlaybackManager();
138 this.status = new PlaybackStatus(this.playback);
139 this.size = settings.size ?? new Vector2(1920, 1080);
140 this.resolutionScale = settings.resolutionScale ?? 1;
141 this.startTime = settings.range?.[0] ?? 0;
142 this.endTime = settings.range?.[1] ?? Infinity;
143 this.playback.fps = settings.fps ?? 60;
144
145 const scenes: Scene[] = [];
146 for (const description of project.scenes) {
147 const scene = new description.klass({
148 ...description,
149 playback: this.status,
150 logger: this.project.logger,
151 size: this.size,
152 resolutionScale: this.resolutionScale,
153 sharedWebGLContext: this.sharedWebGLContext,
154 experimentalFeatures: project.experimentalFeatures,
155 });
156 scene.onReloaded.subscribe(() => this.requestRecalculation());
157 scene.variables.updateSignals(project.variables ?? {});
158 scenes.push(scene);
159 }
160 this.playback.setup(scenes);
161 this.activate();
162 }
163
164 public async configure(settings: PlayerSettings) {
165 await this.lock.acquire();

Callers

nothing calls this directly

Calls 5

requestRecalculationMethod · 0.95
activateMethod · 0.95
updateSignalsMethod · 0.80
setupMethod · 0.65
subscribeMethod · 0.45

Tested by

no test coverage detected