still fixing video streaming, issue with canceled request

This commit is contained in:
subnub
2020-05-11 00:20:06 -04:00
parent f6649f5c2b
commit 985ef2dfc3
5 changed files with 23 additions and 11 deletions
@@ -193,7 +193,7 @@ class FileSystemService implements ChunkInterface {
console.log("Full thumbnail sent");
}
streamVideo = async(user: UserInterface, fileID: string, headers: any, res: Response) => {
streamVideo = async(user: UserInterface, fileID: string, headers: any, res: Response, req: Request) => {
const userID = user._id;
const currentFile: FileInterface = await dbUtilsFile.getFileInfo(fileID, userID);
@@ -256,6 +256,12 @@ class FileSystemService implements ChunkInterface {
readStream.pipe(decipher);
req.on("close", () => {
console.log("Destroying read stream");
readStream.destroy();
console.log("Read Stream Destoryed");
})
await awaitStreamVideo(start, end, differenceStart, decipher, res, allStreamsToErrorCatch);
}