aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-08 12:08:16 +0200
committerChocobozzz <me@florianbigard.com>2019-04-08 12:08:16 +0200
commit594d0c6a7c64b045c11508bb4e4b19b75b3fc557 (patch)
tree942e4a3715f7bc97a57fe3c04dc1dd160899de02
parent0e9c48c2edbb3871b0ca3ccd6718f2c99f9760b6 (diff)
downloadPeerTube-594d0c6a7c64b045c11508bb4e4b19b75b3fc557.tar.gz
PeerTube-594d0c6a7c64b045c11508bb4e4b19b75b3fc557.tar.zst
PeerTube-594d0c6a7c64b045c11508bb4e4b19b75b3fc557.zip
Fix HLS federation
-rw-r--r--server/lib/activitypub/videos.ts11
-rw-r--r--server/lib/hls.ts2
-rw-r--r--server/lib/video-transcoding.ts3
3 files changed, 13 insertions, 3 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 339f8e797..caff0621e 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -17,7 +17,15 @@ import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos
17import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' 17import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils'
18import { logger } from '../../helpers/logger' 18import { logger } from '../../helpers/logger'
19import { doRequest, downloadImage } from '../../helpers/requests' 19import { doRequest, downloadImage } from '../../helpers/requests'
20import { ACTIVITY_PUB, CONFIG, MIMETYPES, REMOTE_SCHEME, sequelizeTypescript, THUMBNAILS_SIZE } from '../../initializers' 20import {
21 ACTIVITY_PUB,
22 CONFIG,
23 MIMETYPES,
24 P2P_MEDIA_LOADER_PEER_VERSION,
25 REMOTE_SCHEME,
26 sequelizeTypescript,
27 THUMBNAILS_SIZE
28} from '../../initializers'
21import { ActorModel } from '../../models/activitypub/actor' 29import { ActorModel } from '../../models/activitypub/actor'
22import { TagModel } from '../../models/video/tag' 30import { TagModel } from '../../models/video/tag'
23import { VideoModel } from '../../models/video/video' 31import { VideoModel } from '../../models/video/video'
@@ -599,6 +607,7 @@ function streamingPlaylistActivityUrlToDBAttributes (video: VideoModel, videoObj
599 playlistUrl: playlistUrlObject.href, 607 playlistUrl: playlistUrlObject.href,
600 segmentsSha256Url: segmentsSha256UrlObject.href, 608 segmentsSha256Url: segmentsSha256UrlObject.href,
601 p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrlObject.href, videoFiles), 609 p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrlObject.href, videoFiles),
610 p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION,
602 videoId: video.id 611 videoId: video.id
603 } 612 }
604 613
diff --git a/server/lib/hls.ts b/server/lib/hls.ts
index c0fc4961a..a9a96dd16 100644
--- a/server/lib/hls.ts
+++ b/server/lib/hls.ts
@@ -19,7 +19,7 @@ async function updateStreamingPlaylistsInfohashesIfNeeded () {
19 await sequelizeTypescript.transaction(async t => { 19 await sequelizeTypescript.transaction(async t => {
20 const videoFiles = await VideoFileModel.listByStreamingPlaylist(playlist.id, t) 20 const videoFiles = await VideoFileModel.listByStreamingPlaylist(playlist.id, t)
21 21
22 playlist.p2pMediaLoaderInfohashes = await VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlist.playlistUrl, videoFiles) 22 playlist.p2pMediaLoaderInfohashes = VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlist.playlistUrl, videoFiles)
23 playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION 23 playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
24 await playlist.save({ transaction: t }) 24 await playlist.save({ transaction: t })
25 }) 25 })
diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts
index c29e34ab5..dbc22816c 100644
--- a/server/lib/video-transcoding.ts
+++ b/server/lib/video-transcoding.ts
@@ -1,4 +1,4 @@
1import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY } from '../initializers' 1import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers'
2import { join } from 'path' 2import { join } from 'path'
3import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils' 3import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils'
4import { ensureDir, move, remove, stat } from 'fs-extra' 4import { ensureDir, move, remove, stat } from 'fs-extra'
@@ -118,6 +118,7 @@ async function generateHlsPlaylist (video: VideoModel, resolution: VideoResoluti
118 playlistUrl, 118 playlistUrl,
119 segmentsSha256Url: CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid), 119 segmentsSha256Url: CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid),
120 p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles), 120 p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles),
121 p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION,
121 122
122 type: VideoStreamingPlaylistType.HLS 123 type: VideoStreamingPlaylistType.HLS
123 }) 124 })