]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Auto update publishedAt in live restream
authorChocobozzz <me@florianbigard.com>
Fri, 26 Nov 2021 16:36:38 +0000 (17:36 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 26 Nov 2021 16:36:55 +0000 (17:36 +0100)
server/lib/live/live-manager.ts
server/tests/api/live/live-permanent.ts

index b3bf5a999aa8b0ac3693145f139c069cb0910e37..33e49acc1b9a9c4d94573f9c88db3d3a5c599c7a 100644 (file)
@@ -343,6 +343,7 @@ class LiveManager {
       logger.info('Will publish and federate live %s.', video.url, localLTags)
 
       video.state = VideoState.PUBLISHED
+      video.publishedAt = new Date()
       await video.save()
 
       live.Video = video
index f07d4cfecc7936b0df884abf4bd3da323ae45bdf..c5f942901dc132ce01f8df222f6c12317eaa9f97 100644 (file)
@@ -101,6 +101,7 @@ describe('Permanent live', function () {
   it('Should stream into this permanent live', async function () {
     this.timeout(120000)
 
+    const beforePublication = new Date()
     const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID })
 
     for (const server of servers) {
@@ -109,6 +110,11 @@ describe('Permanent live', function () {
 
     await checkVideoState(videoUUID, VideoState.PUBLISHED)
 
+    for (const server of servers) {
+      const video = await server.videos.get({ id: videoUUID })
+      expect(new Date(video.publishedAt)).greaterThan(beforePublication)
+    }
+
     await stopFfmpeg(ffmpegCommand)
     await servers[0].live.waitUntilWaiting({ videoId: videoUUID })