From ddb62a85c5517d3437feb7d487a8a11881b68fcb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Jan 2021 10:56:55 +0100 Subject: [PATCH] Fix wait transcoding checkbox display --- .../shared/video-edit.component.html | 4 ++-- .../shared/video-edit.component.ts | 22 +++++-------------- .../video-go-live.component.html | 2 +- .../video-go-live.component.ts | 4 ++++ .../video-upload.component.html | 2 +- .../video-upload.component.ts | 6 ----- .../+video-edit/video-update.component.html | 2 +- .../+video-edit/video-update.component.ts | 20 ++++++++++++----- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 9c2aea526..6208ab69b 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html @@ -136,7 +136,7 @@ - + Publish after transcoding @@ -347,5 +347,5 @@ diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 5294a57a1..80b5dce46 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -96,22 +96,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() } - get existingCaptions () { - return this.videoCaptions - .filter(c => c.action !== 'REMOVE') - .map(c => c.language.id) - } - - isWaitTranscodingDisplayed () { - if (!this.waitTranscodingEnabled) return false - - if (this.liveVideo) { - return this.form.value['saveReplay'] === true - } - - return true - } - updateForm () { const defaultValues: any = { nsfw: 'false', @@ -217,6 +201,12 @@ export class VideoEditComponent implements OnInit, OnDestroy { if (this.schedulerInterval) clearInterval(this.schedulerInterval) } + getExistingCaptions () { + return this.videoCaptions + .filter(c => c.action !== 'REMOVE') + .map(c => c.language.id) + } + onCaptionAdded (caption: VideoCaptionEdit) { const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id) diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html index 17c37d42b..fddb08e0b 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html @@ -36,7 +36,7 @@
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index 67d055f06..8780ca567 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts @@ -137,6 +137,10 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon return this.serverConfig.live.maxDuration / 1000 } + isWaitTranscodingEnabled () { + return this.form.value['saveReplay'] === true + } + private fetchVideoLive () { this.liveVideoService.getVideoLive(this.videoId) .subscribe( diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html index deea3daf9..4c0b09894 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html @@ -84,7 +84,7 @@ diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index cafb030b9..ca21b61cd 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts @@ -44,7 +44,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy } formData: FormData - waitTranscodingEnabled = true previewfileUpload: File error: string @@ -163,11 +162,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy if (nameWithoutExtension.length < 3) name = videofile.name else name = nameWithoutExtension - // Force user to wait transcoding for unsupported video types in web browsers - if (!videofile.name.endsWith('.mp4') && !videofile.name.endsWith('.webm') && !videofile.name.endsWith('.ogv')) { - this.waitTranscodingEnabled = false - } - const nsfw = this.serverConfig.instance.isNSFW const waitTranscoding = true const commentsEnabled = true diff --git a/client/src/app/+videos/+video-edit/video-update.component.html b/client/src/app/+videos/+video-edit/video-update.component.html index f290fd136..41501714f 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.html +++ b/client/src/app/+videos/+video-edit/video-update.component.html @@ -9,7 +9,7 @@ diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 30c82343b..e2331c148 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts @@ -17,6 +17,7 @@ import { hydrateFormFromVideo } from './shared/video-edit-utils' }) export class VideoUpdateComponent extends FormReactive implements OnInit { video: VideoEdit + videoDetails: VideoDetails userVideoChannels: SelectChannelItem[] = [] videoCaptions: VideoCaptionEdit[] = [] liveVideo: LiveVideo @@ -47,17 +48,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { .pipe(map(data => data.videoData)) .subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => { this.video = new VideoEdit(video) + this.videoDetails = video + this.userVideoChannels = videoChannels this.videoCaptions = videoCaptions this.liveVideo = liveVideo this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE - const videoFiles = (video as VideoDetails).getFiles() - if (videoFiles.length > 1) { // Already transcoded - this.waitTranscodingEnabled = false - } - // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout setTimeout(() => { hydrateFormFromVideo(this.form, this.video, true) @@ -106,6 +104,18 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { return this.form.valid } + isWaitTranscodingEnabled () { + if (this.videoDetails.getFiles().length > 1) { // Already transcoded + return false + } + + if (this.liveVideo && this.form.value['saveReplay'] !== true) { + return false + } + + return true + } + update () { if (this.checkForm() === false || this.isUpdatingVideo === true) { -- 2.41.0