From 14e2014acc1362cfbb770c051a7254b156cd8efb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Dec 2018 14:52:50 +0100 Subject: Support additional video extensions --- .../src/app/videos/+video-edit/shared/video-edit.component.html | 1 + client/src/app/videos/+video-edit/shared/video-edit.component.ts | 1 + .../+video-edit/video-add-components/video-upload.component.html | 3 ++- .../+video-edit/video-add-components/video-upload.component.ts | 9 +++++++++ client/src/app/videos/+video-edit/video-update.component.html | 2 +- client/src/app/videos/+video-edit/video-update.component.ts | 7 +++++++ 6 files changed, 21 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos/+video-edit') 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 @@ > Select the file to upload - (.mp4, .webm, .ogv) + ({{ videoExtensions }})
@@ -47,6 +47,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 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 id: 0, uuid: '' } + waitTranscodingEnabled = true error: string @@ -117,6 +118,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy const videofile = this.videofileInput.nativeElement.files[0] if (!videofile) return + // Check global user quota const bytePipes = new BytesPipe() const videoQuota = this.authService.getUser().videoQuota if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { @@ -132,6 +134,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy return } + // Check daily user quota const videoQuotaDaily = this.authService.getUser().videoQuotaDaily if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { const msg = this.i18n( @@ -146,6 +149,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy return } + // Build name field const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '') let name: string @@ -153,6 +157,11 @@ 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 privacy = this.firstStepPrivacyId.toString() const nsfw = false 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 @@
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' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { VideoCaptionService } from '@app/shared/video-caption' import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' +import { VideoDetails } from '@app/shared/video/video-details.model' @Component({ selector: 'my-videos-update', @@ -26,6 +27,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { userVideoChannels: { id: number, label: string, support: string }[] = [] schedulePublicationPossible = false videoCaptions: VideoCaptionEdit[] = [] + waitTranscodingEnabled = true private updateDone = false @@ -65,6 +67,11 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) + const videoFiles = (video as VideoDetails).files + 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(() => this.hydrateFormFromVideo()) }, -- cgit v1.2.3