A Unity-Native, Developer-Friendly SDK for Seamless Integration with the FastPix Platform API
The FastPix Unity SDK simplifies integration with the FastPix platform directly within your Unity projects. It provides a interface for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, on-demand content, playlists, video analytics, and signing keys for secure access and token management.
- Upload Media: Seamlessly upload media files from URLs or local devices.
- Manage Media: List, fetch, update, and delete media assets with ease.
- Playback IDs: Generate and manage playback IDs for secure and flexible media access.
- Advanced Media Tools: Generate video summaries, chapters, named entities, subtitles, and perform content moderation.
- Playlist Management: Create and manage playlists, add or remove media, and adjust playback order.
- DRM Support: Configure and manage DRM settings for protected content.
- Create & Manage Live Streams: Effortlessly create, list, update, and delete live streams.
- Control Stream Access: Generate playback IDs to manage viewer access securely.
- Stream Management: Enable, disable, or complete streams with fine-grained control.
- Simulcast to Multiple Platforms: Broadcast live content to multiple platforms simultaneously.
- Create Signing Keys: Generate signing keys for secure token-based access.
- List & Retrieve Keys: Fetch all keys or get details for a specific key.
- Manage Keys: Delete or revoke signing keys to maintain secure access control.
- View Analytics: List video views, get detailed view information, and track top-performing content.
- Concurrent Viewer Insights: Access timeseries data for live and on-demand streams.
- Custom Reporting: Filter viewers by dimensions, list breakdowns, and compare metrics across datasets.
- Error Tracking & Diagnostics: Retrieve logs and analyze errors for proactive monitoring.
For detailed usage, refer to the FastPix API Reference.
To get started with the FastPix Unity SDK, ensure you have the following:
-
The FastPix APIs are authenticated using an Access Token and a Secret Key. You must generate these credentials to use the SDK.
-
Follow the steps in the Authentication with Access Tokens guide to obtain your credentials.
The SDK can either be compiled using dotnet build
and the resultant .dll
file can be copied into your Unity project's Assets
folder, or you can copy the source code directly into your project.
The SDK relies on Newtonsoft's JSON.NET Package which can be installed via the Unity Package Manager.
To do so open the Package Manager via Window > Package Manager
and click the +
button then Add package from git URL...
and enter com.unity.nuget.newtonsoft-json
and click Add
.
using fastpix.io;
using fastpix.io.Models.Components;
using System.Collections.Generic;
var sdk = new Fastpix(security: new Security() {
username="your-access-token"
Password = "secret-key",
});
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<fastpix.io.Models.Components.Input>() {
Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
},
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
MaxResolution = CreateMediaRequestMaxResolution.OneThousandAndEightyp,
};
using(var res = await sdk.InputVideo.CreateMediaAsync(req))
{
// handle response
}
Available methods
- ListDimensions - List the dimensions
- ListFilterValuesForDimension - List the filter values for a dimension
- GetDrmConfiguration - Get list of DRM configuration IDs
- GetDrmConfigurationById - Get DRM configuration by ID
- ListErrors - List errors
- CreateMedia - Create media from URL
- DirectUploadVideoMedia - Upload media from device
- UpdateMediaSummary - Generate video summary
- UpdateMediaChapters - Generate video chapters
- UpdateMediaNamedEntities - Generate named entities
- UpdateMediaModeration - Enable video moderation
- CreatePlaybackIdOfStream - Create a playbackId
- DeletePlaybackIdOfStream - Delete a playbackId
- GetLiveStreamPlaybackId - Get playbackId details
- GetAllStreams - Get all live streams
- GetLiveStreamViewerCountById - Get stream views by ID
- GetLiveStreamById - Get stream by ID
- DeleteLiveStream - Delete a stream
- UpdateLiveStream - Update a stream
- DisableLiveStream - Disable a stream
- CompleteLiveStream - Complete a stream
- ListMedia - Get list of all media
- ListLiveClips - Get all clips of a live stream
- GetMedia - Get a media by ID
- UpdatedMedia - Update a media by ID
- DeleteMedia - Delete a media by ID
- AddMediaTrack - Add audio / subtitle track
- CancelUpload - Cancel ongoing upload
- UpdateMediaTrack - Update audio / subtitle track
- DeleteMediaTrack - Delete audio / subtitle track
- GenerateSubtitleTrack - Generate track subtitle
- UpdatedSourceAccess - Update the source access of a media by ID
- UpdatedMp4Support - Update the mp4Support of a media by ID
- RetrieveMediaInputInfo - Get info of media inputs
- ListUploads - Get all unused upload URLs
- GetMediaClips - Get all clips of a media
- ListBreakdownValues - List breakdown values
- ListOverallValues - List overall values
- GetTimeseriesData - Get timeseries data
- ListComparisonValues - List comparison values
- CreateMediaPlaybackId - Create a playback ID
- DeleteMediaPlaybackId - Delete a playback ID
- GetPlaybackId - Get a playback ID
- CreateAPlaylist - Create a new playlist
- GetAllPlaylists - Get all playlists
- GetPlaylistById - Get a playlist by ID
- UpdateAPlaylist - Update a playlist by ID
- DeleteAPlaylist - Delete a playlist by ID
- AddMediaToPlaylist - Add media to a playlist by ID
- ChangeMediaOrderInPlaylist - Change media order in a playlist by ID
- DeleteMediaFromPlaylist - Delete media in a playlist by ID
- CreateSigningKey - Create a signing key
- ListSigningKeys - Get list of signing key
- DeleteSigningKey - Delete a signing key
- GetSigningKeyById - Get signing key by ID
- CreateSimulcastOfStream - Create a simulcast
- DeleteSimulcastOfStream - Delete a simulcast
- GetSpecificSimulcastOfStream - Get a specific simulcast
- UpdateSpecificSimulcastOfStream - Update a simulcast
- CreateNewStream - Create a new stream
- ListVideoViews - List video views
- GetVideoViewDetails - Get details of video view
- ListByTopContent - List by top content
- GetDataViewlistCurrentViewsGetTimeseriesViews - Get concurrent viewers timeseries
- GetDataViewlistCurrentViewsFilter - Get concurrent viewers breakdown by dimension
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default, an API error will raise a fastpix.io.Models.Errors.APIException
exception, which has the following properties:
Property | Type | Description |
---|---|---|
Message |
string | The error message |
StatusCode |
int | The raw HTTP response |
RawResponse |
HttpResponseMessage | The raw HTTP response |
Body |
string | The response content |
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the CreateMediaAsync
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
fastpix.io.Models.Errors.BadRequestException | 400 | application/json |
fastpix.io.Models.Errors.InvalidPermissionException | 401 | application/json |
fastpix.io.Models.Errors.ForbiddenException | 403 | application/json |
fastpix.io.Models.Errors.ValidationErrorResponse | 422 | application/json |
fastpix.io.Models.Errors.APIException | 4XX, 5XX | */* |
using fastpix.io;
using fastpix.io.Models.Components;
using System;
using fastpix.io.Models.Errors;
using System.Collections.Generic;
var sdk = new Fastpix(security: new Security() {
username="your-access-token"
Password = "secret-key",
});
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<fastpix.io.Models.Components.Input>() {
Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
},
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
MaxResolution = CreateMediaRequestMaxResolution.OneThousandAndEightyp,
};
try
{
using(var res = await sdk.InputVideo.CreateMediaAsync(req))
{
// handle response
}
}
catch (Exception ex)
{
if (ex is BadRequestException)
{
// handle exception
}
else if (ex is InvalidPermissionException)
{
// handle exception
}
else if (ex is ForbiddenException)
{
// handle exception
}
else if (ex is ValidationErrorResponse)
{
// handle exception
}
else if (ex is fastpix.io.Models.Errors.APIException)
{
// handle exception
}
}
The default server can be overridden globally by passing a URL to the serverUrl: string
optional parameter when initializing the SDK client instance. For example:
using fastpix.io;
using fastpix.io.Models.Components;
using System.Collections.Generic;
var sdk = new Fastpix(
serverUrl: "https://api.fastpix.io/v1/",
security: new Security() {
username="your-access-token"
Password = "secret-key",
});
CreateMediaRequest req = new CreateMediaRequest() {
Inputs = new List<fastpix.io.Models.Components.Input>() {
Input.CreateVideoInput(
new VideoInput() {
Type = "video",
Url = "https://static.fastpix.io/sample.mp4",
},
),
},
Metadata = new Dictionary<string, string>() {
{ "key1", "value1" },
},
AccessPolicy = CreateMediaRequestAccessPolicy.Public,
MaxResolution = CreateMediaRequestMaxResolution.OneThousandAndEightyp,
};
using(var res = await sdk.InputVideo.CreateMediaAsync(req))
{
// handle response
}
This SDK is currently in beta, and breaking changes may occur between versions even without a major version update. To avoid unexpected issues, we recommend pinning your dependency to a specific version. This ensures consistent behavior unless you intentionally update to a newer release.
For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference provides comprehensive documentation for all available endpoints and features, ensuring developers can integrate and utilize FastPix APIs efficiently.