diff options
Diffstat (limited to 'client/src')
10 files changed, 36 insertions, 7 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index fd4d3d9c9..6ece7e8bc 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -220,6 +220,14 @@ | |||
220 | <ng-template [ngIf]="isTranscodingEnabled()"> | 220 | <ng-template [ngIf]="isTranscodingEnabled()"> |
221 | 221 | ||
222 | <div class="form-group"> | 222 | <div class="form-group"> |
223 | <my-peertube-checkbox | ||
224 | inputName="transcodingAllowAdditionalExtensions" formControlName="transcodingAllowAdditionalExtensions" | ||
225 | i18n-labelText labelText="Allow additional extensions" | ||
226 | i18n-helpHtml helpHtml="Allow your users to upload .mkv, .mov, .avi, .flv videos" | ||
227 | ></my-peertube-checkbox> | ||
228 | </div> | ||
229 | |||
230 | <div class="form-group"> | ||
223 | <label i18n for="transcodingThreads">Transcoding threads</label> | 231 | <label i18n for="transcodingThreads">Transcoding threads</label> |
224 | <div class="peertube-select-container"> | 232 | <div class="peertube-select-container"> |
225 | <select id="transcodingThreads" formControlName="transcodingThreads"> | 233 | <select id="transcodingThreads" formControlName="transcodingThreads"> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index f48b6fc1a..6eea1cd76 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -82,6 +82,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
82 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, | 82 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, |
83 | userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, | 83 | userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, |
84 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, | 84 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, |
85 | transcodingAllowAdditionalExtensions: null, | ||
85 | transcodingEnabled: null, | 86 | transcodingEnabled: null, |
86 | customizationJavascript: null, | 87 | customizationJavascript: null, |
87 | customizationCSS: null | 88 | customizationCSS: null |
@@ -163,6 +164,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
163 | }, | 164 | }, |
164 | transcoding: { | 165 | transcoding: { |
165 | enabled: this.form.value['transcodingEnabled'], | 166 | enabled: this.form.value['transcodingEnabled'], |
167 | allowAdditionalExtensions: this.form.value['transcodingAllowAdditionalExtensions'], | ||
166 | threads: this.form.value['transcodingThreads'], | 168 | threads: this.form.value['transcodingThreads'], |
167 | resolutions: { | 169 | resolutions: { |
168 | '240p': this.form.value[this.getResolutionKey('240p')], | 170 | '240p': this.form.value[this.getResolutionKey('240p')], |
@@ -221,6 +223,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
221 | userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily, | 223 | userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily, |
222 | transcodingThreads: this.customConfig.transcoding.threads, | 224 | transcodingThreads: this.customConfig.transcoding.threads, |
223 | transcodingEnabled: this.customConfig.transcoding.enabled, | 225 | transcodingEnabled: this.customConfig.transcoding.enabled, |
226 | transcodingAllowAdditionalExtensions: this.customConfig.transcoding.allowAdditionalExtensions, | ||
224 | customizationJavascript: this.customConfig.instance.customizations.javascript, | 227 | customizationJavascript: this.customConfig.instance.customizations.javascript, |
225 | customizationCSS: this.customConfig.instance.customizations.css, | 228 | customizationCSS: this.customConfig.instance.customizations.css, |
226 | importVideosHttpEnabled: this.customConfig.import.videos.http.enabled, | 229 | importVideosHttpEnabled: this.customConfig.import.videos.http.enabled, |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.html b/client/src/app/shared/forms/peertube-checkbox.component.html index fb3006b53..7b8bcf601 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.html +++ b/client/src/app/shared/forms/peertube-checkbox.component.html | |||
@@ -1,10 +1,10 @@ | |||
1 | <div class="root"> | 1 | <div class="root"> |
2 | <label class="form-group-checkbox"> | 2 | <label class="form-group-checkbox"> |
3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="isDisabled" /> | 3 | <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="disabled" /> |
4 | <span role="checkbox" [attr.aria-checked]="checked"></span> | 4 | <span role="checkbox" [attr.aria-checked]="checked"></span> |
5 | <span *ngIf="labelText">{{ labelText }}</span> | 5 | <span *ngIf="labelText">{{ labelText }}</span> |
6 | <span *ngIf="labelHtml" [innerHTML]="labelHtml"></span> | 6 | <span *ngIf="labelHtml" [innerHTML]="labelHtml"></span> |
7 | </label> | 7 | </label> |
8 | 8 | ||
9 | <my-help *ngIf="helpHtml" tooltipPlacement="top" helpType="custom" i18n-customHtml [customHtml]="helpHtml"></my-help> | 9 | <my-help *ngIf="helpHtml" tooltipPlacement="top" helpType="custom" i18n-customHtml [customHtml]="helpHtml"></my-help> |
10 | </div> \ No newline at end of file | 10 | </div> |
diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index bbc9904df..c1a6915e8 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts | |||
@@ -19,8 +19,7 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { | |||
19 | @Input() labelText: string | 19 | @Input() labelText: string |
20 | @Input() labelHtml: string | 20 | @Input() labelHtml: string |
21 | @Input() helpHtml: string | 21 | @Input() helpHtml: string |
22 | 22 | @Input() disabled = false | |
23 | isDisabled = false | ||
24 | 23 | ||
25 | propagateChange = (_: any) => { /* empty */ } | 24 | propagateChange = (_: any) => { /* empty */ } |
26 | 25 | ||
@@ -41,6 +40,6 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { | |||
41 | } | 40 | } |
42 | 41 | ||
43 | setDisabledState (isDisabled: boolean) { | 42 | setDisabledState (isDisabled: boolean) { |
44 | this.isDisabled = isDisabled | 43 | this.disabled = isDisabled |
45 | } | 44 | } |
46 | } | 45 | } |
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 33c766d87..bd52d686a 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 | |||
@@ -126,6 +126,7 @@ | |||
126 | ></my-peertube-checkbox> | 126 | ></my-peertube-checkbox> |
127 | 127 | ||
128 | <my-peertube-checkbox | 128 | <my-peertube-checkbox |
129 | *ngIf="waitTranscodingEnabled" | ||
129 | inputName="waitTranscoding" formControlName="waitTranscoding" | 130 | inputName="waitTranscoding" formControlName="waitTranscoding" |
130 | i18n-labelText labelText="Wait transcoding before publishing the video" | 131 | i18n-labelText labelText="Wait transcoding before publishing the video" |
131 | i18n-helpHtml helpHtml="If you decide not to wait for transcoding before publishing the video, it could be unplayable until transcoding ends." | 132 | i18n-helpHtml helpHtml="If you decide not to wait for transcoding before publishing the video, it could be unplayable until transcoding ends." |
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 a56733e57..1d35b4ba8 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 | |||
@@ -27,6 +27,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] | 27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] |
28 | @Input() schedulePublicationPossible = true | 28 | @Input() schedulePublicationPossible = true |
29 | @Input() videoCaptions: VideoCaptionEdit[] = [] | 29 | @Input() videoCaptions: VideoCaptionEdit[] = [] |
30 | @Input() waitTranscodingEnabled = true | ||
30 | 31 | ||
31 | @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent | 32 | @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent |
32 | 33 | ||
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 a09f54dfc..289a28c66 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 | |||
@@ -6,7 +6,7 @@ | |||
6 | <span i18n>Select the file to upload</span> | 6 | <span i18n>Select the file to upload</span> |
7 | <input #videofileInput type="file" name="videofile" id="videofile" [accept]="videoExtensions" (change)="fileChange()" /> | 7 | <input #videofileInput type="file" name="videofile" id="videofile" [accept]="videoExtensions" (change)="fileChange()" /> |
8 | </div> | 8 | </div> |
9 | <span class="button-file-extension">(.mp4, .webm, .ogv)</span> | 9 | <span class="button-file-extension">({{ videoExtensions }})</span> |
10 | 10 | ||
11 | <div class="form-group form-group-channel"> | 11 | <div class="form-group form-group-channel"> |
12 | <label i18n for="first-step-channel">Channel</label> | 12 | <label i18n for="first-step-channel">Channel</label> |
@@ -47,6 +47,7 @@ | |||
47 | <my-video-edit | 47 | <my-video-edit |
48 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" | 48 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" |
49 | [validationMessages]="validationMessages" [videoPrivacies]="videoPrivacies" [userVideoChannels]="userVideoChannels" | 49 | [validationMessages]="validationMessages" [videoPrivacies]="videoPrivacies" [userVideoChannels]="userVideoChannels" |
50 | [waitTranscodingEnabled]="waitTranscodingEnabled" | ||
50 | ></my-video-edit> | 51 | ></my-video-edit> |
51 | 52 | ||
52 | <div class="submit-container"> | 53 | <div class="submit-container"> |
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 7ea3691fa..2180e22ab 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,6 +44,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
44 | id: 0, | 44 | id: 0, |
45 | uuid: '' | 45 | uuid: '' |
46 | } | 46 | } |
47 | waitTranscodingEnabled = true | ||
47 | 48 | ||
48 | error: string | 49 | error: string |
49 | 50 | ||
@@ -117,6 +118,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
117 | const videofile = this.videofileInput.nativeElement.files[0] | 118 | const videofile = this.videofileInput.nativeElement.files[0] |
118 | if (!videofile) return | 119 | if (!videofile) return |
119 | 120 | ||
121 | // Check global user quota | ||
120 | const bytePipes = new BytesPipe() | 122 | const bytePipes = new BytesPipe() |
121 | const videoQuota = this.authService.getUser().videoQuota | 123 | const videoQuota = this.authService.getUser().videoQuota |
122 | if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { | 124 | if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { |
@@ -132,6 +134,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
132 | return | 134 | return |
133 | } | 135 | } |
134 | 136 | ||
137 | // Check daily user quota | ||
135 | const videoQuotaDaily = this.authService.getUser().videoQuotaDaily | 138 | const videoQuotaDaily = this.authService.getUser().videoQuotaDaily |
136 | if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { | 139 | if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { |
137 | const msg = this.i18n( | 140 | const msg = this.i18n( |
@@ -146,6 +149,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
146 | return | 149 | return |
147 | } | 150 | } |
148 | 151 | ||
152 | // Build name field | ||
149 | const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '') | 153 | const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '') |
150 | let name: string | 154 | let name: string |
151 | 155 | ||
@@ -153,6 +157,11 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
153 | if (nameWithoutExtension.length < 3) name = videofile.name | 157 | if (nameWithoutExtension.length < 3) name = videofile.name |
154 | else name = nameWithoutExtension | 158 | else name = nameWithoutExtension |
155 | 159 | ||
160 | // Force user to wait transcoding for unsupported video types in web browsers | ||
161 | if (!videofile.name.endsWith('.mp4') && !videofile.name.endsWith('.webm') && !videofile.name.endsWith('.ogv')) { | ||
162 | this.waitTranscodingEnabled = false | ||
163 | } | ||
164 | |||
156 | const privacy = this.firstStepPrivacyId.toString() | 165 | const privacy = this.firstStepPrivacyId.toString() |
157 | const nsfw = false | 166 | const nsfw = false |
158 | const waitTranscoding = true | 167 | const waitTranscoding = 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 9242c30a0..0457778c0 100644 --- a/client/src/app/videos/+video-edit/video-update.component.html +++ b/client/src/app/videos/+video-edit/video-update.component.html | |||
@@ -8,7 +8,7 @@ | |||
8 | <my-video-edit | 8 | <my-video-edit |
9 | [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" | 9 | [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" |
10 | [validationMessages]="validationMessages" [videoPrivacies]="videoPrivacies" [userVideoChannels]="userVideoChannels" | 10 | [validationMessages]="validationMessages" [videoPrivacies]="videoPrivacies" [userVideoChannels]="userVideoChannels" |
11 | [videoCaptions]="videoCaptions" | 11 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="waitTranscodingEnabled" |
12 | ></my-video-edit> | 12 | ></my-video-edit> |
13 | 13 | ||
14 | <div class="submit-container"> | 14 | <div class="submit-container"> |
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 3a0f3a39a..d99a02b18 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -12,6 +12,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
12 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 12 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
13 | import { VideoCaptionService } from '@app/shared/video-caption' | 13 | import { VideoCaptionService } from '@app/shared/video-caption' |
14 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 14 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
15 | import { VideoDetails } from '@app/shared/video/video-details.model' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-videos-update', | 18 | selector: 'my-videos-update', |
@@ -26,6 +27,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
26 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 27 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
27 | schedulePublicationPossible = false | 28 | schedulePublicationPossible = false |
28 | videoCaptions: VideoCaptionEdit[] = [] | 29 | videoCaptions: VideoCaptionEdit[] = [] |
30 | waitTranscodingEnabled = true | ||
29 | 31 | ||
30 | private updateDone = false | 32 | private updateDone = false |
31 | 33 | ||
@@ -65,6 +67,11 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
65 | 67 | ||
66 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | 68 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) |
67 | 69 | ||
70 | const videoFiles = (video as VideoDetails).files | ||
71 | if (videoFiles.length > 1) { // Already transcoded | ||
72 | this.waitTranscodingEnabled = false | ||
73 | } | ||
74 | |||
68 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout | 75 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout |
69 | setTimeout(() => this.hydrateFormFromVideo()) | 76 | setTimeout(() => this.hydrateFormFromVideo()) |
70 | }, | 77 | }, |