aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-04 10:03:17 +0200
committerChocobozzz <me@florianbigard.com>2022-10-04 10:03:17 +0200
commitcfd57d2ca0bb058087f7dc90fcc3e8442b0288e1 (patch)
treedc899a1504ecac588e5580553e02571e0f5d7e4b /server/models
parent9c0cdc5047918b959ebd5e075ddad81eb7fb93f0 (diff)
downloadPeerTube-cfd57d2ca0bb058087f7dc90fcc3e8442b0288e1.tar.gz
PeerTube-cfd57d2ca0bb058087f7dc90fcc3e8442b0288e1.tar.zst
PeerTube-cfd57d2ca0bb058087f7dc90fcc3e8442b0288e1.zip
Live supports object storage
* Sync live files (segments, master playlist, resolution playlist, segment sha file) into object storage * Automatically delete them when the live ends * Segment sha file is now a file on disk, and not stored in memory anymore
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-streaming-playlist.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts
index f587989dc..2b6771f27 100644
--- a/server/models/video/video-streaming-playlist.ts
+++ b/server/models/video/video-streaming-playlist.ts
@@ -245,21 +245,25 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
245 } 245 }
246 246
247 getMasterPlaylistUrl (video: MVideo) { 247 getMasterPlaylistUrl (video: MVideo) {
248 if (this.storage === VideoStorage.OBJECT_STORAGE) { 248 if (video.isOwned()) {
249 return getHLSPublicFileUrl(this.playlistUrl) 249 if (this.storage === VideoStorage.OBJECT_STORAGE) {
250 } 250 return getHLSPublicFileUrl(this.playlistUrl)
251 }
251 252
252 if (video.isOwned()) return WEBSERVER.URL + this.getMasterPlaylistStaticPath(video.uuid) 253 return WEBSERVER.URL + this.getMasterPlaylistStaticPath(video.uuid)
254 }
253 255
254 return this.playlistUrl 256 return this.playlistUrl
255 } 257 }
256 258
257 getSha256SegmentsUrl (video: MVideo) { 259 getSha256SegmentsUrl (video: MVideo) {
258 if (this.storage === VideoStorage.OBJECT_STORAGE) { 260 if (video.isOwned()) {
259 return getHLSPublicFileUrl(this.segmentsSha256Url) 261 if (this.storage === VideoStorage.OBJECT_STORAGE) {
260 } 262 return getHLSPublicFileUrl(this.segmentsSha256Url)
263 }
261 264
262 if (video.isOwned()) return WEBSERVER.URL + this.getSha256SegmentsStaticPath(video.uuid, video.isLive) 265 return WEBSERVER.URL + this.getSha256SegmentsStaticPath(video.uuid)
266 }
263 267
264 return this.segmentsSha256Url 268 return this.segmentsSha256Url
265 } 269 }
@@ -287,9 +291,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi
287 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.playlistFilename) 291 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.playlistFilename)
288 } 292 }
289 293
290 private getSha256SegmentsStaticPath (videoUUID: string, isLive: boolean) { 294 private getSha256SegmentsStaticPath (videoUUID: string) {
291 if (isLive) return join('/live', 'segments-sha256', videoUUID)
292
293 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.segmentsSha256Filename) 295 return join(STATIC_PATHS.STREAMING_PLAYLISTS.HLS, videoUUID, this.segmentsSha256Filename)
294 } 296 }
295} 297}