2 Replies
      Latest reply on Jul 1, 2019 7:48 AM by Robert_Developer
      Zycon Level 1 Level 1 (0 points)

        Hi,

         

        we implemented downloading vimeo hosted hls streams using AVAssetDownloadTask, but when attempting to play downloaded hls in airplane mode, sometimes it fails with NSURLErrorNotConnectedToInternet error. Usually downloaded videos work fine even when AVURLAsset is created from that filesystem *.movpkg url.

         

        Before playing we check assetCache.isPlayableOffline and it's true! There are no subtitles or audio tracks, anything in the streams. How is it possible that iOS tells me I can play this without connection and then it doesn't work.

         

        I checked AVPlayerItem's access and error logs and usually there are no error entries and access entries, but when there's an error entry it's for the master playlist url, but I see the playlist and stream downloaded when inspecting .movpkg directory and nothing suspicious in those xml.

         

        I'm kinda lost now and don't know how to further investigate issue. Thanks for any help!

        • Re: Downloaded HLS stream doesn't work offline
          jankase Level 1 Level 1 (0 points)

          Hello,

           

          I have same issue. I even check when I'm online that offline file is used (almost no network traffic visible in Profile in comparison with online content playback).

          Have you find the solution for this problem?

          • Re: Downloaded HLS stream doesn't work offline
            Robert_Developer Level 1 Level 1 (0 points)

            Hi guys,

             

            that's a problem mostly on iOS 10 or when using AVAssetDownloadTask. I recommend to drop support for iOS 10 and using AVAggregateAssetDownloadTask.

            Your issue is very likely caused by HLS stream manifest containing higher bitrate than 10MBit (or perhaps 8Mbit). In that case even if you have the stream downloaded for offline playback, the player tries to start with lower bitrate, but because you don't have it, playback cannot continue. If you connect network monitor tool, you will see that player will switch to lower bitreate and downloads first segment of lower bitrate video (for example only one 10 second segment) and then immediately switches to higher bitrate. This low bitrate segment gets stored in your local movpkg and next time when you start playback, it works offline without any problems.

            To fix this, you will have to either download highest bitrate and lowest bitrate (it can add a few percent of storage needed) or you need to limit high bitrate to be below 10Mbit. Or maybe it's just video being higher resolution than Full HD (1920x1080p) - don't rememebr precisely logic of the player.

            I hope this info helps.

            Regards.