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

Method updateProject

packages/player-react/src/internal.ts:135–165  ·  view source on GitHub ↗
(project: Project)

Source from the content-addressed store, hash-verified

133 }
134
135 private async updateProject(project: Project) {
136 const playing = this.playing;
137 this.setState(State.Initial);
138
139 this.abortController?.abort();
140 this.abortController = new AbortController();
141
142 this.project = project;
143 console.log(project);
144 this.defaultSettings = getFullPreviewSettings(this.project);
145
146 const player = new Player(this.project);
147 player.setVariables(this.variables);
148 player.toggleLoop(this.looping);
149
150 this.player?.onRender.unsubscribe(this.render);
151 this.player?.onFrameChanged.unsubscribe(this.handleFrameChanged);
152 this.player?.togglePlayback(false);
153 this.player?.deactivate();
154
155 this.player = player;
156 this.updateSettings();
157
158 this.setState(State.Ready);
159 this.dispatchEvent(new CustomEvent('playerready', {detail: this.player}));
160
161 // Restore previous state
162 this.setPlaying(playing);
163 this.player.onRender.subscribe(this.render);
164 this.player.onFrameChanged.subscribe(this.handleFrameChanged);
165 }
166
167 public attributeChangedCallback(name: string, _: any, newValue: any) {
168 switch (name) {

Callers 1

setProjectMethod · 0.95

Calls 12

setStateMethod · 0.95
setVariablesMethod · 0.95
toggleLoopMethod · 0.95
updateSettingsMethod · 0.95
setPlayingMethod · 0.95
getFullPreviewSettingsFunction · 0.90
abortMethod · 0.80
logMethod · 0.80
unsubscribeMethod · 0.80
togglePlaybackMethod · 0.80
deactivateMethod · 0.80
subscribeMethod · 0.45

Tested by

no test coverage detected