aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-05 16:15:51 +0200
committerChocobozzz <me@florianbigard.com>2018-04-05 16:15:51 +0200
commita8462c8e3a61f4f7314fe18c0c10cc2946c254d1 (patch)
treeb5330cf0a8c313277f83263724c2a70b2f246c0f /client/src/app
parent3d3441d6c7a5646388ab0a77acad57fdb63b9d32 (diff)
downloadPeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.gz
PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.zst
PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.zip
Automatic resolution according to user bandwidth V1
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 }