aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils/videos/privacy.ts
blob: f33487b490c5363a2a928231becfaa8f8f911ff0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { VideoDetails } from '../../models/videos/video.model'
import { VideoPrivacy } from '../../models/videos/video-privacy.enum'

function getAllPrivacies () {
  return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED ]
}

function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) {
  const files = video.files

  if (video.streamingPlaylists[0]) {
    return files.concat(video.streamingPlaylists[0].files)
  }

  return files
}

export {
  getAllPrivacies,
  getAllFiles
}