diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-26 17:36:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-26 17:36:55 +0100 |
commit | 7137377d097a74087ed062c8071c1aa5c717c7f7 (patch) | |
tree | 346dcba7770792cfcf00c6e45345030735189f2c | |
parent | ca9bea152a7a62831daddbd56ee3c5dc71282fbe (diff) | |
download | PeerTube-7137377d097a74087ed062c8071c1aa5c717c7f7.tar.gz PeerTube-7137377d097a74087ed062c8071c1aa5c717c7f7.tar.zst PeerTube-7137377d097a74087ed062c8071c1aa5c717c7f7.zip |
Auto update publishedAt in live restream
-rw-r--r-- | server/lib/live/live-manager.ts | 1 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index b3bf5a999..33e49acc1 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts | |||
@@ -343,6 +343,7 @@ class LiveManager { | |||
343 | logger.info('Will publish and federate live %s.', video.url, localLTags) | 343 | logger.info('Will publish and federate live %s.', video.url, localLTags) |
344 | 344 | ||
345 | video.state = VideoState.PUBLISHED | 345 | video.state = VideoState.PUBLISHED |
346 | video.publishedAt = new Date() | ||
346 | await video.save() | 347 | await video.save() |
347 | 348 | ||
348 | live.Video = video | 349 | live.Video = video |
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index f07d4cfec..c5f942901 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -101,6 +101,7 @@ describe('Permanent live', function () { | |||
101 | it('Should stream into this permanent live', async function () { | 101 | it('Should stream into this permanent live', async function () { |
102 | this.timeout(120000) | 102 | this.timeout(120000) |
103 | 103 | ||
104 | const beforePublication = new Date() | ||
104 | const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID }) | 105 | const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID }) |
105 | 106 | ||
106 | for (const server of servers) { | 107 | for (const server of servers) { |
@@ -109,6 +110,11 @@ describe('Permanent live', function () { | |||
109 | 110 | ||
110 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 111 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
111 | 112 | ||
113 | for (const server of servers) { | ||
114 | const video = await server.videos.get({ id: videoUUID }) | ||
115 | expect(new Date(video.publishedAt)).greaterThan(beforePublication) | ||
116 | } | ||
117 | |||
112 | await stopFfmpeg(ffmpegCommand) | 118 | await stopFfmpeg(ffmpegCommand) |
113 | await servers[0].live.waitUntilWaiting({ videoId: videoUUID }) | 119 | await servers[0].live.waitUntilWaiting({ videoId: videoUUID }) |
114 | 120 | ||