aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-26 10:56:55 +0100
committerChocobozzz <me@florianbigard.com>2021-01-26 10:56:55 +0100
commitddb62a85c5517d3437feb7d487a8a11881b68fcb (patch)
treeb27bc798a85224a2fe5406ef5a9be49d17b48d66
parente08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3 (diff)
downloadPeerTube-ddb62a85c5517d3437feb7d487a8a11881b68fcb.tar.gz
PeerTube-ddb62a85c5517d3437feb7d487a8a11881b68fcb.tar.zst
PeerTube-ddb62a85c5517d3437feb7d487a8a11881b68fcb.zip
Fix wait transcoding checkbox display
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.html4
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts22
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts4
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts6
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-update.component.ts20
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 @@
136 </ng-template> 136 </ng-template>
137 </my-peertube-checkbox> 137 </my-peertube-checkbox>
138 138
139 <my-peertube-checkbox *ngIf="isWaitTranscodingDisplayed()" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right"> 139 <my-peertube-checkbox *ngIf="waitTranscodingEnabled" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right">
140 <ng-template ptTemplate="label"> 140 <ng-template ptTemplate="label">
141 <ng-container i18n>Publish after transcoding</ng-container> 141 <ng-container i18n>Publish after transcoding</ng-container>
142 </ng-template> 142 </ng-template>
@@ -347,5 +347,5 @@
347</div> 347</div>
348 348
349<my-video-caption-add-modal 349<my-video-caption-add-modal
350 #videoCaptionAddModal [existingCaptions]="existingCaptions" [serverConfig]="serverConfig" (captionAdded)="onCaptionAdded($event)" 350 #videoCaptionAddModal [existingCaptions]="getExistingCaptions()" [serverConfig]="serverConfig" (captionAdded)="onCaptionAdded($event)"
351></my-video-caption-add-modal> 351></my-video-caption-add-modal>
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 {
96 this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() 96 this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat()
97 } 97 }
98 98
99 get existingCaptions () {
100 return this.videoCaptions
101 .filter(c => c.action !== 'REMOVE')
102 .map(c => c.language.id)
103 }
104
105 isWaitTranscodingDisplayed () {
106 if (!this.waitTranscodingEnabled) return false
107
108 if (this.liveVideo) {
109 return this.form.value['saveReplay'] === true
110 }
111
112 return true
113 }
114
115 updateForm () { 99 updateForm () {
116 const defaultValues: any = { 100 const defaultValues: any = {
117 nsfw: 'false', 101 nsfw: 'false',
@@ -217,6 +201,12 @@ export class VideoEditComponent implements OnInit, OnDestroy {
217 if (this.schedulerInterval) clearInterval(this.schedulerInterval) 201 if (this.schedulerInterval) clearInterval(this.schedulerInterval)
218 } 202 }
219 203
204 getExistingCaptions () {
205 return this.videoCaptions
206 .filter(c => c.action !== 'REMOVE')
207 .map(c => c.language.id)
208 }
209
220 onCaptionAdded (caption: VideoCaptionEdit) { 210 onCaptionAdded (caption: VideoCaptionEdit) {
221 const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id) 211 const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id)
222 212
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 @@
36<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> 36<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
37 <my-video-edit 37 <my-video-edit
38 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" 38 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
39 [schedulePublicationPossible]="false" [waitTranscodingEnabled]="false" 39 [schedulePublicationPossible]="false" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
40 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo" 40 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
41 type="go-live" 41 type="go-live"
42 ></my-video-edit> 42 ></my-video-edit>
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
137 return this.serverConfig.live.maxDuration / 1000 137 return this.serverConfig.live.maxDuration / 1000
138 } 138 }
139 139
140 isWaitTranscodingEnabled () {
141 return this.form.value['saveReplay'] === true
142 }
143
140 private fetchVideoLive () { 144 private fetchVideoLive () {
141 this.liveVideoService.getVideoLive(this.videoId) 145 this.liveVideoService.getVideoLive(this.videoId)
142 .subscribe( 146 .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 @@
84 <my-video-edit 84 <my-video-edit
85 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" 85 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
86 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" 86 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
87 [waitTranscodingEnabled]="waitTranscodingEnabled" 87 [waitTranscodingEnabled]="true"
88 type="upload" 88 type="upload"
89 ></my-video-edit> 89 ></my-video-edit>
90 90
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
44 } 44 }
45 formData: FormData 45 formData: FormData
46 46
47 waitTranscodingEnabled = true
48 previewfileUpload: File 47 previewfileUpload: File
49 48
50 error: string 49 error: string
@@ -163,11 +162,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
163 if (nameWithoutExtension.length < 3) name = videofile.name 162 if (nameWithoutExtension.length < 3) name = videofile.name
164 else name = nameWithoutExtension 163 else name = nameWithoutExtension
165 164
166 // Force user to wait transcoding for unsupported video types in web browsers
167 if (!videofile.name.endsWith('.mp4') && !videofile.name.endsWith('.webm') && !videofile.name.endsWith('.ogv')) {
168 this.waitTranscodingEnabled = false
169 }
170
171 const nsfw = this.serverConfig.instance.isNSFW 165 const nsfw = this.serverConfig.instance.isNSFW
172 const waitTranscoding = true 166 const waitTranscoding = true
173 const commentsEnabled = true 167 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 @@
9 <my-video-edit 9 <my-video-edit
10 [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" 10 [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible"
11 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" 11 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
12 [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="waitTranscodingEnabled" 12 [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
13 type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" 13 type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
14 [liveVideo]="liveVideo" 14 [liveVideo]="liveVideo"
15 ></my-video-edit> 15 ></my-video-edit>
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'
17}) 17})
18export class VideoUpdateComponent extends FormReactive implements OnInit { 18export class VideoUpdateComponent extends FormReactive implements OnInit {
19 video: VideoEdit 19 video: VideoEdit
20 videoDetails: VideoDetails
20 userVideoChannels: SelectChannelItem[] = [] 21 userVideoChannels: SelectChannelItem[] = []
21 videoCaptions: VideoCaptionEdit[] = [] 22 videoCaptions: VideoCaptionEdit[] = []
22 liveVideo: LiveVideo 23 liveVideo: LiveVideo
@@ -47,17 +48,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
47 .pipe(map(data => data.videoData)) 48 .pipe(map(data => data.videoData))
48 .subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => { 49 .subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => {
49 this.video = new VideoEdit(video) 50 this.video = new VideoEdit(video)
51 this.videoDetails = video
52
50 this.userVideoChannels = videoChannels 53 this.userVideoChannels = videoChannels
51 this.videoCaptions = videoCaptions 54 this.videoCaptions = videoCaptions
52 this.liveVideo = liveVideo 55 this.liveVideo = liveVideo
53 56
54 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE 57 this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
55 58
56 const videoFiles = (video as VideoDetails).getFiles()
57 if (videoFiles.length > 1) { // Already transcoded
58 this.waitTranscodingEnabled = false
59 }
60
61 // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout 59 // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
62 setTimeout(() => { 60 setTimeout(() => {
63 hydrateFormFromVideo(this.form, this.video, true) 61 hydrateFormFromVideo(this.form, this.video, true)
@@ -106,6 +104,18 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
106 return this.form.valid 104 return this.form.valid
107 } 105 }
108 106
107 isWaitTranscodingEnabled () {
108 if (this.videoDetails.getFiles().length > 1) { // Already transcoded
109 return false
110 }
111
112 if (this.liveVideo && this.form.value['saveReplay'] !== true) {
113 return false
114 }
115
116 return true
117 }
118
109 update () { 119 update () {
110 if (this.checkForm() === false 120 if (this.checkForm() === false
111 || this.isUpdatingVideo === true) { 121 || this.isUpdatingVideo === true) {