MCPcopy
hub / github.com/CapSoftware/Cap / handlePlayPauseClick

Function handlePlayPauseClick

apps/desktop/src/routes/editor/Player.tsx:205–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203 });
204
205 const handlePlayPauseClick = async () => {
206 try {
207 if (isAtEnd()) {
208 await commands.stopPlayback();
209 setEditorState("playbackTime", 0);
210 await commands.seekTo(0);
211 await commands.startPlayback(FPS, previewResolutionBase());
212 setEditorState("playing", true);
213 } else if (editorState.playing) {
214 await commands.stopPlayback();
215 setEditorState("playing", false);
216 } else {
217 await commands.seekTo(Math.floor(editorState.playbackTime * FPS));
218 await commands.startPlayback(FPS, previewResolutionBase());
219 setEditorState("playing", true);
220 }
221 if (editorState.playing) setEditorState("previewTime", null);
222 } catch (error) {
223 console.error("Error handling play/pause:", error);
224 setEditorState("playing", false);
225 }
226 };
227
228 // Register keyboard shortcuts in one place
229 useEditorShortcuts(() => {

Callers 1

PlayerContentFunction · 0.85

Calls 2

previewResolutionBaseFunction · 0.85
isAtEndFunction · 0.70

Tested by

no test coverage detected