(sourcePath: string)
| 483 | }; |
| 484 | |
| 485 | const importRecordingPath = async (sourcePath: string) => { |
| 486 | if (importing()) return; |
| 487 | setImporting(true); |
| 488 | const toastId = toast.loading("Importing clip…"); |
| 489 | try { |
| 490 | if (editorState.playing) { |
| 491 | await commands.stopPlayback(); |
| 492 | setEditorState("playing", false); |
| 493 | } |
| 494 | await commands.setProjectConfig(serializeProjectConfiguration(project)); |
| 495 | const count = await commands.addExistingRecordingToEditor(sourcePath); |
| 496 | toast.success(count === 1 ? "Clip imported" : `${count} clips imported`, { |
| 497 | id: toastId, |
| 498 | }); |
| 499 | window.location.reload(); |
| 500 | } catch (error) { |
| 501 | const message = error instanceof Error ? error.message : String(error); |
| 502 | toast.error(`Failed to import clip: ${message}`, { id: toastId }); |
| 503 | setImporting(false); |
| 504 | } |
| 505 | }; |
| 506 | |
| 507 | const pickMp4 = async () => { |
| 508 | const path = await open({ |
no test coverage detected