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

Function handlePlayPause

apps/desktop/src/routes/editor/TranscriptPage.tsx:415–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

413 };
414
415 const handlePlayPause = async () => {
416 try {
417 if (isAtEnd()) {
418 await commands.stopPlayback();
419 setEditorState("playbackTime", 0);
420 await commands.seekTo(0);
421 await commands.startPlayback(FPS, previewResolutionBase());
422 setEditorState("playing", true);
423 } else if (editorState.playing) {
424 await commands.stopPlayback();
425 setEditorState("playing", false);
426 } else {
427 await commands.seekTo(Math.floor(editorState.playbackTime * FPS));
428 await commands.startPlayback(FPS, previewResolutionBase());
429 setEditorState("playing", true);
430 }
431 if (editorState.playing) setEditorState("previewTime", null);
432 } catch (error) {
433 console.error("Error handling play/pause:", error);
434 setEditorState("playing", false);
435 }
436 };
437
438 createEffect(() => {
439 if (isAtEnd() && editorState.playing) {

Callers 1

TranscriptPanelFunction · 0.85

Calls 2

previewResolutionBaseFunction · 0.85
isAtEndFunction · 0.70

Tested by

no test coverage detected