feat: Add editor enhancements - export video, audio preview, publish panel, configurable ports
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user