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

# Streaming Overview

> Architecture, prerequisites, and platform support for the LIV Camera Kit (LCK) streaming module in Unreal Engine, enabling RTMP live streaming to YouTube, Twitch, or custom endpoints.

<Info>
  **Module:** LCKStreaming | **Version:** 1.0 | **Platforms:** Win64, Android (Quest)
</Info>

## What is LCKStreaming?

LCKStreaming adds live streaming to your Unreal Engine project. It connects to the LIV backend to authenticate users, resolve streaming targets, and push video/audio over RTMP to YouTube, Twitch, or any manual RTMP endpoint.

The module handles the full lifecycle: device-based authentication, streaming configuration, RTMP connection management, encoder health monitoring, and automatic bitrate selection per platform.

## Architecture

```
┌──────────────────────────────────────────────────────┐
│                   Your Game                          │
│                                                      │
│   ULCKStreamingSubsystem (GameInstanceSubsystem)     │
│       ├── StartLogin / Authenticate                  │
│       ├── StartStreaming / StopStreaming              │
│       └── Delegates (events)                         │
└──────────────────┬───────────────────────────────────┘
                   │
          ┌────────▼────────┐
          │  LIV API Client │  REST (dashboard.liv.tv)
          │  - Auth polling  │
          │  - Profile fetch │
          │  - RTMP resolve  │
          └────────┬────────┘
                   │
          ┌────────▼────────┐
          │  Native RTMP    │  librtmp (Win64)
          │  Bridge         │  librtmp.so (Android)
          │  - Mux & send   │
          │  - Health check │
          └─────────────────┘
```

The subsystem coordinates two layers: a REST API client that handles authentication, streaming config, and RTMP URL resolution, and a native RTMP bridge that muxes encoded video/audio and pushes it to the ingest server.

## Module Structure

| Module                | Description                                      |
| --------------------- | ------------------------------------------------ |
| `LCKStreaming`        | Core streaming subsystem, API client, RTMP logic |
| `LCKStreamingAndroid` | Android-specific RTMP bridge and LIV Hub interop |

## Prerequisites

<Warning>
  All four prerequisites must be met before streaming will function. Missing any one of them causes `StartStreaming()` to return `false` silently.
</Warning>

1. **Enable streaming** — Set `bEnableStreaming = true` in **Project Settings → Plugins → LCK SDK → Features**. Defaults to `false`.
2. **Valid Tracking ID** — Your project must have a Tracking ID configured in LCK Developer Settings.
3. **RTMP libraries loaded** — `librtmp` DLLs (Win64) or `librtmp.so` (Android) must be present and loadable at runtime. Check `FLCKStreamingModule::IsRtmpAvailable()`.
4. **LIV account with subscription** — The end user needs a LIV account with an active streaming subscription.

## Platform Support

| Platform        | Status    | Notes                        |
| --------------- | --------- | ---------------------------- |
| Win64           | Supported | Uses bundled librtmp         |
| Android (Quest) | Supported | Uses librtmp.so, LIV Hub app |
| Other           | —         | Not supported at this time   |

## Streaming Targets

| Target  | Description                                    |
| ------- | ---------------------------------------------- |
| YouTube | Automatic broadcast creation via LIV backend   |
| Twitch  | Direct RTMP ingest via LIV backend             |
| Manual  | User-provided RTMP URL for custom destinations |

## Platform Bitrates

Bitrates are selected automatically based on the target platform and resolution.

### YouTube

| Quality | Video Bitrate | Audio Bitrate |
| ------- | ------------- | ------------- |
| SD      | 4 Mbps        | 128 Kbps      |
| HD @30  | 8 Mbps        | 128 Kbps      |
| HD @60  | 12 Mbps       | 128 Kbps      |
| 2K      | 24 Mbps       | 128 Kbps      |
| 4K      | 35 Mbps       | 128 Kbps      |

### Twitch

| Quality | Video Bitrate | Audio Bitrate |
| ------- | ------------- | ------------- |
| SD      | 3 Mbps        | 96 Kbps       |
| HD @30  | 4.5 Mbps      | 96 Kbps       |
| HD @60  | 6 Mbps        | 96 Kbps       |
| 2K      | 9 Mbps        | 96 Kbps       |
| 4K      | 10 Mbps       | 96 Kbps       |

<Note>
  Keyframe interval is fixed at 2 seconds for all targets, as required by YouTube and Twitch ingest servers.
</Note>

## Relationship to Recording

Streaming and recording share the same encoder pipeline. When both are active simultaneously, the streaming module piggybacks on the active recording encoder rather than creating a second one. This means you can stream and record at the same time with no additional encoding overhead.

<Tip>
  If a recording is already in progress when `StartStreaming()` is called, the stream reuses the existing encoder. If no recording is active, streaming acquires its own encoder instance.
</Tip>

## Streaming State Machine

| State       | Description                             |
| ----------- | --------------------------------------- |
| `Idle`      | No streaming activity                   |
| `Pairing`   | Device login in progress                |
| `Paired`    | Authenticated, ready to stream          |
| `Streaming` | RTMP connection active, pushing frames  |
| `Error`     | An error occurred (see `OnStreamError`) |

## Key Timing Constants

| Constant               | Value | Description                                            |
| ---------------------- | ----- | ------------------------------------------------------ |
| Auth poll interval     | 2.5s  | How often the subsystem polls for pairing confirmation |
| Stream start timeout   | 15s   | Maximum wait time for a stream to begin                |
| Health check interval  | 5s    | Frequency of encoder health monitoring                 |
| Health check tolerance | 2     | Consecutive failures before stopping stream            |

## Delegates

The subsystem exposes seven delegates for responding to streaming lifecycle events:

| Delegate                    | Parameters                                      | Fired When                              |
| --------------------------- | ----------------------------------------------- | --------------------------------------- |
| `OnPairingCodeReceived`     | `FString Code`                                  | A new pairing code is generated         |
| `OnAuthenticated`           | —                                               | User successfully authenticates         |
| `OnStreamingConfigReceived` | `ELCKStreamingTargetType, FLCKUserSubscription` | Stream configuration loaded from server |
| `OnStreamStarted`           | —                                               | Live stream begins                      |
| `OnStreamStopped`           | —                                               | Live stream ends                        |
| `OnStreamError`             | `FString ErrorMessage`                          | A streaming error occurs                |
| `OnLoggedOut`               | —                                               | User logs out                           |

## Log Category

```cpp theme={null}
DECLARE_LOG_CATEGORY_EXTERN(LogLCKStreaming, Log, All);
```

## See Also

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/unreal/streaming/quickstart">
    Get streaming in 5 minutes
  </Card>

  <Card title="Authentication" icon="lock" href="/unreal/streaming/authentication">
    Device pairing and login flow
  </Card>

  <Card title="Streaming Subsystem API" icon="code" href="/api-reference/unreal/streaming-subsystem">
    Full API reference
  </Card>
</CardGroup>
