Skip to main content

What Problem Does This Solve?

When an LCK operation fails (starting recording, capturing a photo, changing settings), you need to know why it failed. Was it a permission issue? Storage full? Already recording? Wrong platform? LckError provides specific error codes so you can handle failures appropriately—show the right error message, retry the operation, or disable features.

When to Use This

You’ll check LckError whenever an LckResult indicates failure:
var result = lckService.StartRecording();
if (!result.IsOk)
{
    // result.Error contains the LckError enum value
    switch (result.Error)
    {
        case LckError.NotEnoughStorageSpace:
            ShowError("Not enough storage space to record");
            break;
        case LckError.MicrophonePermissionDenied:
            ShowError("Microphone permission required");
            break;
        default:
            ShowError($"Recording failed: {result.Message}");
            break;
    }
}

Common Error Scenarios

Storage Issues

if (result.Error == LckError.NotEnoughStorageSpace)
{
    // Prompt user to free up space
    long bytesNeeded = GetEstimatedRecordingSize();
    ShowStorageWarning($"Need {bytesNeeded / 1_000_000} MB free");
}

Permission Errors

if (result.Error == LckError.MicrophonePermissionDenied)
{
    // Request permission or guide user to settings
    RequestMicrophonePermission();
}

State Errors

if (result.Error == LckError.RecordingAlreadyStarted)
{
    // User already recording, show status instead
    Debug.Log("Recording already in progress");
    return;
}

if (result.Error == LckError.NotCurrentlyRecording)
{
    // Tried to stop when not recording
    Debug.LogWarning("No active recording to stop");
}

Platform/Compatibility

if (result.Error == LckError.UnsupportedGraphicsApi)
{
    ShowError("Graphics API not supported. Try switching to Vulkan or DirectX11.");
}

if (result.Error == LckError.UnsupportedPlatform)
{
    ShowError("LCK is not supported on this platform");
}

Error Categories

Initialization & Setup Errors

ErrorWhen It HappensHow to Fix
ServiceNotCreatedCalling LCK before initializationCall LckCore.Initialize() first
ServiceDisposedUsing LCK after disposalDon’t use after calling Dispose()
InvalidDescriptorBad configuration in LckDescriptorCheck camera/quality settings
UnsupportedGraphicsApiGraphics API not supportedSwitch to DirectX11, Vulkan, or Metal
UnsupportedPlatformPlatform not supportedCheck platform compatibility

Permission Errors

ErrorWhen It HappensHow to Fix
MicrophonePermissionDeniedUser denied mic accessRequest permission, guide to settings

Recording State Errors

ErrorWhen It HappensHow to Fix
RecordingAlreadyStartedStart called while recordingCheck if recording before starting
NotCurrentlyRecordingStop/query called when not recordingCheck recording state first
NotPausedResume called when not pausedOnly resume if paused
CantEditSettingsWhileRecordingChanging settings during recordingStop recording before changing settings

Runtime Errors

ErrorWhen It HappensHow to Fix
RecordingErrorFailure during recordingCheck logs, report issue
PhotoCaptureErrorPhoto capture failedRetry or check camera state
StreamingErrorStreaming failureCheck network, streamer config
EncodingErrorEncoder failureReduce quality settings
MicrophoneErrorMic input failureCheck device, permissions

Storage Errors

ErrorWhen It HappensHow to Fix
NotEnoughStorageSpaceInsufficient disk spaceFree up space, reduce quality
FailedToCopyRecordingToGalleryCan’t save video to galleryCheck permissions, storage
FailedToCopyPhotoToGalleryCan’t save photo to galleryCheck permissions, storage

Missing Features

ErrorWhen It HappensHow to Fix
StreamerNotImplementedStreaming package not installedInstall LCK Streaming package

Camera/Monitor Errors

ErrorWhen It HappensHow to Fix
CameraIdNotFoundInvalid camera IDUse valid camera from GetCameras()
MonitorIdNotFoundInvalid monitor IDUse valid monitor from GetMonitors()

Unknown

ErrorWhen It HappensHow to Fix
UnknownErrorUnexpected failureCheck logs, report to LIV support

Complete Error Reference

Error CodeValueDescription
ServiceNotCreated1LCK service not initialized before use
ServiceDisposed2LCK service already disposed
InvalidDescriptor3Invalid LckDescriptor configuration
CameraIdNotFound4Camera ID doesn’t exist
MonitorIdNotFound5Monitor ID doesn’t exist
MicrophonePermissionDenied6Microphone permission denied
RecordingAlreadyStarted7Recording already in progress
NotCurrentlyRecording8No active recording
NotPaused9Recording not paused (can’t resume)
RecordingError10General recording failure
PhotoCaptureError11Photo capture failed
CantEditSettingsWhileRecording12Settings locked during recording
NotEnoughStorageSpace13Insufficient disk space
FailedToCopyRecordingToGallery14Can’t save video to gallery
FailedToCopyPhotoToGallery15Can’t save photo to gallery
UnsupportedGraphicsApi16Graphics API not supported
UnsupportedPlatform17Platform not supported
MicrophoneError18Microphone runtime error
StreamerNotImplemented19Streaming package missing
StreamingError20Streaming failure
EncodingError21Encoding failure
UnknownError22Unknown/unspecified error

Best Practices

Always check IsOk — Never assume operations succeed
Log errors — Include result.Message for context
Handle common cases — Storage, permissions, state conflicts
User-friendly messages — Don’t show raw error codes to users

Good Error Handling Pattern

var result = lckService.StartRecording();

if (!result.IsOk)
{
    Debug.LogError($"Recording failed: {result.Error} - {result.Message}");
    
    string userMessage = result.Error switch
    {
        LckError.NotEnoughStorageSpace => 
            "Not enough space. Free up storage and try again.",
        LckError.MicrophonePermissionDenied => 
            "Microphone access required. Enable in Settings.",
        LckError.RecordingAlreadyStarted => 
            "Recording already in progress.",
        LckError.UnsupportedGraphicsApi => 
            "Graphics API not supported. Try switching to Vulkan.",
        _ => 
            "Recording failed. Please try again."
    };
    
    ShowErrorDialog(userMessage);
    return;
}

Debug.Log("Recording started successfully");