Bind completion to the recording you actually started
A local recording helper might create an original source and then pass it to an editor, archive or upload queue. The dangerous shortcut is to read the last recording filename immediately after issuing stop. That can confuse a previous artifact with the current operation or trigger processing before the intended lifecycle observation. This guide concerns an integration with the OBS frontend API, not an AISwapLab recording feature or permission to create paid generation jobs. The API reference is the authority for available calls and events in the installed build. The sequence below is an integration design to implement and test; no OBS automation plug-in or paid video request was executed for this article. Keep state owned by the recording session instead of by one global last-path variable.
What to do next
- 01
Create a capture operation record before starting
Assign an application-side operation identifier and record the intended scene, output destination and observation start. Subscribe through the documented frontend event mechanism before requesting capture, so a short operation cannot finish before its listener exists. Record the previous last-file value as historical information, not the answer for the new session. Preserve explicit state for whether this operation actually reached recording-started.
- 02
Observe the matching stop lifecycle
After requesting stop, distinguish the stopping notification from the fully stopped notification. Associate observations with the active operation and account for cancellation, errors or an external operator action. Do not infer success from a timer expiring. If the automation permits overlapping requests, serialize the capture lifecycle or supply a tested ownership policy; the frontend's global last-path getter is not a unique job identifier for several simultaneous requests.
- 03
Qualify the current artifact before releasing it
After the relevant stopped observation, resolve the expected recording and confirm that it belongs to this operation through the destination, filename and session evidence. Check that it exists and opens as a complete intended picture-and-sound file. Apply downstream format and duration requirements separately. Only then mark the capture available to the next stage; a valid long recording may still require an approved short MP4 excerpt for character replacement.
A concrete example
Illustrative automation race: the previous last-recording path names rehearsal-A. A helper begins rehearsal-B, issues stop and immediately reads that old path, sending A to the next stage. The corrected design keeps B pending until its stop lifecycle is observed, then reconciles the artifact with B's operation record and opens it for validation. This is a proposed state-machine example, not a claim that OBS always returns a stale value or that an elapsed delay proves the file is complete.
Recording automation handoff states
| State | Required evidence | Next-stage access |
|---|---|---|
| Requested | Operation and listener established | Not ready |
| Recording | Matching started observation | Not ready |
| Stopping | Stop requested or stopping event | Not ready |
| Stopped and qualified | Matching stop plus current readable artifact | Release only to the intended next stage |
Before you call it ready
- The event listener exists before the capture can complete.
- Started, stopping and fully stopped observations remain distinct states.
- The selected file belongs to the current operation rather than a historical last-path value.
- Downstream upload, editing or paid generation has its own separate approval and validation boundary.
When to stop or choose another method
Keep the operation unresolved if its lifecycle or artifact identity cannot be established. Do not substitute an arbitrary sleep, a previous filename or an automatic second paid request. Retain the relevant local session evidence and recover the actual saved recording before allowing the next stage to act.
