import { Router } from '@angular/router'
import { UserService } from '@app/shared'
import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
+import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications'
import { BytesPipe } from 'ngx-pipes'
import { Subscription } from 'rxjs/Subscription'
@ViewChild('videofileInput') videofileInput
isUploadingVideo = false
+ isUpdatingVideo = false
videoUploaded = false
videoUploadObservable: Subscription = null
videoUploadPercents = 0
private authService: AuthService,
private userService: UserService,
private serverService: ServerService,
- private videoService: VideoService
+ private videoService: VideoService,
+ private loadingBar: LoadingBarService
) {
super()
}
video.id = this.videoUploadedIds.id
video.uuid = this.videoUploadedIds.uuid
+ this.isUpdatingVideo = true
+ this.loadingBar.start()
this.videoService.updateVideo(video)
.subscribe(
() => {
+ this.isUpdatingVideo = false
this.isUploadingVideo = false
+ this.loadingBar.complete()
+
this.notificationsService.success('Success', 'Video published.')
this.router.navigate([ '/videos/watch', video.uuid ])
},
err => {
+ this.isUpdatingVideo = false
this.notificationsService.error('Error', err.message)
console.error(err)
}