Description

LckService is the central entry point for interacting with the LIV Capture Kit at runtime and the default implementation of ILckService. It provides APIs for starting and stopping recording or streaming, configuring capture settings (resolution, framerate, bitrate, orientation), managing audio, capturing photos, and controlling active cameras. This service also exposes events for key lifecycle moments (recording started, stopped, paused, resumed, streaming events, photo saved, etc.), making it easy to integrate LCK into your application workflow.

Usage

  • Retrieve the service via DI:
    [Inject] private ILckService _lckService;
    
  • Configure capture options (resolution, framerate, bitrate) before starting capture.
  • Start recording or streaming with StartRecording() or StartStreaming().
  • Subscribe to public events such as OnRecordingStarted, OnStreamingStopped, or OnPhotoSaved to react to capture lifecycle changes.

References

Events

EventTypeDescription
OnRecordingStartedAction<LckResult>Invoked when a recording session starts.
OnRecordingStoppedAction<LckResult>Invoked when a recording session stops.
OnRecordingPausedAction<LckResult>Invoked when a recording session is paused.
OnRecordingResumedAction<LckResult>Invoked when a recording session resumes.
OnStreamingStartedAction<LckResult>Invoked when a live stream starts.
OnStreamingStoppedAction<LckResult>Invoked when a live stream stops.
OnPhotoSavedAction<LckResult>Invoked when a photo capture is successfully saved.
OnLowStorageSpaceAction<LckResult>Invoked when low storage space is detected.
OnRecordingSavedAction<LckResult<RecordingData>>Invoked when a recording has been successfully saved.
OnActiveCameraSetAction<LckResult<ILckCamera>>Invoked when the active camera is changed.

Methods

MethodReturnsDescription
StartRecording()LckResultStarts recording to disk.
StopRecording()LckResultStops recording (reason defaults to UserStopped).
PauseRecording()LckResultPauses an active recording.
ResumeRecording()LckResultResumes a paused recording.
GetRecordingDuration()LckResult<TimeSpan>Gets the duration of the current recording.
StartStreaming()LckResultStarts live streaming.
StopStreaming([StopReason])LckResultStops live streaming (optional stop reason).
GetStreamDuration()LckResult<TimeSpan>Gets the duration of the current stream.
IsRecording()LckResult<bool>Returns whether recording is currently active.
IsStreaming()LckResult<bool>Returns whether streaming is currently active.
IsPaused()LckResult<bool>Returns whether the recording is paused.
IsCapturing()LckResult<bool>Returns whether capture is active.
SetTrackResolution(CameraResolutionDescriptor)LckResultSets the capture resolution (only when not capturing).
SetCameraOrientation(LckCameraOrientation)LckResultSets the camera orientation (only when not capturing).
SetTrackFramerate(uint)LckResultSets the capture framerate (only when not capturing).
SetTrackBitrate(uint)LckResultSets the video bitrate (only when not capturing).
SetTrackAudioBitrate(uint)LckResultSets the audio bitrate (only when not capturing).
SetTrackDescriptor(CameraTrackDescriptor)LckResultSets the active camera track descriptor (only when not capturing).
SetTrackDescriptor(LckCaptureType, CameraTrackDescriptor)LckResultSets a track descriptor for a specific capture type.
SetPreviewActive(bool)LckResultEnables or disables preview rendering.
GetDescriptor()LckResult<LckDescriptor>Retrieves the current active track descriptor.
CapturePhoto()LckResultCaptures a still photo.
GetActiveCaptureType()LckResult<LckCaptureType>Gets the current capture type (e.g. recording, streaming).
SetActiveCaptureType(LckCaptureType)LckResultSets the current capture type.
SetActiveCamera(string cameraId, string monitorId = null)LckResultSets the active camera by ID.
GetActiveCamera()LckResult<ILckCamera>Gets the currently active camera.
SetGameAudioCaptureActive(bool)LckResultEnables/disables game audio capture.
SetMicrophoneCaptureActive(bool)LckResultEnables/disables microphone capture.
SetMicrophoneGain(float)LckResultSets microphone gain.
SetGameAudioGain(float)LckResultSets game audio gain.
GetMicrophoneOutputLevel()LckResult<float>Gets the current microphone output level.
GetGameOutputLevel()LckResult<float>Gets the current game audio output level.
IsGameAudioMute()LckResult<bool>Returns whether game audio is muted.
PreloadDiscreetAudio(AudioClip, float, bool)LckResultPreloads an audio clip for discreet playback.
PlayDiscreetAudioClip(AudioClip)LckResultPlays a discreet audio clip once.
StopAllDiscreetAudio()LckResultStops all discreet audio clips.