> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liv.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

> Common issues and solutions for the LIV Camera Kit (LCK) SDK in Unreal Engine, covering recording failures, audio problems, platform-specific issues on Android and Windows, UI interaction bugs, plugin loading errors, and diagnostic commands.

## Recording Issues

<AccordionGroup>
  <Accordion title="Recording doesn't start">
    **Symptoms:** `StartRecording()` returns but no recording begins.

    **Solutions:**

    1. Verify the Tracking ID is set in Project Settings
    2. Ensure a valid SceneCaptureComponent2D is registered
    3. Check log for errors: `LogLCK`, `LogLCKEncoding`

    ```cpp theme={null}
    // Verify capture component is registered
    if (!Service->IsInitialized())
    {
        UE_LOG(LogTemp, Error, TEXT("Service not initialized"));
    }
    ```
  </Accordion>

  <Accordion title="Recording stops unexpectedly">
    **Symptoms:** Recording ends without calling `StopRecording()`.

    **Solutions:**

    1. Check `OnRecordingError` delegate for error messages
    2. Verify disk space is available
    3. Check for encoder errors in `LogLCKEncoding`

    ```cpp theme={null}
    Service->OnRecordingError.AddDynamic(this, &AMyActor::HandleError);
    void AMyActor::HandleError(FString Message, int32 Code)
    {
        UE_LOG(LogTemp, Error, TEXT("Recording error %d: %s"), Code, *Message);
    }
    ```
  </Accordion>

  <Accordion title="Poor video quality">
    **Symptoms:** Recording looks blurry or has artifacts.

    **Solutions:**

    1. Increase video bitrate in recording settings
    2. Use a higher quality profile (HD, 2K, 4K)
    3. Check render target resolution matches recording resolution

    ```cpp theme={null}
    // Ensure settings match your quality needs
    Service->ApplyRecordingSettings(
        1920, 1080,  // Match render target
        30,
        12000000,    // HD default bitrate
        256000,
        48000
    );
    ```
  </Accordion>

  <Accordion title="Video is black">
    **Symptoms:** Recording file is black but audio works.

    **Solutions:**

    1. Verify SceneCaptureComponent2D is capturing
    2. Check capture component has a valid render target
    3. Ensure capture component is enabled and visible

    ```cpp theme={null}
    // Verify capture is working
    CaptureComponent->bCaptureEveryFrame = true;
    CaptureComponent->CaptureScene();
    ```
  </Accordion>
</AccordionGroup>

***

## Audio Issues

