Open Source Libraries

C# / Unity

Connect to TikTok LIVE streams in real-time with TikTokLiveSharp for C# and Unity.

|View as Markdown|

TikTokLiveSharp is a C# library for connecting to TikTok LIVE streams. It supports both standard C# applications and Unity game projects.

View the full source on GitHub.

Quickstart

1

Install the package

Install via NuGet:

dotnet add package TikTokLive_Sharp

Or search for TikTokLive_Sharp in the NuGet Package Manager.

2

Set your API key

using TikTokLiveSharp.Client;

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

Connect and listen to events

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();

Unity Integration

For Unity projects, download the Unity package from the GitHub Releases page and import it into your project. See the Unity Setup Guide for details.

See the API Key Usage guide for more configuration options.