(project: Project)
| 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) { |
no test coverage detected