C# SDK
Learn how to use FastPix C# SDK to build video apps with media upload, live stream, and playback.
Add secure, scalable video to your .NET project
The FastPix C# SDK gives you everything you need to manage video from your backend. Upload files from a public URL, attach metadata, and retrieve playback links, all without building encoding pipelines or managing storage. With this SDK, you can:
- Upload and organize video assets
- Define access control and metadata
- Generate HLS playback URLs
- Streamline video delivery from your .NET server
Prerequisites
Before you start using the SDK, make sure you have the following:
- .NET 8.0 or later: This SDK is compatible with .NET 8.0 or higher
- Visual Studio 2022 or VS Code: Recommended IDE for C# development
- NuGet Package Manager: Required for package management
- FastPix API credentials: You'll need an Access Token and a Secret Key. You can generate these credentials by following the steps in the Authentication guide
- Basic understanding of C# and REST APIs: Familiarity with C# development and API integration concepts
Installation
Install the SDK using NuGet Package Manager Console:
Install-Package FastpixOr using .NET CLI:
dotnet add package FastpixLocal Reference
To add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/Fastpix/Fastpix.csprojImport the SDK
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Models.Requests;
using System.Collections.Generic;Example
Let's create a file named Program.cs
This example shows how to upload a video from a public URL with metadata and public access:
NOTE
In the following example, replaceyour-access-tokenandyour-secret-keywith the Access Token ID and Secret Key values from the.envfile you downloaded.
using Fastpix;
using Fastpix.Models.Components;
using System.Collections.Generic;
var sdk = new FastpixSDK(security: new Security() {
Username = "your-access-token",
Password = "your-secret-key",
});
var req = new CreateMediaRequest() {
Inputs = new List<Fastpix.Models.Components.Input>() {
Fastpix.Models.Components.Input.CreatePullVideoInput(
new PullVideoInput() {}
),
},
Metadata = new Dictionary<string, string>() {
{ "<key>", "<value>" },
},
};
var res = await sdk.InputVideo.CreateMediaAsync(req);
// handle responseAfter the video is processed, you can use the media ID to fetch playback info, monitor status, or transform content through the API.
Run the example
To execute the C# program, use the following command. Make sure to replace Program.cs with your actual file name if it's different:
dotnet runNOTE
Some methods might throw errors when you are on a trial plan.
Full documentation
See the FastPix C# SDK for additional examples, API methods, and advanced usage.
Updated 17 days ago