ios - Is it possible to cache HLS segments with AVPlayer? -



ios - Is it possible to cache HLS segments with AVPlayer? -

root problem​

our video buffers lot when seeking in ios. buffers quite bit more our web player saves copies of watched segments in temp storage.

​desired solution​

caching video segments locally on device's disk. we're fine caching single quality , replaying it.

​blocker​

we can't find way perform caching within avfoundation/avplayer.

what we've tried

2 ways intercept networking requests avplayer.

conforming ​avassetresourceloaderdelegate ​and handling loading of media manually

doesn't work hls. can load m3u8 files implementing avassetresourceloaderdelegate​, allows pass authentication or decrypt response, .ts files can't loaded. here's code tried: https://gist.github.com/nathanhillyer/84e46152d7c4c88183b6

implementing nsurlprotocol ​to capture requests .ts files.

avurlasset avoids beingness intercepted. somehow network requests don't captured. (no clue why)

actually, can avplayer play video network if want to cache downloaded info play locally, avplayer seems impossible now.

fortunately, there great api resourceloader object in avurlasset, can provide controlled access remote sound file avplayer. works local http proxy without hassles.

you can find more detail on https://gist.github.com/anonymous/83a93746d1ea52e9d23f

ios video-streaming avfoundation avplayer http-live-streaming

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -