Overview
MediaStream provides a robust video upload system that handles large video files by breaking them into chunks. This ensures reliable uploads even for multi-gigabyte video files, with real-time progress tracking.Chunked Upload
Split large files into manageable 10MB chunks
Progress Tracking
Real-time upload progress with percentage display
Resume Support
Continue uploads if connection is interrupted
Large Files
Support for videos of any size
How It Works
The upload process follows a two-step approach:- Register the upload with your backend (which contacts Mediastream)
- Upload chunks directly to Mediastream’s servers
Upload Component
The upload functionality is implemented as a Vue component with progress tracking.Complete Upload Implementation
Upload Configuration
Chunk Size
The default chunk size is 10MB, which provides a good balance between:- Reliability: Smaller chunks are less likely to fail
- Efficiency: Larger chunks mean fewer HTTP requests
- Progress Granularity: More frequent progress updates
Supported File Types
Currently, the upload component accepts:While the UI currently restricts to MP4 files, Mediastream supports various video formats including MP4, MOV, AVI, and more.
Backend Integration
The upload process requires backend support to communicate with Mediastream.Upload Controller
Mediastream Service
The service handles API authentication automatically:Progress Tracking
The upload component provides detailed progress feedback to users.Progress Calculation
Progress Display
The progress is shown using a visual progress bar and percentage:0-33%
Initial chunks uploading
34-66%
Middle chunks in progress
67-100%
Final chunks completing
Upload Flow
Step-by-Step Process
Error Handling
The upload system includes error handling for common issues:Common Upload Errors
Network Timeout
Network Timeout
If a chunk upload times out:
- The error will be caught and logged
- Consider implementing retry logic for failed chunks
- Check your network connection stability
File Too Large
File Too Large
If Mediastream rejects the file:
- Verify your account’s upload limits
- Check the file format is supported
- Ensure the file isn’t corrupted
Invalid Token
Invalid Token
If the upload token is rejected:
- Verify your API key is correct
- Check the token hasn’t expired
- Ensure proper authentication headers
Chunk Order Issues
Chunk Order Issues
If chunks arrive out of order:
- The current implementation uploads sequentially
- Don’t modify the chunk numbering system
- Ensure chunks are uploaded in the correct order
Best Practices
File Validation
File Validation
Before uploading, validate:
- File size (set reasonable limits for your use case)
- File format (MP4, MOV, etc.)
- Video resolution and bitrate
- File name (avoid special characters)
User Feedback
User Feedback
Provide clear feedback during upload:
- Show progress percentage
- Display estimated time remaining
- Show success/error messages
- Prevent navigation during upload
Network Resilience
Network Resilience
Handle network issues gracefully:
- Implement retry logic for failed chunks
- Save upload state for resume capability
- Show appropriate error messages
- Allow users to cancel uploads
Performance
Performance
Optimize upload performance:
- Use appropriate chunk sizes (10MB is recommended)
- Consider parallel chunk uploads for faster transfer
- Compress videos before upload when possible
- Monitor bandwidth usage
Advanced Features
Parallel Chunk Uploads
For faster uploads, you can modify the code to upload multiple chunks simultaneously:Upload Resume
To implement upload resume capability:Troubleshooting
Upload Stuck at 0%
Upload Stuck at 0%
If upload doesn’t start:
- Check browser console for errors
- Verify API endpoint is accessible
- Ensure file input has a file selected
- Check CORS configuration
- Verify Mediastream API key is valid
Upload Fails Midway
Upload Fails Midway
If upload fails during progress:
- Check network connection
- Look for server timeout errors
- Verify chunk size isn’t too large
- Check server logs for errors
- Try uploading a smaller file
Progress Not Updating
Progress Not Updating
If progress bar doesn’t move:
- Check that progress state is reactive
- Verify onUploadProgress callback is firing
- Ensure Progress component is properly configured
- Check for JavaScript errors
Next Steps
Episode Management
Link uploaded videos to episodes
Series Management
Organize videos into series