Overview
This guide covers the complete workflow for uploading media, monitoring processing, adding chapters, and managing media assets.Prerequisites
- An item created (see Managing Content)
- Media file or URL ready to upload
- API token for authentication
Upload Process
Uploading media to Haystack is a two-step process:Step 1: Create Media Asset
First, create a media asset record and receive an upload URL:External URLs for playback only: If you provide a YouTube or Vimeo URL, it will be used for embedded playback in your application. However, you must still upload the original video file in Step 2 for AI processing.
Step 2: Upload File
Use the returneduploadUrl to upload your video or audio file:
- Video: MP4, MOV, AVI, MKV, WebM
- Audio: MP3, WAV, AAC, M4A, FLAC
Complete Upload Function
Here’s a complete helper function that handles both steps:Monitoring Processing Status
Polling Method
Check processing status periodically:For the best user experience with bulk uploads, implement a background job that polls the API every 30-60 seconds to check status updates.
Adding Chapters
Automatic Chapter Detection
Request automatic chapter generation during processing:Manual Chapters
Create custom chapters with precise control:Managing Thumbnails
Thumbnail availability depends on which video player you’re using.For Haystack Custom Player
When using the Haystack custom player, thumbnails are automatically generated via Mux. Access them via the Mux image API:For YouTube/Vimeo Players
When using YouTube or Vimeo players, retrieve thumbnails from your item’s artwork:Playback Integration
HLS Streaming
Use the HLS playback URL with any HLS-compatible player:HLS.js Example
Multiple Media Assets
Items can have multiple media assets (e.g., audio and video versions):Updating Media
Replace Media
To replace media, delete the old asset and upload a new one:Complete Upload Workflow
Here’s a complete example combining all steps:Troubleshooting
Common Issues
Upload Fails or Times Out
Upload Fails or Times Out
Causes:
- File too large (>5GB for direct upload)
- Poor internet connection
- Unsupported codec
- Use external URL method for large files
- Compress video before upload
- Ensure video uses H.264 codec
Processing Fails
Processing Fails
Causes:
- Corrupt video file
- Invalid URL
- Unsupported format
- Test playback locally before upload
- Ensure URL is publicly accessible
- Convert to MP4 with H.264/AAC
Transcription Quality Poor
Transcription Quality Poor
Causes:
- Low audio quality
- Background noise
- Multiple overlapping speakers
- Use high-quality audio recording
- Remove background noise in post-production
- Ensure clear, single speaker audio
Slow Processing
Slow Processing
Causes:
- Very long videos (>2 hours)
- 4K resolution
- High platform load
- Expect 1-2x realtime processing
- Poll every 30-60 seconds to check status
- Consider splitting very large files into segments
Best Practices
Optimize Before Upload
Compress videos to reasonable bitrates (5-10 Mbps for 1080p) to save storage and bandwidth
Poll Responsibly
Check processing status every 30-60 seconds to avoid rate limits
Add Chapters
Break long content into chapters for better user experience and engagement
Test Playback
Verify video plays correctly before uploading to catch issues early
Next Steps
Media Management Concepts
Deep dive into media processing pipeline

