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