Get started in 5 minutes
FastPix’s video API allows you to build and stream video per your workflow and design. You can customize video for your ideal user and use case. With streamlined setup and integration developers can build modern video interactions and experiences for any stack, any app, at any scale, anywhere - with a faster time to market.
Start using FastPix
Quickly get started with streaming videos; upload and playback videos in your application with FastPix video APIs.
Step 1: Sign up with FastPix
To get started, create an account with FastPix. You would need to sign up to get the API access token and access to the dashboard.
Step 2: Get an API Access Token from the dashboard
After signing up, all you now need is to generate your API access token. FastPix Video API utilizes a token key pair comprising a Token ID and Secret Key for authentication. Navigate to Org Settings and create a new Access Token in the Access Token settings within your Organization settings dashboard.
Access Tokens play a crucial role in FastPix, allowing you to securely interact with the platform. Once you click on Generate new token, a pop-up will appear with input fields to create your new Access Token
Understanding workspace
Workspaces act as parent containers for Access Tokens, Signing Keys, and other elements in FastPix. When you create an Access Token, it is associated with a specific Workspace. For now, let’s focus on the Development workspace, which is ideal for testing and experimentation.
Access token permissions
Access Tokens come with different permissions, regulating the actions and extent of modifications they can perform. As you follow this guide, ensure that your Access Token has both FastPix Video Read and Write permissions. This ensures that you can read existing videos and upload new ones seamlessly.
To keep track of your Access Tokens within your application or project, you can assign them any name, like “Test”. This helps in managing and identifying them easily.
When you’re ready, proceed by clicking the ‘Generate access token’ button. This will create a new Access Token ID and Secret Key for you.
With your newly generated Access Token ID and Secret Key, you’re now set to upload your first video to FastPix. Remember, proper management of your Access Tokens is crucial for the smooth operation of your application.
IMPORTANT
To keep the Access Token information (Secret Key) for future use, download an workspace file (.env) that stores these details. FastPix doesn’t store the exact Secret Key.
It's important to note that FastPix only stores a secret hash, not the Secret Key itself. If the Secret Key is lost, FastPix cannot retrieve it, necessitating the creation of a new Access Token. Also, make sure to keep your Secret Key safe and avoid exposing it, which might cause a security breach on your account.
The response will include an Asset ID and a Playback ID
Asset IDs serve for asset management on api.fastpix.io
(example, for reading or deleting an asset).
Playback IDs
API are used to stream an asset to a video player via stream.fastpix.io
. You can attach multiple playback IDs to a particular asset to generate playback URLs with distinct viewing permissions. You can also delete playback IDs to remove access without deleting the asset.
Step 3: Upload a video
To upload a video to FastPix, you need to follow these steps:
Identify the video: Every video that you store in FastPix is called a Media.API
Create a Media: To create your first media, you need to send a POST request to the /media endpoint API
, where the input value should be the URL of a video file that is accessible online.
Use a demo video link: For your convenience, we’ve provided a demo video link that you can use to send the request. FastPix will retrieve the video from the provided URL and store it as a media asset.
https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
By using this link, you can easily familiarize yourself with the process of creating a media in FastPix. Once you’re comfortable with the process, you can start uploading your own videos and expanding your media library.
curl -X POST 'https://v1.fastpix.io/on-demand'
--user {Access Token ID}:{Secret Key} \
-H 'Content-Type: application/json' \
-d '{
"inputs": [
{
"type": "video",
"url": "https://static.fastpix.io/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4",
"startTime": 0,
"endTime": 60
},
{
"type": "watermark",
"url": "https://static.fastpix.io/watermark-4k.png",
"placement": {
"xAlign": "left",
"xMargin": "10%",
"yAlign": "top",
"yMargin": "10%"
}
}
],
"metadata": {
"key1": "value1"
},
"createSubtitles": {
"name": "name",
"metadata": {
"key1": "value1"
},
"languageCode": "en-us"
},
"accessPolicy": "public",
"mp4Support": "capped_4k",
"optimizeAudio": true,
"maxResolution": "1080p"
}'
The response will contain unique identifiers like a Media ID and a Playback ID.
- Media IDs are essential for media management on api.fastpix.io. For instance, you can use them to read or delete specific media files.
- Playback IDs API are used to deliver media content to a video player via stream.fastpix.io. It is possible to link multiple playback IDs to a single media file, creating streaming or playback URLs that have different access rights. Additionally, you can also delete playback IDs to revoke viewing rights without the need to erase the actual media file.
{
"success": true,
"data": [
{
"id": "iyuU4HFxhJg1vMHM2uztnJut1hIJBuNBSzJionwUV7c",
"trial": true,
"status": "created",
"createdAt": "2023-10-20T10:50:34.594302Z",
"updatedAt": "2023-10-20T10:50:34.594302Z",
"playbackIds": [
{
"id": "6ta85f64-5717-4562-b3fc-2c963f66afa6",
"accessPolicy": "public"
}
],
"metadata": {
"key1": "value1"
},
"mp4Support": "capped_4k",
"maxResolution": "1080p"
}
]
}
PLEASE NOTE
FastPix does not store the original video file in it's exact form. Therefore, if preserving your original high-quality files is crucial, refrain from deleting them after uploading to FastPix.
Step 4: Check for status: created
After initiating thePOST
request, FastPix initiates the download and processing of the video content. This operation is generally completed within seconds for smaller-sized files, but larger files or slower internet connections might extend this duration to several minutes.
Once the video is fully processed and ready for playback, the media status
changes to "created."
It is essential to wait until this status update before attempting to play the video.
For timely updates on media status changes, the best way is through webhooks
. FastPix can send over a webhook notification as soon as the asset is ready. (Refer to the webhooks guide
for more details.)
Step 5: Watch your video
To initiate playback of a media, create a playback URL using the PLAYBACK_ID
provided upon the media’s creation in FastPix.
Once you enter the PLAYBACK_ID
from the API response, your playback URL would look like below. This is just an example.
https://play.fastpix.io/?playbackId=300048a4-5a14-4fdd-8d34-3e72ff385eca
Player Integration with HTML
<script src="https://cdn.jsdelivr.net/npm/@fastpix/fp-player"></script>
<fp-player
playbackId="{PLAYBACK_ID}"
metadata-video-title="TEST VIDEO TITLE"
metadata-viewer-user-id="user-id-123"
metadata-video-id="qwe-we3r-23ew">
</fp-player>
Refer to the playback guide for details on integrating with a video player.
Once you have successfully implemented the integration, connect FastPix Data with your player to monitor playback performance.
Step 6: Manage your media
Upload and playback of your video is one part to get started but along with you would need a bunch of other functionalities to build video into your product. Once you have already added media files into your FastPix environment, the following endpoints would come handy:
Create media from URL
APICreate media from URL
APIGet list of all media
APIGet a media by ID
APIUpdate a media by ID
APIDelete a media by ID
APIGet info of media inputs
APICreate a playback ID
APIDelete a playback ID
APIUpload media from device
Updated 16 days ago