feat: Add editor enhancements - export video, audio preview, publish panel, configurable ports

This commit is contained in:
empty
2026-01-06 17:29:43 +08:00
parent 79a6c2ef3e
commit 96eacf06ba
18 changed files with 2946 additions and 1701 deletions

View File

@@ -227,8 +227,55 @@ class EditorApiClient {
return response.json()
}
/**
* Export edited video
*/
async exportVideo(
storyboardId: string,
bgmPath?: string,
bgmVolume?: number
): Promise<{ task_id: string; status: string }> {
const response = await fetch(
`${this.baseUrl}/editor/storyboard/${storyboardId}/export`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ bgm_path: bgmPath, bgm_volume: bgmVolume }),
}
)
if (!response.ok) {
const error = await response.json().catch(() => ({ detail: response.statusText }))
throw new Error(error.detail || `Failed to start export: ${response.statusText}`)
}
return response.json()
}
/**
* Get export task status
*/
async getExportStatus(taskId: string): Promise<{
task_id: string
status: string
progress: number
video_path?: string
download_url?: string
error?: string
}> {
const response = await fetch(`${this.baseUrl}/editor/export/${taskId}/status`)
if (!response.ok) {
const error = await response.json().catch(() => ({ detail: response.statusText }))
throw new Error(error.detail || `Failed to get export status: ${response.statusText}`)
}
return response.json()
}
}
// Export singleton instance
export const editorApi = new EditorApiClient()