mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-12-02 13:29:23 -06:00
Fix HLS federation
This commit is contained in:
parent
0e9c48c2ed
commit
594d0c6a7c
@ -17,7 +17,15 @@ import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos
|
|||||||
import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils'
|
import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
import { doRequest, downloadImage } from '../../helpers/requests'
|
import { doRequest, downloadImage } from '../../helpers/requests'
|
||||||
import { ACTIVITY_PUB, CONFIG, MIMETYPES, REMOTE_SCHEME, sequelizeTypescript, THUMBNAILS_SIZE } from '../../initializers'
|
import {
|
||||||
|
ACTIVITY_PUB,
|
||||||
|
CONFIG,
|
||||||
|
MIMETYPES,
|
||||||
|
P2P_MEDIA_LOADER_PEER_VERSION,
|
||||||
|
REMOTE_SCHEME,
|
||||||
|
sequelizeTypescript,
|
||||||
|
THUMBNAILS_SIZE
|
||||||
|
} from '../../initializers'
|
||||||
import { ActorModel } from '../../models/activitypub/actor'
|
import { ActorModel } from '../../models/activitypub/actor'
|
||||||
import { TagModel } from '../../models/video/tag'
|
import { TagModel } from '../../models/video/tag'
|
||||||
import { VideoModel } from '../../models/video/video'
|
import { VideoModel } from '../../models/video/video'
|
||||||
@ -599,6 +607,7 @@ function streamingPlaylistActivityUrlToDBAttributes (video: VideoModel, videoObj
|
|||||||
playlistUrl: playlistUrlObject.href,
|
playlistUrl: playlistUrlObject.href,
|
||||||
segmentsSha256Url: segmentsSha256UrlObject.href,
|
segmentsSha256Url: segmentsSha256UrlObject.href,
|
||||||
p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrlObject.href, videoFiles),
|
p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrlObject.href, videoFiles),
|
||||||
|
p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION,
|
||||||
videoId: video.id
|
videoId: video.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ async function updateStreamingPlaylistsInfohashesIfNeeded () {
|
|||||||
await sequelizeTypescript.transaction(async t => {
|
await sequelizeTypescript.transaction(async t => {
|
||||||
const videoFiles = await VideoFileModel.listByStreamingPlaylist(playlist.id, t)
|
const videoFiles = await VideoFileModel.listByStreamingPlaylist(playlist.id, t)
|
||||||
|
|
||||||
playlist.p2pMediaLoaderInfohashes = await VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlist.playlistUrl, videoFiles)
|
playlist.p2pMediaLoaderInfohashes = VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlist.playlistUrl, videoFiles)
|
||||||
playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
|
playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION
|
||||||
await playlist.save({ transaction: t })
|
await playlist.save({ transaction: t })
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY } from '../initializers'
|
import { CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION } from '../initializers'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils'
|
import { getVideoFileFPS, transcode } from '../helpers/ffmpeg-utils'
|
||||||
import { ensureDir, move, remove, stat } from 'fs-extra'
|
import { ensureDir, move, remove, stat } from 'fs-extra'
|
||||||
@ -118,6 +118,7 @@ async function generateHlsPlaylist (video: VideoModel, resolution: VideoResoluti
|
|||||||
playlistUrl,
|
playlistUrl,
|
||||||
segmentsSha256Url: CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid),
|
segmentsSha256Url: CONFIG.WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid),
|
||||||
p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles),
|
p2pMediaLoaderInfohashes: VideoStreamingPlaylistModel.buildP2PMediaLoaderInfoHashes(playlistUrl, video.VideoFiles),
|
||||||
|
p2pMediaLoaderPeerVersion: P2P_MEDIA_LOADER_PEER_VERSION,
|
||||||
|
|
||||||
type: VideoStreamingPlaylistType.HLS
|
type: VideoStreamingPlaylistType.HLS
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user