Voiced by Amazon Polly |
Overview
Uploading large video files directly from the browser to Amazon S3 is a common requirement in modern web applications, especially in domains like virtual interviews, e-learning, or video messaging. However, traditional browser storage mechanisms like localStorage or sessionStorage are limited, typically allowing only up to 5MB of storage per origin.
This limitation makes handling large media files a challenge. To overcome this, we used IndexedDB, a low-level API available in all modern browsers that allows structured storage of large amounts of data, including binary files like videos. Combined with multipart upload to Amazon S3, this approach provides a robust, resumable, and efficient way to upload large video files directly from the browser.
This blog will explore how IndexedDB fits into this workflow and how it helped us solve a real-world challenge in a browser-based video recording application.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Introduction
While developing a browser-based video recording and submission tool, we faced a major roadblock: the browser cache couldn’t handle large video files reliably. We needed a persistent client-side storage option that was resilient to page reloads and capable of handling large binary objects.
This blog explains the architecture and implementation of this solution.
Why IndexedDB?
Challenges with Default Storage Options
- localStorage and sessionStorage are limited to ~5MB.
- These are synchronous APIs that are unsuitable for storing binary data like videos.
- Temporary memory storage is volatile and does not survive page reloads.
Benefits of IndexedDB
- It supports large binary data (Blobs, Files) in hundreds of MBs or GBs.
- Asynchronous API, non-blocking, and reliable.
- Data remains persistent across sessions even after a browser refresh.
- Well-supported across all major browsers (Chrome, Firefox, Safari, Edge).
How It Works: Architecture and Flow
- Store Video in IndexedD
After the user records or selects a video, we store it in IndexedDB using the idb library to simplify API calls. Each video is stored as a Blob with a unique identifier:
1 |
await db.put('videos', videoBlob, 'video-123'); |
2. Upload in Chunks Using Amazon S3 Multipart Upload
Once stored, we:
- Read the video from IndexedDB
- Slice it into smaller chunks (e.g., 5MB each)
- Fetch presigned URLs from our backend for each chunk
- Upload each chunk to Amazon S3 individually
- Complete the multipart upload via a final API call
Work Flow Diagram
Figure 1: Architecture for IndexedDB-Based Amazon S3 Multipart Upload
Real-World Use Case
In our interview bot platform, candidates record video responses that must be uploaded instantly without backend compression or processing. Here’s what we achieved using IndexedDB:
- Video survives accidental refresh or reload.
- Upload progress can be resumed if interrupted.
- Amazon S3 upload completed securely using presigned URLs.
- No server-side storage or processing was required.
This approach worked reliably for videos as large as 500MB and provided seamless UX.
Prompt Engineering Tips (Optional for Devs)
If you’re prompting users to interact with this feature:
- Notify them of potential large file sizes.
- Provide real-time upload progress indicators.
- Allow retries using the IndexedDB-stored file.
Getting Started: Key Implementation Steps
- Use a wrapper like IDB to work with IndexedDB easily.
- Use Blob.slice() to divide videos into 5MB chunks.
- Request presigned URLs from your backend using video metadata.
- Use fetch() or axios.put() to upload each chunk.
- Track ETag values for each part.
- Complete a multipart upload using a final call to your backend.
Conclusion
IndexedDB, combined with Amazon S3’s multipart upload capability, offers a powerful client-side solution for uploading large files directly from the browser. It removes the need for intermediate servers, reduces memory issues, and enhances the user experience in web applications involving video content.
This approach is ideal for use cases like browser-based recording tools, asynchronous interviews, media sharing apps, and more, where large file handling on the client side is critical.
Drop a query if you have any questions regarding IndexedDB and we will get back to you quickly.
Making IT Networks Enterprise-ready – Cloud Management Services
- Accelerated cloud migration
- End-to-end view of the cloud environment
About CloudThat
CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.
FAQs
1. How much can I store in IndexedDB?
ANS: – It depends on the browser and available disk space, but generally supports hundreds of MBs to GBs.
2. Can the user resume upload after a page refresh?
ANS: – Yes, if the video remains in IndexedDB, the upload can be resumed.
3. Is this approach secure?
ANS: – Yes, IndexedDB is origin-restricted. Always upload to Amazon S3 using presigned URLs with short expiry times for further security.

WRITTEN BY Ahmad Wani
Ahmad works as a Research Associate in the Data and AIoT Department at CloudThat. He specializes in Generative AI, Machine Learning, and Deep Learning, with hands-on experience in building intelligent solutions that leverage advanced AI technologies. Alongside his AI expertise, Ahmad also has a solid understanding of front-end development, working with technologies such as React.js, HTML, and CSS to create seamless and interactive user experiences. In his free time, Ahmad enjoys exploring emerging technologies, playing football, and continuously learning to expand his expertise.
Comments