aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-17 09:20:52 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc6c0fa6cd8fe8f752463d8982c3dbcd448739c4e (patch)
tree79304b0152b0a38d33b26e65d4acdad0da4032a7 /server/controllers/live.ts
parent110d463fece85e87a26aca48a6048ae0017a27b3 (diff)
downloadPeerTube-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.ts29
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 @@
1import * as express from 'express'
2import { mapToJSON } from '@server/helpers/core-utils'
3import { LiveManager } from '@server/lib/live-manager'
4
5const liveRouter = express.Router()
6
7liveRouter.use('/segments-sha256/:videoUUID',
8 getSegmentsSha256
9)
10
11// ---------------------------------------------------------------------------
12
13export {
14 liveRouter
15}
16
17// ---------------------------------------------------------------------------
18
19function 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}