diff --git a/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte b/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte index a0691646..d251042b 100644 --- a/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte +++ b/src/lib/ae_core/ae_comp__hosted_files_clip_video.svelte @@ -147,7 +147,7 @@ function handle_clip_video(event: Event) { api_cfg: $ae_api, endpoint: endpoint, params: params, - timeout: 300000, // 5 minutes + timeout: 1800000, // 30 minutes — clip_video runs ffmpeg which can take 5-15 min for long recordings // return_blob: true, // filename: event.target.new_filename.value, // auto_download: false, @@ -157,12 +157,24 @@ function handle_clip_video(event: Event) { .then(function (result) { console.log(result); + // WHY: get_object() returns false/null on network failure (CORS drop, + // timeout, Gunicorn worker killed). Without this guard, result.hosted_file_id + // is undefined — JS uses it as an object key without throwing, so all the + // success state below would run and show "Clipped" on a failed request. + if (!result || !result.hosted_file_id) { + console.log('clip_video: request failed or returned no result'); + $ae_sess.files.processed_file_kv[hosted_file_id].submit_status = + 'error'; + $ae_loc.files.processed_file_kv[hosted_file_id].submit_status = + 'error'; + submit_status = 'error'; + clip_complete = false; + return false; + } + video_clip_file_kv[result.hosted_file_id] = {}; video_clip_file_kv[result.hosted_file_id] = result; - // $ae_loc.files.video_clip_file_kv[result.hosted_file_id] = {}; - // $ae_loc.files.video_clip_file_kv[result.hosted_file_id] = result; - $ae_sess.files.processed_file_kv[hosted_file_id].submit_status = 'clipped'; $ae_sess.files.processed_file_kv[hosted_file_id].clip_complete = @@ -176,13 +188,6 @@ function handle_clip_video(event: Event) { submit_status = 'clipped'; clip_complete = true; - // let file_blob = new Blob([result.data]); - // // console.log(file_blob); - // let file_obj_url = window.URL.createObjectURL(file_blob); // The img src - // // const url = window.URL.createObjectURL(new Blob([result.data])); - // download_clip_src = file_obj_url; - // // download_filename = file_obj_url; - return true; }); } @@ -363,21 +368,25 @@ function handle_clip_video(event: Event) {