Skip to content

Instantly share code, notes, and snippets.

@zonble
Created October 2, 2020 17:43
Show Gist options
  • Save zonble/529bca870b3870762924a1643c40b91a to your computer and use it in GitHub Desktop.
Save zonble/529bca870b3870762924a1643c40b91a to your computer and use it in GitHub Desktop.
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in
 let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0
 let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize
 var readHead = begin
 while readHead < end {
 let data = getData(readHead, chunkSize)
 block(data, nil)
 readHead += data.count
 }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment