0

I am developing an app which extracts the contents of a remote URL to memory then attempts to serve it from my app's http server, using Kitura. If I write the data to a file before loading to AVQueuePlayer it plays just fine; but if I add the data variable to my http body and serve it, AVQueuePlayer only sends a single request with a range of Bytes=0-1.

Any attempts to override this range request with a range that corresponds to the complete data or part of the data has no effect.

Here is my handler for serving this data:

  func serveIt(path:String, trackData:Data){
        httpServer.router.all(path) { [unowned self] request, response, next in
           let responseHeaders = response.headers
           let headers = request.headers
           let url  = request.urlURL
           let range = headers["range"]
           response.headers["Accept-Ranges"] = "Bytes"
           response.headers["Cache-Control"] = "no-store"
           response.send(data:trackData)
           next()
       }
    }

Note: The range constant is there to allow me to inspect which range I receive in the request.

Kaushik Makwana
  • 142
  • 1
  • 14

0 Answers0