Upload videos directly
FastPix Direct Uploads provide a streamlined solution for uploading media (video and audio) directly to your platform from client applications. This guide will simplify the process and highlight how users can effectively utilize authenticated upload URLs for seamless content delivery.
Why to use FastPix direct uploads
- Authenticated access: Grant authenticated access for direct uploads from mobile and web applications, ensuring secure and controlled content management.
- Flexible upload options: Upload media directly from your server or use command-line tools, providing ultimate flexibility in how you manage your media.
- Storage efficiency: Eliminate the need to store original files on your local system, reducing storage costs and simplifying file management.
- Better user experience: Deliver exceptional experiences to your audience with efficient content delivery, reducing loading times and improving accessibility.
Use case scenarios
FastPix Direct Uploads can be utilized in multiple scenarios:
- Mobile app uploads: Users can upload videos directly from their mobile devices, enhancing user-generated content (UGC) capabilities.
- Web app uploads: Web applications can facilitate direct uploads, allowing users to share content easily.
- Server-side content uploads: Large platforms can upload media files in batches from their servers, streamlining content management.
- Command-line tool uploads: Developers can leverage command-line tools for quick and efficient uploads, perfect for automated workflows.
Uploading media to FastPix in 3 steps
Follow these steps to easily upload content directly to FastPix:
Step 1: Generate a unique upload URL
- Generate an access token: Create a new Access Token in FastPix dashboard. This token consists of a Token ID (username) and Token Secret (password) pair, which are necessary for authenticating with the FastPix Video API. See the guide.
- Make the API request: You can visit FastPix API reference and navigate to the Upload media from device endpoint. This lets you create a new direct upload with your desired media settings.
- Receive your upload URL: The API in its response will generate an authenticated URL specifically for your upload. This URL is unique and can be used directly in your client applications.
- Keep track of your upload ID: Along with the URL, you will receive a unique ID for this direct upload. Make sure to save this ID for tracking the upload progress later through the API.
Command line tool:
curl --request POST \
--url https://v1.fastpix.io/on-demand/uploads \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"corsOrigin": "*",
"pushMediaSettings": {
"accessPolicy": "public"
}
}
'
Javascript:
<script>
// This endpoint provides you with the signed URL necessary for uploading your video.
const url = 'https://v1.fastpix.io/on-demand/uploads';
// The FastPix Video API employs a token key pair consisting of a Token ID (username) and Token Secret (password) for authentication.
// Generate a new Access Token in the Access Token settings located within your FastPix Organization dashboard.
const username = '';
const password = '';
// Initialize the data object
const data = {
corsOrigin: '*',
pushMediaSettings: {
accessPolicy: 'public' // can be public or private
},
};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(username + ':' + password),
},
body: JSON.stringify(data),
}
fetch(url, options)
.then(response => {
if (response.success) {
// You can fetch the signedUrl in the response
}
})
</script>
Step 2: Initiate the upload
With the upload URL in hand, you’re ready to upload your media content. In your client application (whether it’s a mobile or web app), use the provided URL to initiate a PUT request. Include the file you want to upload in the request body. The API accepts the media file from the device and uploads it to the FastPix platform.
Step 3: Track your upload
Once uploaded, the media undergoes processing and is assigned a unique ID for tracking. Retain this uploadId for any future operations related to this upload.
Check your FastPix dashboard to confirm successful uploads. You'll see new assets listed with the settings you specified during setup, along with the uploaded video. Alternatively, you can also use the Get Media by ID endpoint to check the status of the uploaded media asset and see if it has transitioned to a ready status for playback.
USING WEBHOOKS
To notify your application about the status of this API request check webhooks for upload related events .
Uploading large media files
FastPix resumable uploads SDK allows large files to be uploaded in smaller, manageable chunks rather than as a single request. This approach ensures that if an upload is interrupted due to network issues, server timeouts, or other disruptions, it can resume from where it left off rather than restarting the entire process.By breaking files into chunks, resumable uploads improve reliability, reduce the risk of data loss, and optimize bandwidth usage. This method is particularly beneficial for handling large media files, ensuring smoother user experiences, and enabling efficient uploads even in unstable network conditions.
Additionally, resumable uploading supports error handling, retry mechanisms, and progress tracking, making it an essential feature for modern file transfer systems.
Updated 27 days ago