]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - shared/core-utils/videos/common.ts
Translated using Weblate (Japanese)
[github/Chocobozzz/PeerTube.git] / shared / core-utils / videos / common.ts
... / ...
CommitLineData
1import { VideoStreamingPlaylistType } from '@shared/models'
2import { VideoPrivacy } from '../../models/videos/video-privacy.enum'
3import { VideoDetails } from '../../models/videos/video.model'
4
5function getAllPrivacies () {
6 return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED ]
7}
8
9function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) {
10 const files = video.files
11
12 const hls = getHLS(video)
13 if (hls) return files.concat(hls.files)
14
15 return files
16}
17
18function getHLS (video: Partial<Pick<VideoDetails, 'streamingPlaylists'>>) {
19 return video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
20}
21
22export {
23 getAllPrivacies,
24 getAllFiles,
25 getHLS
26}