<AccordionGroup>
  <Accordion title="No audio in recording">
    **Symptoms:** Video records but audio is silent.

    **Solutions:**

    1. Verify audio plugins are enabled
    2. Check that audio sources are registered
    3. Ensure audio permissions are granted (Android)

    ```cpp theme={null}
    // Check audio sources
    TArray<ILCKAudioSource*> Sources;
    IModularFeatures::Get().GetModularFeatureImplementations<ILCKAudioSource>(
        ILCKAudioSource::GetModularFeatureName(), Sources);

    if (Sources.Num() == 0)
    {
        UE_LOG(LogTemp, Warning, TEXT("No audio sources!"));
    }
    ```
  </Accordion>

  <Accordion title="Audio is distorted">
    **Symptoms:** Audio has crackling, popping, or pitch issues.

    **Solutions:**

    1. Check sample rate matches between source and encoder
    2. Verify buffer sizes are adequate
    3. Check for CPU overload

    ```cpp theme={null}
    // Match sample rates
    int32 SourceRate = ULCKUnrealAudioBPL::GetUnrealAudioSamplerate();
    Params.Samplerate = SourceRate;  // Must match
    ```
  </Accordion>

  <Accordion title="Microphone not working">
    **Symptoms:** Game audio records but no microphone.

    **Solutions:**

    1. Check `SetMicrophoneEnabled(true)` is called
    2. Verify microphone permissions (Android)
    3. Check if another app is using the microphone

    ```cpp theme={null}
    // Ensure mic is enabled
    Service->SetMicrophoneEnabled(true);

    // Verify
    if (Service->IsMicrophoneEnabled())
    {
        UE_LOG(LogTemp, Log, TEXT("Mic enabled"));
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Platform Issues

<AccordionGroup>
  <Accordion title="Android encoding fails">
    **Symptoms:** Recording fails on Android devices.

    **Solutions:**

    1. Ensure **Vulkan is enabled** — OpenGL ES is not supported for video encoding
    2. Remove OpenGL ES from your project's graphics API list
    3. Check device supports hardware H.264 encoding
    4. Verify `RECORD_AUDIO` permission is granted at runtime

    ```ini theme={null}
    ; AndroidEngine.ini
    [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
    bEnableVulkanSM5Support=True
    ```
  </Accordion>

  <Accordion title="Windows encoder not found">
    **Symptoms:** Recording fails with encoder initialization error.

    **Solutions:**

    1. Verify Windows Media Foundation is available
    2. Check GPU drivers are up to date
    3. Ensure AVCodecsCore plugin is enabled
  </Accordion>

  <Accordion title="Meta Quest performance issues">
    **Symptoms:** Frame drops during recording on Quest.

    **Solutions:**

    1. Reduce recording resolution to HD (1080p) or SD (720p)
    2. Lower video bitrate
    3. Reduce framerate to 30 FPS (SD default)
    4. Vulkan must be enabled (required for encoding on Android)
  </Accordion>
</AccordionGroup>

***

## UI Issues

<AccordionGroup>
  <Accordion title="Buttons don't respond">
    **Symptoms:** UI buttons don't register touches.

    **Solutions:**

    1. Verify collision profile is set correctly
    2. Check button is visible and enabled
    3. Verify interactor collision settings

    ```cpp theme={null}
    // Ensure collision is set up
    Button->CollisionBox->SetCollisionProfileName(
        FLCKConstants::UICollisionProfileName
    );
    ```
  </Accordion>

  <Accordion title="UI not visible">
    **Symptoms:** UI components don't appear.

    **Solutions:**

    1. Call `Show()` on showable components
    2. Check component is attached to visible actor
    3. Verify materials are loaded

    ```cpp theme={null}
    // Make sure to show UI
    Button->Show();
    ```
  </Accordion>

  <Accordion title="Text overflow">
    **Symptoms:** Long text messages does not wrap

    \*\*Solution: \*\*Write shorter messages or add line breaks. There is no other solution at this time
  </Accordion>
</AccordionGroup>

***

## Plugin Issues

<AccordionGroup>
  <Accordion title="Plugin not loading">
    **Symptoms:** Plugin features unavailable at runtime.

    **Solutions:**

    1. Verify plugin is enabled in .uproject
    2. Check module dependencies in Build.cs
    3. Look for load errors in Output Log

    ```json theme={null}
    // Verify in .uproject
    {
      "Plugins": [
        { "Name": "LCK", "Enabled": true },
        { "Name": "LCKTablet", "Enabled": true }
      ]
    }
    ```
  </Accordion>

  <Accordion title="Missing module dependencies">
    **Symptoms:** Linker errors or undefined symbols.

    **Solutions:** Ensure all required modules are listed:

    ```csharp theme={null}
    PublicDependencyModuleNames.AddRange(new string[] {
        "LCKCore",
        "LCKAudio",
        "LCKUI",      // If using UI
        "LCKTablet"   // If using tablet
    });
    ```
  </Accordion>
</AccordionGroup>

***

## Diagnostic Commands

### Enable Verbose Logging

```ini theme={null}
; DefaultEngine.ini
[Core.Log]
LogLCK=VeryVerbose
LogLCKEncoding=VeryVerbose
LogLCKAudio=VeryVerbose
LogLCKUI=Verbose
LogLCKTablet=Verbose
```

### Runtime Diagnostics

```cpp theme={null}
void AMyActor::DiagnoseLCK()
{
    // Check subsystem
    auto* Subsystem = GetWorld()->GetSubsystem<ULCKSubsystem>();
    UE_LOG(LogTemp, Log, TEXT("Subsystem: %s"),
        Subsystem ? TEXT("OK") : TEXT("MISSING"));

    // Check service
    auto* Service = Subsystem ? Subsystem->GetService() : nullptr;
    UE_LOG(LogTemp, Log, TEXT("Service: %s"),
        Service ? TEXT("OK") : TEXT("MISSING"));

    // Check recorder
    auto* Recorder = GetWorld()->GetSubsystem<ULCKRecorderSubsystem>();
    UE_LOG(LogTemp, Log, TEXT("Recorder: %s"),
        Recorder ? TEXT("OK") : TEXT("MISSING"));

    // Check audio sources
    TArray<ILCKAudioSource*> Sources;
    IModularFeatures::Get().GetModularFeatureImplementations<ILCKAudioSource>(
        ILCKAudioSource::GetModularFeatureName(), Sources);
    UE_LOG(LogTemp, Log, TEXT("Audio sources: %d"), Sources.Num());
}
```

***

## Getting Help

If you can't resolve an issue:

1. Enable verbose logging and capture the output
2. Note the exact error message and conditions
3. Join our [Community Discord](https://liv.tv/discord)
