+ it('Should correctly have updated the live and federated it when streaming in the live', async function () {
+ this.timeout(20000)
+
+ ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
+ await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
+
+ await waitJobs(servers)
+
+ await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
+ await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
+ await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.PUBLIC)
+ })
+
+ it('Should correctly have saved the live and federated it after the streaming', async function () {
+ this.timeout(30000)
+ const liveDetails = await servers[0].videos.get({ id: liveVideoUUID })
+
+ await stopFfmpeg(ffmpegCommand)
+
+ await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID)
+ await waitJobs(servers)
+
+ const video = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(video).to.exist
+
+ for (const server of servers) {
+ await server.videos.get({ id: video.uuid })
+ }
+
+ lastReplayUUID = video.uuid
+ })
+
+ it('Should have appropriate ended session and replay live session', async function () {
+ const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID })
+ expect(total).to.equal(2)
+ expect(data).to.have.lengthOf(2)
+
+ const sessionFromLive = data[1]
+ const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID })
+
+ for (const session of [ sessionFromLive, sessionFromReplay ]) {
+ expect(session.startDate).to.exist
+ expect(session.endDate).to.exist
+
+ expect(session.replaySettings).to.exist
+ expect(session.replaySettings.privacy).to.equal(VideoPrivacy.PUBLIC)
+
+ expect(session.error).to.not.exist
+
+ expect(session.replayVideo).to.exist
+ expect(session.replayVideo.id).to.exist
+ expect(session.replayVideo.shortUUID).to.exist
+ expect(session.replayVideo.uuid).to.equal(lastReplayUUID)
+ }
+ })
+
+ it('Should have the first live replay with correct settings', async function () {
+ await checkVideosExist(lastReplayUUID, true, HttpStatusCode.OK_200)
+ await checkVideoState(lastReplayUUID, VideoState.PUBLISHED)
+ await checkVideoPrivacy(lastReplayUUID, VideoPrivacy.PUBLIC)
+ })
+
+ it('Should have cleaned up the live files', async function () {
+ await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false })
+ })
+
+ it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () {
+ this.timeout(120000)
+
+ await servers[0].videos.remove({ id: lastReplayUUID })
+ const { liveDetails } = await publishLiveAndBlacklist({
+ permanent: true,
+ replay: true,
+ replaySettings: { privacy: VideoPrivacy.PUBLIC }
+ })
+
+ const replay = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(replay).to.exist
+
+ for (const videoId of [ liveVideoUUID, replay.uuid ]) {
+ await checkVideosExist(videoId, false)
+
+ await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+ await servers[1].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+ }
+
+ await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false })
+ })
+
+ it('Should correctly terminate the stream on delete and not save the video', async function () {
+ this.timeout(40000)
+
+ const { liveDetails } = await publishLiveAndDelete({
+ permanent: true,
+ replay: true,
+ replaySettings: { privacy: VideoPrivacy.PUBLIC }
+ })
+
+ const replay = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(replay).to.not.exist
+
+ await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
+ await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false })
+ })