video-streaming-playlist.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
  2. import { PickWith, PickWithOpt } from '../../utils'
  3. import { MVideoRedundancyFileUrl } from './video-redundancy'
  4. import { MVideo } from './video'
  5. import { MVideoFile } from './video-file'
  6. type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
  7. // ############################################################################
  8. export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
  9. export type MStreamingPlaylistFiles = MStreamingPlaylist &
  10. Use<'VideoFiles', MVideoFile[]>
  11. export type MStreamingPlaylistVideo = MStreamingPlaylist &
  12. Use<'Video', MVideo>
  13. export type MStreamingPlaylistFilesVideo = MStreamingPlaylist &
  14. Use<'VideoFiles', MVideoFile[]> &
  15. Use<'Video', MVideo>
  16. export type MStreamingPlaylistRedundancies = MStreamingPlaylist &
  17. Use<'VideoFiles', MVideoFile[]> &
  18. Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
  19. export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist &
  20. Use<'VideoFiles', MVideoFile[]> &
  21. PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
  22. export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
  23. return !!(value as MStreamingPlaylist).playlistUrl
  24. }