2
1

video-urls.ts 1003 B

123456789101112131415161718192021222324252627282930
  1. import { STATIC_PATHS, WEBSERVER } from '@server/initializers/constants.js'
  2. import { MStreamingPlaylist, MVideo, MVideoFile, MVideoUUID } from '@server/types/models/index.js'
  3. // ################## Redundancy ##################
  4. function generateHLSRedundancyUrl (video: MVideo, playlist: MStreamingPlaylist) {
  5. // Base URL used by our HLS player
  6. return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid
  7. }
  8. function generateWebVideoRedundancyUrl (file: MVideoFile) {
  9. return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename
  10. }
  11. // ################## Meta data ##################
  12. function getLocalVideoFileMetadataUrl (video: MVideoUUID, videoFile: MVideoFile) {
  13. const path = '/api/v1/videos/'
  14. return WEBSERVER.URL + path + video.uuid + '/metadata/' + videoFile.id
  15. }
  16. // ---------------------------------------------------------------------------
  17. export {
  18. getLocalVideoFileMetadataUrl,
  19. generateWebVideoRedundancyUrl,
  20. generateHLSRedundancyUrl
  21. }