diff options
Diffstat (limited to 'client/src/app/shared/video/modals/video-download.component.ts')
-rw-r--r-- | client/src/app/shared/video/modals/video-download.component.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index 4022a11e8..0e9e44de7 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts | |||
@@ -24,12 +24,18 @@ export class VideoDownloadComponent { | |||
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { } | 25 | ) { } |
26 | 26 | ||
27 | getVideoFiles () { | ||
28 | if (!this.video) return [] | ||
29 | |||
30 | return this.video.getFiles() | ||
31 | } | ||
32 | |||
27 | show (video: VideoDetails) { | 33 | show (video: VideoDetails) { |
28 | this.video = video | 34 | this.video = video |
29 | 35 | ||
30 | this.activeModal = this.modalService.open(this.modal) | 36 | this.activeModal = this.modalService.open(this.modal) |
31 | 37 | ||
32 | this.resolutionId = this.video.files[0].resolution.id | 38 | this.resolutionId = this.getVideoFiles()[0].resolution.id |
33 | } | 39 | } |
34 | 40 | ||
35 | onClose () { | 41 | onClose () { |
@@ -45,7 +51,7 @@ export class VideoDownloadComponent { | |||
45 | // HTML select send us a string, so convert it to a number | 51 | // HTML select send us a string, so convert it to a number |
46 | this.resolutionId = parseInt(this.resolutionId.toString(), 10) | 52 | this.resolutionId = parseInt(this.resolutionId.toString(), 10) |
47 | 53 | ||
48 | const file = this.video.files.find(f => f.resolution.id === this.resolutionId) | 54 | const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) |
49 | if (!file) { | 55 | if (!file) { |
50 | console.error('Could not find file with resolution %d.', this.resolutionId) | 56 | console.error('Could not find file with resolution %d.', this.resolutionId) |
51 | return | 57 | return |