2

As soon as EXT-X-ALLOW-CACHE deprecated and removed from protocol specification is there alternative way to setup caching policy for a stream? (my goal is to enable caching on client)

Also I want to get rid of error while validating stream with mediastreamvalidator:

MUST fix issues
--------------------------------------------------------------
Error: #EXT-X-ALLOW-CACHE has been deprecated
--> Detail:  Line: #EXT-X-ALLOW-CACHE:NO
Community
  • 1
  • 1
Ilia
  • 1,434
  • 15
  • 22

2 Answers2

2

You can use AVFoundation on iOS 10+:

Playing Offline HLS Content

Starting with iOS 10, you can use AVFoundation to download HTTP Live Streaming assets to an iOS device. This new capability allows users to download and store HLS movies on their devices while they have access to a fast, reliable network, and watch them later without a network connection. With the introduction of this capability, HLS becomes even more versatile by minimizing the impact of inconsistent network availability on the user experience

Source: Working with HTTP Live Streaming

Community
  • 1
  • 1
aergistal
  • 29,947
  • 5
  • 70
  • 92
  • 2
    Not exactly what needed. With approach you propose an asset will be available only after completely downloaded. Which is not the same as caching. I need to cache segments that has been downloaded during playback + forward buffer not more. – Ilia Aug 08 '17 at 05:34
  • 2
    @ilya I think the reason they removed it is because you can just set the `HTTP` caching headers. In any case it's the client that ultimately decides if and what to cache, the server can't force it. – aergistal Aug 08 '17 at 07:39
  • @ilya quoting the linked page: "When a user is concurrently downloading and playing an asset, it’s possible that some portion of the video will be played at a lower quality than was specified in the download task’s configuration. This can happen if network bandwidth constraints prevent streaming at the quality requested for download...(later)..Whenever possible, reuse the same asset instance for playback as was used to configure the download task." So doing both seems possible. – akaralar Nov 23 '17 at 02:37
0

Old question, but perhaps will help someone:

The only thing that seems to work for HLS caching is running your own caching reverse-proxy within your app. Madness, but it really works well.

This proxy HLSCachingReverseProxyServer from devxoul as mentioned in this comment is a great drop in option, and starting point for optimising caching for your needs.

It's absurd that we need to do this to make Apple's component respect something as basic as eTags.

alex bird
  • 134
  • 4