I`m trying to download AVAsset using AVAssetDownloadURLSession and AVAssetDownloadTask.
So, I used a sample code from Guideand Sample resource.
When I try to download a sample resource above, it works very well.
But when I try to download a resource from my local web server does not.
After some investigations, I knew that I have to set App Transport Security Settings property in Info.plist file include Exception Domains, NSExceptionAllowsInsecureHTTPLoads and NSIncludesSubdomains property for my local web server and I did.
Also, I edit hosts file in my mac like this '127.0.0.1 my.local.com' to let my iPhone demo app can connect to my local web server using domain in same local network.
After all setting in position, I set proxy information(local ip and port of my mac) in my iPhone from setting app and connect to the Wi-Fi that my mac connected.
Finally, I hit the download button in my demo app, but it still not work.
I think source code of my demo app is ok because sample resource downloading works fine,
so I guess my local web server setting is invalid but I don`t have any clue at all.
Below is error.
Error Domain=AVFoundationErrorDomain Code=-11853 "Playlist not received" UserInfo={NSDebugDescription=Playlist not received, NSLocalizedDescription=Cannot Parse, NSLocalizedFailureReason=This data is damaged, incomplete, or incompatible.}
Below is the request / response header from my local web server.
--------------------------------------------------------------------------------
192.168.2.5 - - [28/Jun/2017 09:07:34]
"GET http://my.flask.com:9999/download/HLS_sample_normal/prog_index.m3u8 HTTP/1.1" 200 -
User-Agent: AppleCoreMedia/1.0.0.14D27 (iPhone; U; CPU OS 10_2_1 like Mac OS X; ko_kr)
Connection: keep-alive
Host: my.flask.com:9999
Accept: */
Proxy-Connection: keep-alive
Accept-Language: ko-kr
X-Playback-Session-Id: 85AD5FBA-DA66-47D5-A6A4-E6956751C2B0
Accept-Encoding: gzip
--------------------------------------------------------------------------------
Content-Disposition: attachment; filename=prog_index.m3u8
Content-Length: 9254
Content-Type: application/x-mpegURL
Last-Modified: Wed, 28 Jun 2017 09:08:49 GMT
Cache-Control: public, max-age=100
Expires: Wed, 28 Jun 2017 00:10:29 GMT
ETag: "1498536228.0-9254-3656787697"
Date: Wed, 28 Jun 2017 00:08:49 GMT
Accept-Ranges: bytes
Any suggestions?