diff options
Diffstat (limited to 'apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts')
| -rw-r--r-- | apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts b/apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts index d0907c5b..c14a5a42 100644 --- a/apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts +++ b/apps/web/src/lib/commands/timeline/element/toggle-source-audio-separation.ts @@ -1,5 +1,5 @@ import { EditorCore } from "@/core"; -import { Command } from "@/lib/commands/base-command"; +import { Command, type CommandResult } from "@/lib/commands/base-command"; import { buildSeparatedAudioElement, canExtractSourceAudio, @@ -25,7 +25,7 @@ export class ToggleSourceAudioSeparationCommand extends Command { super(); } - execute(): void { + execute(): CommandResult | undefined { const editor = EditorCore.getInstance(); this.savedState = editor.timeline.getTracks(); @@ -43,6 +43,9 @@ export class ToggleSourceAudioSeparationCommand extends Command { if (!sourceElement) { return; } + if (sourceElement.type !== "video") { + return; + } if (canRecoverSourceAudio({ element: sourceElement })) { editor.timeline.updateTracks( @@ -59,9 +62,7 @@ export class ToggleSourceAudioSeparationCommand extends Command { const mediaAsset = editor .media .getAssets() - .find((asset) => - sourceElement.type === "video" ? asset.id === sourceElement.mediaId : false, - ); + .find((asset) => asset.id === sourceElement.mediaId); if (!canExtractSourceAudio({ element: sourceElement, mediaAsset })) { return; } |
