
[TikTokLiveSharp](https://github.com/frankvHoof93/TikTokLiveSharp) is a C# library for connecting to TikTok LIVE streams.
It supports both standard C# applications and Unity game projects.

<Callout type="info">
  View the full source on [GitHub](https://github.com/frankvHoof93/TikTokLiveSharp).
</Callout>

## Quickstart

<Steps>
<Step>

### Install the package

Install via NuGet:

```bash
dotnet add package TikTokLive_Sharp
```

Or search for `TikTokLive_Sharp` in the NuGet Package Manager.

</Step>
<Step>

### Set your API key

```csharp
using TikTokLiveSharp.Client;

var client = new TikTokLiveClient("username");
client.Settings.SigningKey = "YOUR_API_KEY";
```

</Step>
<Step>

### Connect and listen to events

```csharp
using TikTokLiveSharp.Client;
using TikTokLiveSharp.Events;

var client = new TikTokLiveClient("username");
client.Settings.SigningKey = "YOUR_API_KEY";

client.OnConnected += (sender, e) => {
    Console.WriteLine("Connected!");
};

client.OnComment += (sender, e) => {
    Console.WriteLine($"{e.User.Nickname}: {e.Comment}");
};

client.OnGiftMessage += (sender, e) => {
    Console.WriteLine($"{e.User.Nickname} sent a gift!");
};

await client.Start();
```

</Step>
</Steps>

## Unity Integration

For Unity projects, download the Unity package from the [GitHub Releases](https://github.com/frankvHoof93/TikTokLiveSharp/releases)
page and import it into your project. See the [Unity Setup Guide](https://github.com/frankvHoof93/TikTokLiveSharp/blob/main/Setup_Unity.MD) for details.

See the [API Key Usage](/docs/api-key-usage/csharp-unity) guide for more configuration options.
