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