0 Replies
      Latest reply on Jan 9, 2020 3:10 AM by vdiamant
      vdiamant Level 1 Level 1 (0 points)

        Hello, I have some Videos that I can play with AVPlayer but I can't Download and Play offline from my device.

        When I download the asset and play the asset one time then I can play offline the asset as it would have been downloaded.

        I use the code from apple's recommended project https://developer.apple.com/documentation/avfoundation/media_assets_playback_and_editing/using_avfoundation_to_play_and_persist_http_live_streams
        By replacing in apples project the link with my own link I experience the same result. Also in my project the other .m3u8 video that I am trying to download work fine.
        The main difference is that in my link URL Signing is being used.

        Also in apples project the video can be played but not downloaded and play.

        Example Link to test my download is:
        https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4

        The video does not have any encryption so that's not the issue, but it might be downloading over HTTPS.

        When I download the Container From Devices for my app I see that I have downloaded the myVideo.movpkg file and inside that Folder I have the root.xml file, the Data folder, the boot.xml file, and only 2 folders with fragment data (In some videos only 1 folder).

        When I play the downloaded video with Internet connection more folders with fragments are being downloaded. And if I download all the fragment folders then the video can be played offline normally.

        root.xml file

        <?xml version="1.0" encoding="UTF-8"?>
        <MoviePackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://apple.com/IMG/Schemas/MoviePackage" xsi:schemaLocation="http://apple.com/IMG/Schemas/MoviePackage /System/Library/Schemas/MoviePackage.xsd">
          <Version>1.0</Version>
          <MoviePackageType>HLS</MoviePackageType>
          <BootImage>boot.xml</BootImage>
        </MoviePackage>
        
        
        


        boot.xml file

        <?xml version="1.0" encoding="UTF-8"?>
        <HLSMoviePackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://apple.com/IMG/Schemas/HLSMoviePackage" xsi:schemaLocation="http://apple.com/IMG/Schemas/HLSMoviePackage /System/Library/Schemas/HLSMoviePackage.xsd">
          <Version>1.0</Version>
          <HLSMoviePackageType>PersistedStore</HLSMoviePackageType>
          <Streams><Stream ID="0-ROFVRWFPBCMNXKILE7FOE4O3PNGGD2HZ-454000" Path="0-ROFVRWFPBCMNXKILE7FOE4O3PNGGD2HZ-454000" NetworkURL="https://gr-ampelokipoi-prod-cache01.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4"><Complete>YES</Complete></Stream><Stream ID="0-IZ4BCCN2TMQXA2S47ILRQOD5IPNLNK5R-454000" Path="0-IZ4BCCN2TMQXA2S47ILRQOD5IPNLNK5R-454000" NetworkURL="https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4"><Complete>NO</Complete></Stream></Streams>
        <MasterPlaylist><NetworkURL>https://tr.vod.cdn.cosmotetvott.gr/v1/524/16/403201605073/403201605073.ism/.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4</NetworkURL></MasterPlaylist><DataItems Directory="Data"><DataItem><ID>65E586E6-53C7-4750-A5B7-55416C783867</ID><Category>Playlist</Category><Name>master.m3u8</Name><DataPath>Playlist-master.m3u8-65E586E6-53C7-4750-A5B7-55416C783867.data</DataPath><Role>Master</Role></DataItem></DataItems></HLSMoviePackage>
        


        Inside Data folder Playlist-master.m3u8-65...67.data file

        #EXTM3U
        #EXT-X-VERSION:1
        ## Created with Unified Streaming Platform (version=1.10.12-18737)
        
        
        # variants
        #EXT-X-STREAM-INF:BANDWIDTH=454000,CODECS="mp4a.40.2,avc1.77.30",RESOLUTION=424x240,FRAME-RATE=25
        403201605073-audio_eng=128000-video=300000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        #EXT-X-STREAM-INF:BANDWIDTH=878000,CODECS="mp4a.40.2,avc1.77.30",RESOLUTION=640x360,FRAME-RATE=25
        403201605073-audio_eng=128000-video=700000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        #EXT-X-STREAM-INF:BANDWIDTH=1726000,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1024x576,FRAME-RATE=25
        403201605073-audio_eng=128000-video=1500000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        #EXT-X-STREAM-INF:BANDWIDTH=3952000,CODECS="mp4a.40.2,avc1.77.31",RESOLUTION=1280x720,FRAME-RATE=25
        403201605073-audio_eng=128000-video=3600000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        #EXT-X-STREAM-INF:BANDWIDTH=7026000,CODECS="mp4a.40.2,avc1.77.40",RESOLUTION=1920x1080,FRAME-RATE=25
        403201605073-audio_eng=128000-video=6500000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        
        
        # variants
        #EXT-X-STREAM-INF:BANDWIDTH=136000,CODECS="mp4a.40.2"
        403201605073-audio_eng=128000.m3u8?hdnts=st=1578561097~exp=1578604327~acl=*~id=3497d811-9d5d-4f6e-9727-e08e759b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4
        b3eec~hmac=014af872b1c5455e3369c2a6005a3346e74a7da4



        My question is what's wrong, is it a client issue or something must change from back-end?