+ private getInputVideoFile () {
+ return this.videofileInput.nativeElement.files[0]
+ }
+
+ private uploadFile (file: File, previewfile?: File) {
+ const metadata = {
+ waitTranscoding: true,
+ commentsEnabled: true,
+ downloadEnabled: true,
+ channelId: this.firstStepChannelId,
+ nsfw: this.serverConfig.instance.isNSFW,
+ privacy: VideoPrivacy.PRIVATE.toString(),
+ filename: file.name,
+ previewfile: previewfile as any
+ }
+
+ this.resumableUploadService.handleFiles(file, {
+ ...this.uploadxOptions,
+ metadata
+ })
+
+ this.isUploadingVideo = true
+ }
+
+ private handleUploadError (err: HttpErrorResponse) {
+ // Reset progress (but keep isUploadingVideo true)
+ this.videoUploadPercents = 0
+ this.enableRetryAfterError = true
+
+ this.error = genericUploadErrorHandler({
+ err,
+ name: $localize`video`,
+ notifier: this.notifier,
+ sticky: false
+ })
+
+ if (err.status === HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415) {
+ this.cancelUpload()
+ }
+ }
+
+ private closeFirstStep (filename: string) {
+ const nameWithoutExtension = filename.replace(/\.[^/.]+$/, '')
+ const name = nameWithoutExtension.length < 3 ? filename : nameWithoutExtension
+
+ this.form.patchValue({
+ name,
+ privacy: this.firstStepPrivacyId,
+ nsfw: this.serverConfig.instance.isNSFW,
+ channelId: this.firstStepChannelId,
+ previewfile: this.previewfileUpload
+ })
+
+ this.firstStepDone.emit(name)
+ }
+