> ## 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.

# LckCaptureType

> Specify whether the camera is configured for local recording or live streaming, which determines quality settings and bitrate.

## What Problem Does This Solve?

Recording and streaming have different requirements. Recording prioritizes quality and file size—you want high bitrate, 60fps, large files you'll upload later. Streaming prioritizes bandwidth and latency—lower bitrate, 30fps, smaller data sent live.

`LckCaptureType` lets you switch between these modes, which automatically applies the appropriate track descriptor from your quality options (recording vs. streaming settings).

## When to Use This

Use `LckCaptureType` when:

* Your app supports both recording and streaming
* You want different quality settings for each mode
* Users can toggle between "Record for upload" vs. "Stream live"
* You need to optimize for bandwidth (streaming) vs. quality (recording)

Skip this if you only support one mode.

***

## Quick Example

```csharp theme={null}
// Switch to streaming mode (applies streaming track descriptor)
var result = lckService.SetActiveCaptureType(LckCaptureType.Streaming);
if (!result.IsOk)
{
    Debug.LogError($"Failed to set capture type: {result.Message}");
}

// Later, switch back to recording
lckService.SetActiveCaptureType(LckCaptureType.Recording);

// Check current mode
var currentType = lckService.GetActiveCaptureType();
Debug.Log($"Current mode: {currentType.Result}");
```

***

## How It Works

When you define a `QualityOption`, you specify **two** track descriptors:

```csharp theme={null}
var qualityOption = new QualityOption(
    name: "High",
    isDefault: true,
    cameraTrackDescriptor: new CameraTrackDescriptor(
        new CameraResolutionDescriptor(1920, 1080),
        bitrate: 10 << 20,  // 10 Mbps for recording
        framerate: 60
    ),
    streamingCameraTrackDescriptor: new CameraTrackDescriptor(
        new CameraResolutionDescriptor(1920, 1080),
        bitrate: 5 << 20,   // 5 Mbps for streaming
        framerate: 30
    )
);
```

**When you set the capture type:**

* `LckCaptureType.Recording` → uses `cameraTrackDescriptor`
* `LckCaptureType.Streaming` → uses `streamingCameraTrackDescriptor`

The SDK automatically applies the right settings.

***

## Common Patterns

### Toggle between modes with UI

```csharp theme={null}
public class CaptureTypeToggle : MonoBehaviour
{
    public void OnRecordingToggleChanged(bool isRecording)
    {
        var captureType = isRecording 
            ? LckCaptureType.Recording 
            : LckCaptureType.Streaming;
        
        var result = lckService.SetActiveCaptureType(captureType);
        
        if (!result.IsOk)
        {
            Debug.LogError($"Failed to switch mode: {result.Message}");
            return;
        }
        
        UpdateUI(captureType);
    }
    
    void UpdateUI(LckCaptureType type)
    {
        string mode = type == LckCaptureType.Recording ? "Recording" : "Streaming";
        modeLabel.text = $"Mode: {mode}";
    }
}
```

### Auto-select based on network

```csharp theme={null}
void Start()
{
    // Use streaming if network available, recording otherwise
    bool hasNetwork = Application.internetReachability != NetworkReachability.NotReachable;
    
    var captureType = hasNetwork 
        ? LckCaptureType.Streaming 
        : LckCaptureType.Recording;
    
    lckService.SetActiveCaptureType(captureType);
    
    Debug.Log($"Selected {captureType} mode (network: {hasNetwork})");
}
```

### Initialize to default mode

```csharp theme={null}
void InitializeLCK()
{
    // ... LckCore.Initialize() ...
    
    // Default to recording mode
    var result = lckService.SetActiveCaptureType(LckCaptureType.Recording);
    
    if (!result.IsOk)
    {
        Debug.LogError($"Failed to set default capture type: {result.Message}");
    }
}
```

***

## Typical Settings by Mode

### Recording Mode

Optimized for quality and upload:

* **Higher bitrate** (8-12 Mbps) for better quality
* **Higher framerate** (60 fps) for smooth motion
* **Larger file sizes** acceptable

```csharp theme={null}
// Recording track example
new CameraTrackDescriptor(
    new CameraResolutionDescriptor(1920, 1080),
    bitrate: 10 << 20,     // 10 Mbps
    framerate: 60,
    audioBitrate: 256000   // 256 kbps
)
```

### Streaming Mode

Optimized for bandwidth and latency:

* **Lower bitrate** (3-5 Mbps) to reduce bandwidth
* **Standard framerate** (30 fps) for stability
* **Smaller data packets** for real-time delivery

```csharp theme={null}
// Streaming track example
new CameraTrackDescriptor(
    new CameraResolutionDescriptor(1920, 1080),
    bitrate: 5 << 20,      // 5 Mbps
    framerate: 30,
    audioBitrate: 192000   // 192 kbps
)
```

***

## Enum Values

| Value       | Description          | Use Case                                            |
| ----------- | -------------------- | --------------------------------------------------- |
| `Recording` | Local recording mode | Save to device, upload later, prioritize quality    |
| `Streaming` | Live streaming mode  | Real-time delivery, prioritize bandwidth efficiency |

***

## API Reference

### Set Capture Type

```csharp theme={null}
LckResult SetActiveCaptureType(LckCaptureType captureType)
```

**Parameters:**

* `captureType` — `Recording` or `Streaming`

**Returns:** `LckResult` indicating success/failure

### Get Capture Type

```csharp theme={null}
LckResult<LckCaptureType> GetActiveCaptureType()
```

**Returns:** `LckResult` containing current capture type

***

## When to Switch Modes

<Check>
  **Before starting capture** — Don't change during active recording
</Check>

<Check>
  **Based on user preference** — UI toggle for "Record" vs. "Stream"
</Check>

<Check>
  **Network availability** — Auto-select streaming if online
</Check>

<Warning>
  **Cannot change during recording** — Returns `CantEditSettingsWhileRecording` error
</Warning>

***

## Best Practices

```csharp theme={null}
// Good: Check before switching
var currentType = lckService.GetActiveCaptureType();
if (currentType.Result != desiredType)
{
    var result = lckService.SetActiveCaptureType(desiredType);
    if (!result.IsOk)
    {
        Debug.LogError($"Mode switch failed: {result.Message}");
    }
}

// Bad: Switching during recording (will fail)
lckService.StartRecording();
lckService.SetActiveCaptureType(LckCaptureType.Streaming); // ERROR
```

<Check>
  **Define both tracks** — Always configure recording and streaming in QualityOption
</Check>

<Check>
  **Test both modes** — Ensure settings work for both use cases
</Check>

<Check>
  **Stop before switching** — Don't change modes during active recording
</Check>

***

## Related

* [QualityOption](/api-reference/unity/structs/QualityOption) — Define recording and streaming tracks
* [CameraTrackDescriptor](/api-reference/unity/structs/CameraTrackDescriptor) — Configure bitrate/framerate
