})
export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>()
- @ViewChild('videofileInput') videofileInput
+ @ViewChild('videofileInput') videofileInput: any
// So that it can be accessed in the template
readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY
userVideoQuotaUsed = 0
+ userVideoQuotaUsedDaily = 0
isUploadingVideo = false
isUpdatingVideo = false
super.ngOnInit()
this.userService.getMyVideoQuotaUsed()
- .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed)
+ .subscribe(data => {
+ this.userVideoQuotaUsed = data.videoQuotaUsed
+ this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
+ })
}
ngOnDestroy () {
if (this.videoUploaded === true) {
// FIXME: cannot concatenate strings inside i18n service :/
- text = this.i18n('Your video was uploaded to your account and is private.') +
+ text = this.i18n('Your video was uploaded to your account and is private.') + ' ' +
this.i18n('But associated data (tags, description...) will be lost, are you sure you want to leave this page?')
} else {
text = this.i18n('Your video is not uploaded yet, are you sure you want to leave this page?')
return
}
+ const bytePipes = new BytesPipe()
const videoQuota = this.authService.getUser().videoQuota
if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) {
- const bytePipes = new BytesPipe()
-
const msg = this.i18n(
- 'Your video quota is exceeded with this video (video size: {{ videoSize }}, used: {{ videoQuotaUsed }}, quota: {{ videoQuota }})',
+ 'Your video quota is exceeded with this video (video size: {{videoSize}}, used: {{videoQuotaUsed}}, quota: {{videoQuota}})',
{
videoSize: bytePipes.transform(videofile.size, 0),
videoQuotaUsed: bytePipes.transform(this.userVideoQuotaUsed, 0),
return
}
+ const videoQuotaDaily = this.authService.getUser().videoQuotaDaily
+ if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) {
+ const msg = this.i18n(
+ 'Your daily video quota is exceeded with this video (video size: {{videoSize}}, used: {{quotaUsedDaily}}, quota: {{quotaDaily}})',
+ {
+ videoSize: bytePipes.transform(videofile.size, 0),
+ quotaUsedDaily: bytePipes.transform(this.userVideoQuotaUsedDaily, 0),
+ quotaDaily: bytePipes.transform(videoQuotaDaily, 0)
+ }
+ )
+ this.notificationsService.error(this.i18n('Error'), msg)
+ return
+ }
+
const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '')
let name: string
channelId
})
+ this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies)
+
this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe(
event => {
if (event.type === HttpEventType.UploadProgress) {
)
}
+ isPublishingButtonDisabled () {
+ return !this.form.valid ||
+ this.isUpdatingVideo === true ||
+ this.videoUploaded !== true
+ }
+
updateSecondStep () {
if (this.checkForm() === false) {
return