Nosmai  Effects Nosmai  Moderation Nosmai Try-ons coming soon
Docs menu Android
How-to guide

Record processed video on Android

Record the processed NosmaiPreviewView to an MP4 and handle completion without interrupting the camera pipeline.

Platform Android SDK version 3.0.4 Updated Aug 22, 2026 Time 6 min

Prerequisites

  • A working Android quickstart
  • The active NosmaiPreviewView
  • A writable absolute .mp4 output path

Start recording

NosmaiSDK.startRecording(previewView, outputPath,
    new NosmaiSDK.RecordingCallback() {
        @Override
        public void onStarted(boolean success, String error) {
            if (!success) {
                Log.e("Nosmai", "Recording did not start: " + error);
            }
        }
    });

Disable duplicate start requests until onStarted returns.

Stop and finalize the MP4

NosmaiSDK.stopRecording(new NosmaiSDK.RecordingCallback() {
    @Override
    public void onCompleted(String path, boolean success, String error) {
        if (success) {
            Log.i("Nosmai", "Video ready at " + path);
        } else {
            Log.e("Nosmai", "Recording failed: " + error);
        }
    }
});

Wait for onCompleted before opening, sharing, or scanning the file.

Lifecycle rule

Stop and finalize recording before switching camera, pausing the activity, or destroying the preview. On measured lower-tier devices the SDK can reduce only the recording resolution to protect frame rate; the live preview remains at its configured size.

Verify it worked

Record a short clip with a visible effect, wait for onCompleted, and play the returned MP4. Confirm its orientation, effect output, video duration, and audio.

Common errors

SymptomCauseFix
Recording does not startThe preview is not ready or another start is in progressWait for camera startup and guard the record button
The file cannot be openedThe app used it before onCompletedWait for finalization and use a writable absolute .mp4 path

Next steps

References

Was this page helpful?

Your response helps us prioritize documentation improvements.

Nosmai

An AR and AI company. Founded on the idea that the next decade of software will be visual, and that the tools for it should be within reach of anyone building.

Newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved