Download HLS content not start

I followed the Media Playback Programming Guide from Apple to download HLS content. The following implementation usually works fine, but, occasionally, and with no apparent reason, just stop working. Delegate methods won't report anything, neither download progress, nor error. Download just refuse to start. When this happens, in order to start download again, the only way is rebooting the device. Is there anyone facing the same problem? Could someone point me on how to fix this?



    func setupAssetDownload() {
       
        // Create new background session configuration.
        let configuration = URLSessionConfiguration.background(withIdentifier: "Player")
        configuration.isDiscretionary = true
        configuration.timeoutIntervalForResource = 300
   
       
        // Create a new AVAssetDownloadURLSession with background configuration, delegate, and queue
        downloadSession = AVAssetDownloadURLSession(configuration: configuration,
                                                    assetDownloadDelegate: self,
                                                    delegateQueue: OperationQueue.main)
    }


Create and configure the download session:



    func assetDownload(for item: DownloadItem) {
       
        let asset = AVURLAsset(url: item.url)
       
        asset.resourceLoader.preloadsEligibleContentKeys = true
        asset.resourceLoader.setDelegate(self, queue: DispatchQueue.global(qos: .default))
   
   
        // Create new AVAssetDownloadTask for the desired asset
        guard let task = downloadSession.makeAssetDownloadTask(asset: asset,
                                                               assetTitle: item.title!,
                                                               assetArtworkData: data,
                                                               options: [AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: 2_787_000])
            else {
                status[item.url!] = .error
                return
        }
       
        task.taskDescription = item.title!
           
        // Start task and begin download
        task.resume()
    }