Auto update publishedAt in live restream

pull/4597/head
Chocobozzz 2021-11-26 17:36:38 +01:00
parent ca9bea152a
commit 7137377d09
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 7 additions and 0 deletions

View File

@ -343,6 +343,7 @@ class LiveManager {
logger.info('Will publish and federate live %s.', video.url, localLTags) logger.info('Will publish and federate live %s.', video.url, localLTags)
video.state = VideoState.PUBLISHED video.state = VideoState.PUBLISHED
video.publishedAt = new Date()
await video.save() await video.save()
live.Video = video live.Video = video

View File

@ -101,6 +101,7 @@ describe('Permanent live', function () {
it('Should stream into this permanent live', async function () { it('Should stream into this permanent live', async function () {
this.timeout(120000) this.timeout(120000)
const beforePublication = new Date()
const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID }) const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: videoUUID })
for (const server of servers) { for (const server of servers) {
@ -109,6 +110,11 @@ describe('Permanent live', function () {
await checkVideoState(videoUUID, VideoState.PUBLISHED) 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 stopFfmpeg(ffmpegCommand)
await servers[0].live.waitUntilWaiting({ videoId: videoUUID }) await servers[0].live.waitUntilWaiting({ videoId: videoUUID })