export type VideoFilePayload = {
videoUUID: string
- resolution?: VideoResolution,
+ isNewVideo: boolean
+ resolution?: VideoResolution
isPortraitMode?: boolean
}
await onVideoFileTranscoderSuccess(video)
} else {
await video.optimizeOriginalVideofile()
- await onVideoFileOptimizerSuccess(video)
+ await onVideoFileOptimizerSuccess(video, payload.isNewVideo)
}
return video
return undefined
}
-async function onVideoFileOptimizerSuccess (video: VideoModel) {
+async function onVideoFileOptimizerSuccess (video: VideoModel, isNewVideo: boolean) {
if (video === undefined) return undefined
// Maybe the video changed in database, refresh it
if (!videoDatabase) return undefined
if (video.privacy !== VideoPrivacy.PRIVATE) {
- // Now we'll add the video's meta data to our followers
- await sequelizeTypescript.transaction(async t => {
- await sendCreateVideo(video, t)
- await shareVideoByServerAndChannel(video, t)
- })
+ if (isNewVideo === true) {
+ // Now we'll add the video's meta data to our followers
+ await sequelizeTypescript.transaction(async t => {
+ await sendCreateVideo(video, t)
+ await shareVideoByServerAndChannel(video, t)
+ })
+ } else {
+ await sendUpdateVideo(video, undefined)
+ }
}
const { videoFileResolution } = await videoDatabase.getOriginalFileResolution()
for (const resolution of resolutionsEnabled) {
const dataInput = {
videoUUID: videoDatabase.uuid,
- resolution
+ resolution,
+ isNewVideo
}
const p = JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput })