Description

ILckService defines the contract for interacting with the capture system. It exposes events for lifecycle notifications (recording, streaming, saving, etc.), and methods for managing capture sessions, configuring video/audio parameters, and controlling cameras and audio.

Usage

Retrieve an ILckService instance through dependency injection or the DI container:
[Inject] private ILckService _lckService;

Example: Start a Recording

_lckService.OnRecordingStarted += result =>
{
    if (result.Success)
        Debug.Log("Recording started successfully!");
    else
        Debug.LogError($"Failed to start recording: {result.ErrorMessage}");
};

var startResult = _lckService.StartRecording();
if (!startResult.Success)
    Debug.LogError($"Error: {startResult.ErrorMessage}");

Example: Switch Capture Settings

// Change resolution before capturing
var resolution = new CameraResolutionDescriptor(1920, 1080);
var result = _lckService.SetTrackResolution(resolution);

if (!result.Success)
    Debug.LogError($"Failed to set resolution: {result.ErrorMessage}");

Example: Control Audio

// Enable microphone capture
_lckService.SetMicrophoneCaptureActive(true);

// Adjust microphone gain
_lckService.SetMicrophoneGain(1.5f);

// Check microphone level
var micLevel = _lckService.GetMicrophoneOutputLevel();
Debug.Log($"Mic Output Level: {micLevel.Result}");

References

Events

EventTypeDescription
OnRecordingStartedAction<LckResult>Invoked when recording starts.
OnRecordingPausedAction<LckResult>Invoked when recording is paused.
OnRecordingResumedAction<LckResult>Invoked when recording resumes.
OnRecordingStoppedAction<LckResult>Invoked when recording stops.
OnStreamingStartedAction<LckResult>Invoked when streaming starts.
OnStreamingStoppedAction<LckResult>Invoked when streaming stops.
OnLowStorageSpaceAction<LckResult>Invoked when low storage is detected.
OnRecordingSavedAction<LckResult<RecordingData>>Invoked when a recording has been saved.

Methods

MethodReturnsDescription
GetRecordingDuration()LckResult<TimeSpan>Gets the duration of the current recording.
GetStreamDuration()LckResult<TimeSpan>Gets the duration of the current stream.
StartRecording()LckResultStarts recording.
PauseRecording()LckResultPauses recording.
ResumeRecording()LckResultResumes recording.
StopRecording()LckResultStops recording.
StartStreaming()LckResultStarts streaming.
StopStreaming()LckResultStops streaming.
SetTrackFramerate(uint)LckResultSets the capture framerate.
SetTrackDescriptor(CameraTrackDescriptor)LckResultSets the track descriptor for capture.
SetTrackDescriptor(LckCaptureType, CameraTrackDescriptor)LckResultSets the track descriptor for a given capture type.
SetTrackResolution(CameraResolutionDescriptor)LckResultSets the capture resolution.
SetTrackBitrate(uint)LckResultSets the video bitrate.
SetTrackAudioBitrate(uint)LckResultSets the audio bitrate.
SetCameraOrientation(LckCameraOrientation)LckResultSets the camera orientation.
GetActiveCaptureType()LckResult<LckCaptureType>Gets the currently active capture type.
SetActiveCaptureType(LckCaptureType)LckResultSets the active capture type.
SetPreviewActive(bool)LckResultEnables or disables preview rendering.
IsRecording()LckResult<bool>Returns whether recording is active.
IsStreaming()LckResult<bool>Returns whether streaming is active.
IsCapturing()LckResult<bool>Returns whether capture is active.
SetGameAudioCaptureActive(bool)LckResultEnables/disables game audio capture.
SetMicrophoneCaptureActive(bool)LckResultEnables/disables microphone capture.
GetMicrophoneOutputLevel()LckResult<float>Gets the current microphone output level.
SetMicrophoneGain(float)LckResultSets microphone gain.
SetGameAudioGain(float)LckResultSets game audio gain.
GetGameOutputLevel()LckResult<float>Gets the current game audio output level.
IsGameAudioMute()LckResult<bool>Returns whether game audio is muted.
SetActiveCamera(string, string monitorId = null)LckResultSets the active camera (and optional monitor).
PreloadDiscreetAudio(AudioClip, float, bool)LckResultPreloads an audio clip for discreet playback.
PlayDiscreetAudioClip(AudioClip)LckResultPlays a discreet audio clip.
StopAllDiscreetAudio()LckResultStops all discreet audio playback.
GetDescriptor()LckResult<LckDescriptor>Gets the current descriptor.
CapturePhoto()LckResultCaptures a photo.
Dispose()voidCleans up and disposes the service.