-import { Component, EventEmitter, OnInit, Output } from '@angular/core'
+import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
-import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
+import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { VideoPrivacy, VideoUpdate } from '@shared/models'
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
import { VideoPrivacy, VideoUpdate } from '@shared/models'
@Output() firstStepDone = new EventEmitter<string>()
@Output() firstStepError = new EventEmitter<void>()
@Output() firstStepDone = new EventEmitter<string>()
@Output() firstStepError = new EventEmitter<void>()
constructor (
protected formValidatorService: FormValidatorService,
protected loadingBar: LoadingBarService,
constructor (
protected formValidatorService: FormValidatorService,
protected loadingBar: LoadingBarService,
protected videoService: VideoService,
protected videoCaptionService: VideoCaptionService,
private router: Router,
protected videoService: VideoService,
protected videoCaptionService: VideoCaptionService,
private router: Router,
this.video = new VideoEdit(Object.assign(video, {
commentsEnabled: videoUpdate.commentsEnabled,
downloadEnabled: videoUpdate.downloadEnabled,
this.video = new VideoEdit(Object.assign(video, {
commentsEnabled: videoUpdate.commentsEnabled,
downloadEnabled: videoUpdate.downloadEnabled,
-
- }
-
- private hydrateFormFromVideo () {
- this.form.patchValue(this.video.toFormPatch())
-
- const objects = [
- {
- url: 'thumbnailUrl',
- name: 'thumbnailfile'
- },
- {
- url: 'previewUrl',
- name: 'previewfile'
- }
- ]
-
- for (const obj of objects) {
- fetch(this.video[obj.url])
- .then(response => response.blob())
- .then(data => {
- this.form.patchValue({
- [ obj.name ]: data
- })
- })
- }