From 5a71acd2547c098657ae6e0e31e0862094585088 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 21 Nov 2019 17:01:24 +0100 Subject: Disable webtorrent support in client --- .../src/app/shared/video/modals/video-download.component.html | 2 +- client/src/app/shared/video/modals/video-download.component.ts | 10 ++++++++-- client/src/app/shared/video/video-details.model.ts | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'client/src/app/shared/video') 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 @@
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 { private i18n: I18n ) { } + getVideoFiles () { + if (!this.video) return [] + + return this.video.getFiles() + } + show (video: VideoDetails) { this.video = video this.activeModal = this.modalService.open(this.modal) - this.resolutionId = this.video.files[0].resolution.id + this.resolutionId = this.getVideoFiles()[0].resolution.id } onClose () { @@ -45,7 +51,7 @@ export class VideoDownloadComponent { // HTML select send us a string, so convert it to a number this.resolutionId = parseInt(this.resolutionId.toString(), 10) - const file = this.video.files.find(f => f.resolution.id === this.resolutionId) + const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) if (!file) { console.error('Could not find file with resolution %d.', this.resolutionId) 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 { hasHlsPlaylist () { return !!this.getHlsPlaylist() } + + getFiles () { + if (this.files.length === 0) return this.getHlsPlaylist().files + } } -- cgit v1.2.3