diff options
author | Chocobozzz <me@florianbigard.com> | 2020-09-17 09:20:52 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch) | |
tree | 79304b0152b0a38d33b26e65d4acdad0da4032a7 /server/controllers/live.ts | |
parent | 110d463fece85e87a26aca48a6048ae0017a27b3 (diff) | |
download | PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.gz PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.tar.zst PeerTube-c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e.zip |
Live streaming implementation first step
Diffstat (limited to 'server/controllers/live.ts')
-rw-r--r-- | server/controllers/live.ts | 29 |
1 files changed, 29 insertions, 0 deletions
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 @@ | |||
1 | import * as express from 'express' | ||
2 | import { mapToJSON } from '@server/helpers/core-utils' | ||
3 | import { LiveManager } from '@server/lib/live-manager' | ||
4 | |||
5 | const liveRouter = express.Router() | ||
6 | |||
7 | liveRouter.use('/segments-sha256/:videoUUID', | ||
8 | getSegmentsSha256 | ||
9 | ) | ||
10 | |||
11 | // --------------------------------------------------------------------------- | ||
12 | |||
13 | export { | ||
14 | liveRouter | ||
15 | } | ||
16 | |||
17 | // --------------------------------------------------------------------------- | ||
18 | |||
19 | function getSegmentsSha256 (req: express.Request, res: express.Response) { | ||
20 | const videoUUID = req.params.videoUUID | ||
21 | |||
22 | const result = LiveManager.Instance.getSegmentsSha256(videoUUID) | ||
23 | |||
24 | if (!result) { | ||
25 | return res.sendStatus(404) | ||
26 | } | ||
27 | |||
28 | return res.json(mapToJSON(result)) | ||
29 | } | ||