title: m3u8 not playing offline - swift 3.0
body: <p>I am trying to stream an m3u8 url and save offline.
  Then play from offline.
  I am using  <a href="https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/HTTPLiveStreaming/HTTPLiveStreaming.html" rel="nofollow noreferrer">Apple HTTP Live Streaming</a> </p>
  
  <p>Start Download by using the below code</p>
  
  <pre><code>func setupAssetDownload() {
          // Create new background session configuration.
           configuration = URLSessionConfiguration.background(withIdentifier: DOWNLOAD_ID)
  
          // Create a new AVAssetDownloadURLSession with background configuration, delegate, and queue
           downloadSession = AVAssetDownloadURLSession(configuration: configuration,
                                                      assetDownloadDelegate: self,
                                                      delegateQueue: OperationQueue.main)
          let url = URL(string: urlString)
          let asset = AVURLAsset(url: url!)
  
  
          // Create new AVAssetDownloadTask for the desired asset
          let downloadTask = downloadSession.makeAssetDownloadTask(asset: asset, assetTitle: "asset_Title", assetArtworkData: nil, options: nil)
          // Start task and begin download
          downloadTask?.resume()
  
      }
  </code></pre>
  
  <p>Where,</p>
  
  <pre><code>let DOWNLOAD_ID = "downloadIdentifier"
  
  let urlString = "http://domain/vod/mp4:sample1.mp4/playlist.m3u8"
  
  // Saving the Download Location
  
      func urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didFinishDownloadingTo location: URL) {
  
  
          print("didFinishDownloadingTo \(location.relativePath)")
          // Do not move the asset from the download location
          UserDefaults.standard.set(location.relativePath, forKey: "assetPath")
      }
  </code></pre>
  
  <p>When try to play Offline,
  I can get the AVURLAsset,</p>
  
  <pre><code>&lt;AVURLAsset: 0x1742319e0, URL = file:///var/mobile/Containers/Data/Application/79C0043F-6161-4231-9129-B71C95903E05/Library/com.apple.UserManagedAssets.bhVNRN/asset_Title_63128673BE57FBDD.movpkg/&gt;
  </code></pre>
  
  <p>But, not paying from the asset.</p>
  
  <pre><code>func playOfflineAsset() {
          guard let assetPath = UserDefaults.standard.value(forKey: "assetPath") as? String else {
              // Present Error: No offline version of this asset available
              return
          }
          let baseURL = URL(fileURLWithPath: NSHomeDirectory())
          let assetURL = baseURL.appendingPathComponent(assetPath)
          let asset = AVURLAsset(url: assetURL)
  
  
          let player = AVPlayer(url:assetURL)
  
          let playerLayer = AVPlayerLayer(player: player)
          playerLayer.frame = videoView2.bounds
          playerLayer.backgroundColor = UIColor.purple.cgColor
          videoView2.layer.addSublayer(playerLayer)
  
          player.play()
  
  
          if let cache = asset.assetCache, cache.isPlayableOffline {
              // Set up player item and player and begin playback
  
              print("exist")
  
          } else {
              // Present Error: No playable version of this asset exists offline
              print("doesn't exist")
          }
      }
  </code></pre>