Created
October 2, 2020 17:44
-
-
Save zonble/bc79b47086bc05a6425e56fc71f52707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let begin = request.hasByteRaange ? request.byteRange.lowerBound : 0 | |
let end = request.hasByteRaange ? request.byteRange.higherBound : clipFileSize | |
var readHead = begin | |
let response = GCDWebServerStreamedResponse(contentType: "video/mp4", asyncStreamBlock: { block in | |
if readHead < end { | |
let data = getData(readHead, chunkSize) | |
block(data, nil) | |
readHead += data.count | |
} else { | |
block(nil, nil) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment