2022-10-19 03:43:53 -05:00
|
|
|
import { VideoStreamingPlaylistType } from '@shared/models'
|
2021-11-12 07:19:56 -06:00
|
|
|
import { VideoPrivacy } from '../../models/videos/video-privacy.enum'
|
2022-10-19 03:43:53 -05:00
|
|
|
import { VideoDetails } from '../../models/videos/video.model'
|
2021-11-12 07:19:56 -06:00
|
|
|
|
|
|
|
function getAllPrivacies () {
|
2023-06-29 02:48:55 -05:00
|
|
|
return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED, VideoPrivacy.PASSWORD_PROTECTED ]
|
2021-11-12 07:19:56 -06:00
|
|
|
}
|
|
|
|
|
2022-09-13 05:00:13 -05:00
|
|
|
function getAllFiles (video: Partial<Pick<VideoDetails, 'files' | 'streamingPlaylists'>>) {
|
|
|
|
const files = video.files
|
|
|
|
|
2022-10-19 03:43:53 -05:00
|
|
|
const hls = getHLS(video)
|
|
|
|
if (hls) return files.concat(hls.files)
|
2022-09-13 05:00:13 -05:00
|
|
|
|
|
|
|
return files
|
|
|
|
}
|
|
|
|
|
2022-10-19 03:43:53 -05:00
|
|
|
function getHLS (video: Partial<Pick<VideoDetails, 'streamingPlaylists'>>) {
|
|
|
|
return video.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
|
|
|
|
}
|
|
|
|
|
2021-11-12 07:19:56 -06:00
|
|
|
export {
|
2022-09-13 05:00:13 -05:00
|
|
|
getAllPrivacies,
|
2022-10-19 03:43:53 -05:00
|
|
|
getAllFiles,
|
|
|
|
getHLS
|
2021-11-12 07:19:56 -06:00
|
|
|
}
|