diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-05 16:15:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-05 16:15:51 +0200 |
commit | a8462c8e3a61f4f7314fe18c0c10cc2946c254d1 (patch) | |
tree | b5330cf0a8c313277f83263724c2a70b2f246c0f /client/src/assets/player/utils.ts | |
parent | 3d3441d6c7a5646388ab0a77acad57fdb63b9d32 (diff) | |
download | PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.gz PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.tar.zst PeerTube-a8462c8e3a61f4f7314fe18c0c10cc2946c254d1.zip |
Automatic resolution according to user bandwidth V1
Diffstat (limited to 'client/src/assets/player/utils.ts')
-rw-r--r-- | client/src/assets/player/utils.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts index 7a99dba1a..f5407ef60 100644 --- a/client/src/assets/player/utils.ts +++ b/client/src/assets/player/utils.ts | |||
@@ -36,6 +36,18 @@ function getStoredMute () { | |||
36 | return undefined | 36 | return undefined |
37 | } | 37 | } |
38 | 38 | ||
39 | function getAverageBandwidth () { | ||
40 | const value = getLocalStorage('average-bandwidth') | ||
41 | if (value !== null && value !== undefined) { | ||
42 | const valueNumber = parseInt(value, 10) | ||
43 | if (isNaN(valueNumber)) return undefined | ||
44 | |||
45 | return valueNumber | ||
46 | } | ||
47 | |||
48 | return undefined | ||
49 | } | ||
50 | |||
39 | function saveVolumeInStore (value: number) { | 51 | function saveVolumeInStore (value: number) { |
40 | return setLocalStorage('volume', value.toString()) | 52 | return setLocalStorage('volume', value.toString()) |
41 | } | 53 | } |
@@ -44,10 +56,16 @@ function saveMuteInStore (value: boolean) { | |||
44 | return setLocalStorage('mute', value.toString()) | 56 | return setLocalStorage('mute', value.toString()) |
45 | } | 57 | } |
46 | 58 | ||
59 | function saveAverageBandwidth (value: number) { | ||
60 | return setLocalStorage('average-bandwidth', value.toString()) | ||
61 | } | ||
62 | |||
47 | export { | 63 | export { |
48 | toTitleCase, | 64 | toTitleCase, |
49 | getStoredVolume, | 65 | getStoredVolume, |
50 | saveVolumeInStore, | 66 | saveVolumeInStore, |
67 | saveAverageBandwidth, | ||
68 | getAverageBandwidth, | ||
51 | saveMuteInStore, | 69 | saveMuteInStore, |
52 | getStoredMute, | 70 | getStoredMute, |
53 | bytes | 71 | bytes |