]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/lib/video-urls.ts
Translated using Weblate (Spanish)
[github/Chocobozzz/PeerTube.git] / server / lib / video-urls.ts
1
2 import { STATIC_PATHS, WEBSERVER } from '@server/initializers/constants'
3 import { MStreamingPlaylist, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'
4
5 // ################## Redundancy ##################
6
7 function generateHLSRedundancyUrl (video: MVideo, playlist: MStreamingPlaylist) {
8 // Base URL used by our HLS player
9 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + playlist.getStringType() + '/' + video.uuid
10 }
11
12 function generateWebTorrentRedundancyUrl (file: MVideoFile) {
13 return WEBSERVER.URL + STATIC_PATHS.REDUNDANCY + file.filename
14 }
15
16 // ################## Meta data ##################
17
18 function getLocalVideoFileMetadataUrl (video: MVideoUUID, videoFile: MVideoFile) {
19 const path = '/api/v1/videos/'
20
21 return WEBSERVER.URL + path + video.uuid + '/metadata/' + videoFile.id
22 }
23
24 // ---------------------------------------------------------------------------
25
26 export {
27 getLocalVideoFileMetadataUrl,
28
29 generateWebTorrentRedundancyUrl,
30 generateHLSRedundancyUrl
31 }