diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-download.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-download.component.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts index e0b7b51ff..1e3745d94 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts | |||
@@ -30,6 +30,8 @@ export class VideoDownloadComponent { | |||
30 | videoCaptions: VideoCaption[] | 30 | videoCaptions: VideoCaption[] |
31 | activeModal: NgbModalRef | 31 | activeModal: NgbModalRef |
32 | 32 | ||
33 | isAdvancedCustomizationCollapsed = true | ||
34 | |||
33 | type: DownloadType = 'video' | 35 | type: DownloadType = 'video' |
34 | 36 | ||
35 | private bytesPipe: BytesPipe | 37 | private bytesPipe: BytesPipe |
@@ -65,8 +67,7 @@ export class VideoDownloadComponent { | |||
65 | 67 | ||
66 | this.activeModal = this.modalService.open(this.modal, { centered: true }) | 68 | this.activeModal = this.modalService.open(this.modal, { centered: true }) |
67 | 69 | ||
68 | this.resolutionId = this.getVideoFiles()[0].resolution.id | 70 | this.onResolutionIdChange(this.getVideoFiles()[0].resolution.id) |
69 | this.onResolutionIdChange() | ||
70 | 71 | ||
71 | if (this.videoCaptions) this.subtitleLanguageId = this.videoCaptions[0].language.id | 72 | if (this.videoCaptions) this.subtitleLanguageId = this.videoCaptions[0].language.id |
72 | 73 | ||
@@ -91,12 +92,15 @@ export class VideoDownloadComponent { | |||
91 | : this.getVideoFileLink() | 92 | : this.getVideoFileLink() |
92 | } | 93 | } |
93 | 94 | ||
94 | async onResolutionIdChange () { | 95 | async onResolutionIdChange (resolutionId: number) { |
96 | this.resolutionId = resolutionId | ||
95 | this.videoFile = this.getVideoFile() | 97 | this.videoFile = this.getVideoFile() |
96 | if (this.videoFile.metadata || !this.videoFile.metadataUrl) return | ||
97 | 98 | ||
98 | await this.hydrateMetadataFromMetadataUrl(this.videoFile) | 99 | if (!this.videoFile.metadata) { |
99 | if (!this.videoFile.metadata) return | 100 | if (!this.videoFile.metadataUrl) return |
101 | |||
102 | await this.hydrateMetadataFromMetadataUrl(this.videoFile) | ||
103 | } | ||
100 | 104 | ||
101 | this.videoFileMetadataFormat = this.videoFile | 105 | this.videoFileMetadataFormat = this.videoFile |
102 | ? this.getMetadataFormat(this.videoFile.metadata.format) | 106 | ? this.getMetadataFormat(this.videoFile.metadata.format) |
@@ -110,9 +114,6 @@ export class VideoDownloadComponent { | |||
110 | } | 114 | } |
111 | 115 | ||
112 | getVideoFile () { | 116 | getVideoFile () { |
113 | // HTML select send us a string, so convert it to a number | ||
114 | this.resolutionId = parseInt(this.resolutionId.toString(), 10) | ||
115 | |||
116 | const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) | 117 | const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) |
117 | if (!file) { | 118 | if (!file) { |
118 | console.error('Could not find file with resolution %d.', this.resolutionId) | 119 | console.error('Could not find file with resolution %d.', this.resolutionId) |