aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/videos/studio/video-studio-create-edit.model.ts
blob: 5e8296dc9f461fc94263f5921abf8089b7554cb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
export interface VideoStudioCreateEdition {
  tasks: VideoStudioTask[]
}

export type VideoStudioTask =
  VideoStudioTaskCut |
  VideoStudioTaskIntro |
  VideoStudioTaskOutro |
  VideoStudioTaskWatermark

export interface VideoStudioTaskCut {
  name: 'cut'

  options: {
    start?: number
    end?: number
  }
}

export interface VideoStudioTaskIntro {
  name: 'add-intro'

  options: {
    file: Blob | string
  }
}

export interface VideoStudioTaskOutro {
  name: 'add-outro'

  options: {
    file: Blob | string
  }
}

export interface VideoStudioTaskWatermark {
  name: 'add-watermark'

  options: {
    file: Blob | string
  }
}

// ---------------------------------------------------------------------------

export function isVideoStudioTaskIntro (v: VideoStudioTask): v is VideoStudioTaskIntro {
  return v.name === 'add-intro'
}

export function isVideoStudioTaskOutro (v: VideoStudioTask): v is VideoStudioTaskOutro {
  return v.name === 'add-outro'
}

export function isVideoStudioTaskWatermark (v: VideoStudioTask): v is VideoStudioTaskWatermark {
  return v.name === 'add-watermark'
}

export function hasVideoStudioTaskFile (v: VideoStudioTask): v is VideoStudioTaskIntro | VideoStudioTaskOutro | VideoStudioTaskWatermark {
  return isVideoStudioTaskIntro(v) || isVideoStudioTaskOutro(v) || isVideoStudioTaskWatermark(v)
}