Testflight 6.4.0(58)
In SVOD (Subscription Video on Demand) environment, offline downloads are a crucial feature for users who want to enjoy content without an internet connection. Apple’s AVFoundation provides an
HLS offline download solution, along with a demo app (HLSCatalog) to illustrate its use. While this solution works well for many standard streaming cases, our customer's app faced several issues due to specific stream configurations and download patterns. This article covers why I developed a custom download solution for iOS and iPadOS, improving download speed, order, and resilience while also addressing issues that impacted user experience and platform costs.
Challenges with Apple’s HLS Offline Download Solution
Apple’s AVFoundation HLS offline download solution, as demonstrated in their HLSCatalog app, is well-suited to typical streaming needs. However, for this SVOD content, I encountered several unique challenges:
1. Short, Numerous Segments Leading to High Bandwidth Consumption
Many of the streams used unconventional segment durations, such as 1.6-second segments, resulting in tens of thousands of individual segments for longer movies, like
Oppenheimer. This frequent segmentation increased bandwidth consumption and demanded significant resources, often leading to incomplete downloads and repeated retries.
2. Misaligned Audio and Video Segments
Some episodes in the library, such as
The Good Doctor, contained different segment durations for audio and video tracks (e.g., 4 seconds for video and 3.2 seconds for audio). This misalignment added complexity to synchronization, making efficient segment handling crucial.
3. Retry Loops and User Frustration
Apple’s solution is designed to download content at 6-10 times the real-time playback rate (a one-hour movie ideally downloads in 6-10 minutes). However, this setup frequently encountered issues with incomplete segments, triggering retries that not only increased bandwidth costs but also caused user frustration. Progress bars would often climb to 99% only to reset to 0% due to these retries, creating a confusing and discouraging experience. These download issues also increased with audience size, with peak problems often occurring in the evening, when user demand was highest.
4. Unpredictable Download Prioritization
Apple’s method often downloads assets in parallel but with inconsistent prioritization. Users would occasionally find that content they selected first wasn’t downloaded in the expected order, adding to the unpredictability of the download experience.
5. Limited Video Quality
To reduce download issues, video quality on downloads had initially been lowered, with reduced resolution and bitrate compared to online streaming. This choice was implemented before my involvement in the project as a workaround to prevent the most frequent download issues but left some users disappointed with the limited quality currently available offline.
Custom Offline Download Solution: Fast, Reliable, and Future-Proof
To address these issues, I developed a custom downloader inspired by an earlier project,
CloudDVR.tv, from 2012, which leveraged cloud storage for live TV and VOD content. The new solution manages segment complexities effectively, offers better download speeds, and reduces retries for a smoother experience.
1. Increased Download Speed and Reduced Retries
The custom downloader was designed to download at the fastest rate the network allows, reaching up to one segment every 1/100th of a second. This improvement reduced download times significantly—from 45 minutes to under 9 minutes for a full-length movie like
Oppenheimer. Additionally, by improving segment handling, retries were minimized, cutting down on data redundancy and platform costs while ensuring smoother progress tracking.
2. Controlled and Consistent Download Order
With the custom downloader, assets download in the precise order users select, eliminating unpredictable prioritization. This ensures that the most desired content is available first, improving user satisfaction by providing a predictable experience.
3. Future Video Quality Improvements
The custom solution also enables us to enhance video quality in the near future by adjusting segment length, resolution, and bitrate. This flexibility allows us to gradually increase quality for downloaded content, offering users a higher fidelity experience without compromising download reliability.
4. Enhanced Resilience and Error Handling
The custom solution ensures that downloads resume smoothly after any interruptions, such as backgrounding, app crashes, or network changes. This resilience prevents incomplete downloads and enables a more consistent experience for offline content.
5. Controlled Asset Management
With this solution, users gain full control over downloaded assets. Developers can implement custom policies to prevent unwanted deletions and manage storage efficiently, addressing a major limitation of Apple's automatic removal system.
6. Starting Playback Without Waiting for Download to be Complete
The custom solution supports progressive playback, allowing users to start watching content within seconds, even before the entire asset is downloaded. This approach significantly improves the viewing experience, particularly for long-form or episodic content. This feature has not yet been enabled for the customer though.
Implementation Success: Side-by-Side Comparison
Testing showed a clear improvement between Apple’s approach and this custom downloader. A video comparison demonstrates the difference in time-to-download:
- Before (Apple Implementation): A full movie like Oppenheimer required roughly 45 minutes to download due to slower speeds and frequent retries.
- After (Custom Implementation): The same movie now downloads in under 5 minutes, thanks to enhanced download speed, reduced retries, and prioritized order.
The tests showed the new downloader offers greater reliability and consistency, with minimal retries and smoother progress tracking for users.
Benefits of the Custom Offline Download Solution
The custom downloader brings several key advantages over Apple’s solution:
- Faster, Reliable Downloads: By using full network speed and reducing retries, download times are cut dramatically.
- Predictable Download Order: Assets are downloaded in the precise order users select, ensuring a consistent user experience.
- Enhanced Resilience: Resilient error handling allows downloads to resume from where they left off, even after network or app interruptions.
- Potential for Improved Quality: The flexibility of our custom downloader will allow us to enhance video quality in the future, giving users higher resolution and bitrate options for a better viewing experience offline.
For SVOD apps dealing with unique segment configurations and demanding offline requirements, building a custom solution on iPhone and iPad can make a substantial difference in user experience and platform efficiency. The downloader ensures faster, reliable downloads, smoother progress tracking, and reduced retries—addressing both user frustration and platform costs.
Broader Applications of The Technology
- Digital Signage: Pre-cached playback for connectivity-limited venues.
- Dynamic Ad Insertion: Personalized ad replacements via local manifests.
- Edge Caching: Ideal for low-latency hybrid offline/online streaming
This custom solution demonstrates how targeted development can better meet the specific needs of SVOD content, providing a seamless offline experience and the flexibility to adapt to future quality improvements. By focusing on speed, reliability, and user-centered priorities, the solution enhances satisfaction and establishes a strong foundation for future updates in the evolving streaming landscape.