fix: clear stale pause points when AD VTT is re-uploaded

Old pause_points in edit_state always overrode new VTT cue timings
during re-render, making AD VTT upload for timing adjustments
non-functional. Clear pause_points and video_segments on AD VTT
upload so re-render falls back to the new cue start times.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-09 17:07:55 +00:00
parent 539e11caca
commit c6c7ff51c7
2 changed files with 10 additions and 0 deletions

View file

@ -1209,6 +1209,14 @@ async def update_job_vtt_content(
)
lang_output["ad_vtt_gcs"] = new_ad_uri
# Clear stale pause points — old positions are invalid with new VTT timings.
# Re-render will fall back to VTT cue start_time for placement.
edit_state = lang_output.get("accessible_video_edit_state")
if edit_state:
edit_state["pause_points"] = []
edit_state["video_segments"] = []
lang_output["accessible_video_edit_state"] = edit_state
# Update job with new VTT content
outputs[target_language] = lang_output

View file

@ -212,6 +212,8 @@ async def _async_rerender_accessible_video(
# 4. Build placements with adjusted pause points
method = lang_output.get("accessible_video_method", "pause_insert")
pause_points = edit_state.get("pause_points", [])
if not pause_points:
logger.info("No pause points in edit state — using VTT cue start times for all placements")
placements = _build_placements_with_adjustments(
ad_vtt_content, cue_durations, pause_points