Prerequisites
- A working iOS quickstart
- A running Nosmai preview
Start recording
[[NosmaiCore shared] startRecordingWithCompletion:^(BOOL success, NSError *error) {
if (!success) {
NSLog(@"Recording did not start: %@", error.localizedDescription);
}
}];
Stop and receive the video
[[NosmaiCore shared] stopRecordingWithCompletion:^(NSURL *videoURL,
NSError *error) {
if (videoURL != nil) {
NSLog(@"Video ready at %@", videoURL);
return;
}
NSLog(@"Recording failed: %@", error.localizedDescription);
}];
The URL points to the finalized recording. Copy or export it before deleting temporary application data.
Lifecycle rule
Stop and finalize recording before switching camera, leaving the screen, or stopping processing. Ignore repeated record-button taps while a start or stop operation is in progress.
Verify it worked
Record a short clip with a visible effect, wait for the stop completion, and play the returned URL. Confirm orientation, effect output, duration, and audio.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| Recording does not start | The camera is not ready or recording is already active | Wait for preview startup and guard duplicate starts |
| The returned URL disappears later | The app kept a temporary URL without copying or exporting it | Move the finalized file before temporary data is cleaned |