- // Build name field
- const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '')
- let name: string
-
- // If the name of the file is very small, keep the extension
- 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 = this.serverConfig.instance.isNSFW
- const waitTranscoding = true
- const commentsEnabled = true
- const downloadEnabled = true
- const channelId = this.firstStepChannelId.toString()
-
- const formData = new FormData()
- formData.append('name', name)
- // Put the video "private" -> we are waiting the user validation of the second step
- formData.append('privacy', VideoPrivacy.PRIVATE.toString())
- formData.append('nsfw', '' + nsfw)
- formData.append('commentsEnabled', '' + commentsEnabled)
- formData.append('downloadEnabled', '' + downloadEnabled)
- formData.append('waitTranscoding', '' + waitTranscoding)
- formData.append('channelId', '' + channelId)
- formData.append('videofile', videofile)
-
- if (this.previewfileUpload) {
- formData.append('previewfile', this.previewfileUpload)
- formData.append('thumbnailfile', this.previewfileUpload)
- }
-