aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/video/video-details.model.ts18
1 files changed, 1 insertions, 17 deletions
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index 9fc326beb..a1f7207a2 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -3,8 +3,7 @@ import {
3 VideoChannel, 3 VideoChannel,
4 VideoDetails as VideoDetailsServerModel, 4 VideoDetails as VideoDetailsServerModel,
5 VideoFile, 5 VideoFile,
6 VideoPrivacy, 6 VideoPrivacy
7 VideoResolution
8} from '../../../../../shared' 7} from '../../../../../shared'
9import { Account } from '../../../../../shared/models/actors' 8import { Account } from '../../../../../shared/models/actors'
10import { VideoConstant } from '../../../../../shared/models/videos/video.model' 9import { VideoConstant } from '../../../../../shared/models/videos/video.model'
@@ -39,21 +38,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
39 this.buildLikeAndDislikePercents() 38 this.buildLikeAndDislikePercents()
40 } 39 }
41 40
42 getAppropriateMagnetUri (actualDownloadSpeed = 0) {
43 if (this.files === undefined || this.files.length === 0) return ''
44 if (this.files.length === 1) return this.files[0].magnetUri
45
46 // Find first video that is good for our download speed (remember they are sorted)
47 let betterResolutionFile = this.files.find(f => actualDownloadSpeed > (f.size / this.duration))
48
49 // If the download speed is too bad, return the lowest resolution we have
50 if (betterResolutionFile === undefined) {
51 betterResolutionFile = this.files.find(f => f.resolution.id === VideoResolution.H_240P)
52 }
53
54 return betterResolutionFile.magnetUri
55 }
56
57 isRemovableBy (user: AuthUser) { 41 isRemovableBy (user: AuthUser) {
58 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) 42 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
59 } 43 }