From c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 17 Sep 2020 09:20:52 +0200 Subject: Live streaming implementation first step --- server/controllers/live.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 server/controllers/live.ts (limited to 'server/controllers/live.ts') diff --git a/server/controllers/live.ts b/server/controllers/live.ts new file mode 100644 index 000000000..fa4c2cc1a --- /dev/null +++ b/server/controllers/live.ts @@ -0,0 +1,29 @@ +import * as express from 'express' +import { mapToJSON } from '@server/helpers/core-utils' +import { LiveManager } from '@server/lib/live-manager' + +const liveRouter = express.Router() + +liveRouter.use('/segments-sha256/:videoUUID', + getSegmentsSha256 +) + +// --------------------------------------------------------------------------- + +export { + liveRouter +} + +// --------------------------------------------------------------------------- + +function getSegmentsSha256 (req: express.Request, res: express.Response) { + const videoUUID = req.params.videoUUID + + const result = LiveManager.Instance.getSegmentsSha256(videoUUID) + + if (!result) { + return res.sendStatus(404) + } + + return res.json(mapToJSON(result)) +} -- cgit v1.2.3