X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-video-miniature%2Fvideo-download.component.ts;h=1e3745d94e3a5cf6418bf575740e2cc104104a9d;hb=931d3430184143ebd88e5243def6eb1d7acfdbf4;hp=e0b7b51ff25a8b1b72c0171e1a09dca5890cdbe3;hpb=7bd455cb7ff05568944db070f3548b88728ecc67;p=github%2FChocobozzz%2FPeerTube.git 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 { videoCaptions: VideoCaption[] activeModal: NgbModalRef + isAdvancedCustomizationCollapsed = true + type: DownloadType = 'video' private bytesPipe: BytesPipe @@ -65,8 +67,7 @@ export class VideoDownloadComponent { this.activeModal = this.modalService.open(this.modal, { centered: true }) - this.resolutionId = this.getVideoFiles()[0].resolution.id - this.onResolutionIdChange() + this.onResolutionIdChange(this.getVideoFiles()[0].resolution.id) if (this.videoCaptions) this.subtitleLanguageId = this.videoCaptions[0].language.id @@ -91,12 +92,15 @@ export class VideoDownloadComponent { : this.getVideoFileLink() } - async onResolutionIdChange () { + async onResolutionIdChange (resolutionId: number) { + this.resolutionId = resolutionId this.videoFile = this.getVideoFile() - if (this.videoFile.metadata || !this.videoFile.metadataUrl) return - await this.hydrateMetadataFromMetadataUrl(this.videoFile) - if (!this.videoFile.metadata) return + if (!this.videoFile.metadata) { + if (!this.videoFile.metadataUrl) return + + await this.hydrateMetadataFromMetadataUrl(this.videoFile) + } this.videoFileMetadataFormat = this.videoFile ? this.getMetadataFormat(this.videoFile.metadata.format) @@ -110,9 +114,6 @@ export class VideoDownloadComponent { } getVideoFile () { - // HTML select send us a string, so convert it to a number - this.resolutionId = parseInt(this.resolutionId.toString(), 10) - const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) if (!file) { console.error('Could not find file with resolution %d.', this.resolutionId)