1 Reply
      Latest reply on May 21, 2020 4:32 PM by AppWriter
      AppWriter Level 1 Level 1 (0 points)

        I'm able to download an HLS video using this:

         

        https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/HTTPLiveStreaming/HTTPLiveStreaming.html

         

        When I change to airplane mode, and play back the video, it works if I use the samples provided by the HLSCatalog sample app.  They are:

         

        https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8

        https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8

         

        Both of those manifest files point to segments that are stored in a path relative to manifest file.  For example, the 1st one is....

         

        #EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=232370,CODECS="mp4a.40.2, avc1.4d4015" gear1/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=649879,CODECS="mp4a.40.2, avc1.4d401e" gear2/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=991714,CODECS="mp4a.40.2, avc1.4d401e" gear3/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1927833,CODECS="mp4a.40.2, avc1.4d401f" gear4/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=41457,CODECS="mp4a.40.2" gear0/prog_index.m3u8

         

        and you can see it referencing other manifest files on the same server using a local path, such as:  "gear3/prog_index.m3u8"

         

         

        My problem is that the manifest files for my company have remote and different server URLs for all the files referenced in it.  For example, my manfest might be:   http://myremoteserver.com/myManifest.m3u8

        and it it, it'll reference files at:   http://myvideoserver.com/video.m3u8

         

        As a result, my videos do download, but they do NOT play when I change to airplane mode.

         

        Any help would be appreciated.   Thanks!

        • Re: AVAssetDownloadTask and playback, m3u8 has remote URLs
          AppWriter Level 1 Level 1 (0 points)

          A little more information....I downloaded the container from my app on to my computer and looked inside.   In the m3u8 file that's saved into the movpkg bundle, the segments are always preceeded by a key, like this:

           

          #EXT-X-KEY:METHOD=AES-128,URI="https://myKeyURL.com/keypath",IV=0x00000000000000000000000000000000

          #EXTINF:4.0960,

          https://mySegmentURL.com/slices/segment1.ts

           

           

          Also... the "frag" files from apple's sample app... if I change the extension to ".ts", they play fine in QuickTime.  But the frag files from my video do not.  So my current theory is that when in airplane mode, it's trying to reach the key at the remote server to decrypt the segment, and of course it's unreachable when offline.

           

          Any ideas?