Launch the CE.SDK mobile camera in Reaction mode and collect the base video plus every recorded reaction clip.
This guide uses the CE.SDK mobile camera in Reaction mode. For adding the camera to your app and the permissions it requires, see Integrate Mobile Camera; for the full set of camera options, see Mobile Camera Configuration. To compose the returned recordings into an editable picture-in-picture video scene, continue with Record Reaction in the video-creation guides.
Reaction mode plays a provided video while the front camera and microphone
record the user’s response. The camera returns the base video separately from
one or more reaction recordings — the source clips rather than an automatically
composited export — so your app can decide whether to persist the files, place
the reaction as a picture-in-picture clip, or process the clips in another
workflow. Android exposes CameraMode.Standard and CameraMode.Reaction; dual
camera is not available in the Android camera API.
Launch Reaction Mode#
Register CaptureMedia with rememberLauncherForActivityResult, then launch it
with CameraMode.Reaction. The video parameter is the base video that plays
while the user records.
@Composablefun rememberRecordReactionLauncher( baseVideoUri: Uri, license: String?, userId: String?, onReactionReady: (CameraResult.Reaction) -> Unit, onDismissed: () -> Unit = {},): () -> Unit { val cameraLauncher = rememberLauncherForActivityResult(contract = CaptureMedia()) { result -> handleReactionCameraResult(result, onReactionReady, onDismissed) }
return { val input = CaptureMedia.Input( engineConfiguration = EngineConfiguration( license = license, userId = userId, ), cameraMode = CameraMode.Reaction( video = baseVideoUri, cameraLayoutMode = CameraLayoutMode.Vertical, positionsSwapped = false, ), ) cameraLauncher.launch(input) }}The session starts on the front camera so the user’s face is in frame right
away. Recording is capped at the base video’s duration —
CameraConfiguration.maxTotalDuration is ignored in Reaction mode, so a
reaction can never run longer than the video it responds to.
Reaction mode supports video capture only. CaptureMedia.Input validates the
selected cameraMode against the configured capture type and rejects unsupported
combinations, such as photo capture with CameraMode.Reaction.
Choose the Layout#
cameraLayoutMode takes a CameraLayoutMode: Vertical stacks the two feeds
on top of each other, Horizontal places them side by side. The base video
plays in the top or left half and the camera preview fills the other half. Pass
positionsSwapped = true to start the session with the two positions
exchanged.
Handle the Result#
CaptureMedia returns null when the user dismisses the camera. A successful
Reaction session returns CameraResult.Reaction; other result cases belong to
Standard or mixed capture flows and can be ignored here.
private fun handleReactionCameraResult( result: CameraResult?, onReactionReady: (CameraResult.Reaction) -> Unit, onDismissed: () -> Unit,) { when (result) { null -> onDismissed() is CameraResult.Reaction -> onReactionReady(result) else -> Unit }}The result separates the base video from the reaction recordings:
| Value | Meaning |
|---|---|
CameraResult.Reaction.video |
The base Video that was played during recording. |
CameraResult.Reaction.reaction |
A list of Recording segments captured from the front camera and microphone. |
Recording.videos |
The videos inside each segment. Reaction recordings contain a single video. |
CameraResult.Reaction.video.uri |
The original base video URI passed to CameraMode.Reaction. |
Recording.videos.first().uri |
The app-local URI for a generated reaction recording file. |
Video.rect |
The preview rectangle used by the camera layout. |
Reaction recording file URIs point to app-local files. Copy those generated
files into your own storage location if you need them after the camera session,
especially before passing them to a background upload or long-running editor
workflow. The base video URI remains the URI your app passed into
CameraMode.Reaction. See Access Recordings for the
general recording result shape.
To turn the result into an editable scene, hand the base video and reaction recordings to the editor and compose the picture-in-picture layout there — Record Reaction in the video-creation guides walks through that flow.
Troubleshooting#
Incomplete Reaction Clips#
A pause/resume session produces multiple reaction recordings. Process the whole
reaction list instead of reading only the first entry.
Audio Echo#
The base video’s audio can be picked up by the microphone. Lower the playback volume in your camera experience or suggest headphones when echo would hurt the recording.
Related Types#
| Type | Purpose |
|---|---|
CameraMode.Reaction |
Configures Reaction mode with a base video, layout mode, and optional swapped positions. |
CameraResult.Reaction |
Returns the base video and the reaction recordings. |
Recording |
Describes one captured segment and its duration. |
Video |
Describes a video URI and preview rectangle. |
API Reference#
| API | Purpose |
|---|---|
CaptureMedia() |
Creates the Activity Result contract for the CE.SDK camera. |
CaptureMedia.Input(engineConfiguration=_, cameraConfiguration=_, cameraMode=_) |
Configures the camera launch request; cameraConfiguration carries the capture type validated against the mode. |
EngineConfiguration(license=_, userId=_) |
Supplies license and user identity information to the camera engine. |
CameraMode.Reaction(video=_, cameraLayoutMode=_, positionsSwapped=_) |
Starts Reaction mode with the base video and layout settings. |
rememberLauncherForActivityResult(contract=_, onResult=_) |
Registers the launcher that opens the camera and receives CameraResult?. |
Next Steps#
- Record Reaction - Compose the base video and reaction clips into an editable picture-in-picture video scene.
- Integrate Mobile Camera - Add the mobile camera to your Android app.
- Mobile Camera Configuration - Configure capture behavior, duration limits, and camera UI options.
- Access Recordings - Read and persist captured video recordings.