LiveSegmentShaStore.Instance.cleanupShaSegments(liveVideo.uuid)
if (live.saveReplay !== true) {
- return cleanupLiveAndFederate({ live, video: liveVideo })
+ return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
}
if (live.permanentLive) {
await saveReplayToExternalVideo({ liveVideo, liveSession, publishedAt: payload.publishedAt, replayDirectory: payload.replayDirectory })
- return cleanupLiveAndFederate({ live, video: liveVideo })
+ return cleanupLiveAndFederate({ live, video: liveVideo, streamingPlaylistId: payload.streamingPlaylistId })
}
return replaceLiveByReplay({ liveVideo, live, liveSession, replayDirectory: payload.replayDirectory })
async function cleanupLiveAndFederate (options: {
live: MVideoLive
video: MVideo
+ streamingPlaylistId: number
}) {
- const { live, video } = options
+ const { live, video, streamingPlaylistId } = options
- const streamingPlaylist = await VideoStreamingPlaylistModel.loadHLSPlaylistByVideo(video.id)
+ const streamingPlaylist = await VideoStreamingPlaylistModel.loadWithVideo(streamingPlaylistId)
- if (live.permanentLive) {
- await cleanupPermanentLive(video, streamingPlaylist)
- } else {
- await cleanupNormalLive(video, streamingPlaylist)
+ if (streamingPlaylist) {
+ if (live.permanentLive) {
+ await cleanupPermanentLive(video, streamingPlaylist)
+ } else {
+ await cleanupNormalLive(video, streamingPlaylist)
+ }
}
try {
createMultipleServers,
doubleFollow,
findExternalSavedVideo,
+ makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
// Streaming session #2
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
+
+ await wait(5000)
+ const video = await servers[0].videos.get({ id: liveVideoUUID })
+ expect(video.streamingPlaylists).to.have.lengthOf(1)
+ await makeRawRequest(video.streamingPlaylists[0].playlistUrl)
+
await stopFfmpeg(ffmpegCommand)
await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)