diff options
Diffstat (limited to 'client/src/app/shared')
3 files changed, 13 insertions, 3 deletions
diff --git a/client/src/app/shared/video/modals/video-download.component.html b/client/src/app/shared/video/modals/video-download.component.html index 935d01330..3619f24e5 100644 --- a/client/src/app/shared/video/modals/video-download.component.html +++ b/client/src/app/shared/video/modals/video-download.component.html | |||
@@ -9,7 +9,7 @@ | |||
9 | <div class="input-group input-group-sm"> | 9 | <div class="input-group input-group-sm"> |
10 | <div class="input-group-prepend peertube-select-container"> | 10 | <div class="input-group-prepend peertube-select-container"> |
11 | <select [(ngModel)]="resolutionId"> | 11 | <select [(ngModel)]="resolutionId"> |
12 | <option *ngFor="let file of video?.files" [value]="file.resolution.id">{{ file.resolution.label }}</option> | 12 | <option *ngFor="let file of getVideoFiles()" [value]="file.resolution.id">{{ file.resolution.label }}</option> |
13 | </select> | 13 | </select> |
14 | </div> | 14 | </div> |
15 | <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" /> | 15 | <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" /> |
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 |
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index e4d443a06..c2a85d8e8 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts | |||
@@ -55,4 +55,8 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
55 | hasHlsPlaylist () { | 55 | hasHlsPlaylist () { |
56 | return !!this.getHlsPlaylist() | 56 | return !!this.getHlsPlaylist() |
57 | } | 57 | } |
58 | |||
59 | getFiles () { | ||
60 | if (this.files.length === 0) return this.getHlsPlaylist().files | ||
61 | } | ||
58 | } | 62 | } |