aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/videos/live-command.ts48
1 files changed, 47 insertions, 1 deletions
diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts
index c24c7a5fc..2ff65881b 100644
--- a/shared/server-commands/videos/live-command.ts
+++ b/shared/server-commands/videos/live-command.ts
@@ -4,7 +4,17 @@ import { readdir } from 'fs-extra'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { join } from 'path' 5import { join } from 'path'
6import { wait } from '@shared/core-utils' 6import { wait } from '@shared/core-utils'
7import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' 7import {
8 HttpStatusCode,
9 LiveVideo,
10 LiveVideoCreate,
11 LiveVideoSession,
12 LiveVideoUpdate,
13 ResultList,
14 VideoCreateResult,
15 VideoDetails,
16 VideoState
17} from '@shared/models'
8import { unwrapBody } from '../requests' 18import { unwrapBody } from '../requests'
9import { AbstractCommand, OverrideCommandOptions } from '../shared' 19import { AbstractCommand, OverrideCommandOptions } from '../shared'
10import { sendRTMPStream, testFfmpegStreamError } from './live' 20import { sendRTMPStream, testFfmpegStreamError } from './live'
@@ -25,6 +35,42 @@ export class LiveCommand extends AbstractCommand {
25 }) 35 })
26 } 36 }
27 37
38 listSessions (options: OverrideCommandOptions & {
39 videoId: number | string
40 }) {
41 const path = `/api/v1/videos/live/${options.videoId}/sessions`
42
43 return this.getRequestBody<ResultList<LiveVideoSession>>({
44 ...options,
45
46 path,
47 implicitToken: true,
48 defaultExpectedStatus: HttpStatusCode.OK_200
49 })
50 }
51
52 async findLatestSession (options: OverrideCommandOptions & {
53 videoId: number | string
54 }) {
55 const { data: sessions } = await this.listSessions(options)
56
57 return sessions[sessions.length - 1]
58 }
59
60 getReplaySession (options: OverrideCommandOptions & {
61 videoId: number | string
62 }) {
63 const path = `/api/v1/videos/${options.videoId}/live-session`
64
65 return this.getRequestBody<LiveVideoSession>({
66 ...options,
67
68 path,
69 implicitToken: true,
70 defaultExpectedStatus: HttpStatusCode.OK_200
71 })
72 }
73
28 update (options: OverrideCommandOptions & { 74 update (options: OverrideCommandOptions & {
29 videoId: number | string 75 videoId: number | string
30 fields: LiveVideoUpdate 76 fields: LiveVideoUpdate