diff options
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 9babe556a..b54f096b2 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -4,9 +4,16 @@ import { VideoFile } from '../../../../shared/models/videos/video.model' | |||
4 | import { renderVideo } from './video-renderer' | 4 | import { renderVideo } from './video-renderer' |
5 | import './settings-menu-button' | 5 | import './settings-menu-button' |
6 | import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' | 6 | import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' |
7 | import { getAverageBandwidth, getStoredMute, getStoredVolume, saveAverageBandwidth, saveMuteInStore, saveVolumeInStore } from './utils' | 7 | import { |
8 | import minBy from 'lodash-es/minBy' | 8 | getAverageBandwidth, |
9 | import maxBy from 'lodash-es/maxBy' | 9 | getStoredMute, |
10 | getStoredVolume, | ||
11 | saveAverageBandwidth, | ||
12 | saveMuteInStore, | ||
13 | saveVolumeInStore, | ||
14 | videoFileMaxByResolution, | ||
15 | videoFileMinByResolution | ||
16 | } from './utils' | ||
10 | import * as CacheChunkStore from 'cache-chunk-store' | 17 | import * as CacheChunkStore from 'cache-chunk-store' |
11 | import { PeertubeChunkStore } from './peertube-chunk-store' | 18 | import { PeertubeChunkStore } from './peertube-chunk-store' |
12 | 19 | ||
@@ -339,9 +346,9 @@ class PeerTubePlugin extends Plugin { | |||
339 | }) | 346 | }) |
340 | 347 | ||
341 | // If the download speed is too bad, return the lowest resolution we have | 348 | // If the download speed is too bad, return the lowest resolution we have |
342 | if (filteredFiles.length === 0) return minBy(this.videoFiles, 'resolution.id') | 349 | if (filteredFiles.length === 0) return videoFileMinByResolution(this.videoFiles) |
343 | 350 | ||
344 | return maxBy(filteredFiles, 'resolution.id') | 351 | return videoFileMaxByResolution(filteredFiles) |
345 | } | 352 | } |
346 | 353 | ||
347 | private getAndSaveActualDownloadSpeed () { | 354 | private getAndSaveActualDownloadSpeed () { |