From 6cca7360eb9027e1544f7513df7da4684061ef7e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Jun 2018 16:50:33 +0200 Subject: Reduce bundle sizes --- client/src/assets/player/peertube-videojs-plugin.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'client/src/assets/player/peertube-videojs-plugin.ts') 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' import { renderVideo } from './video-renderer' import './settings-menu-button' import { PeertubePluginOptions, VideoJSComponentInterface, videojsUntyped } from './peertube-videojs-typings' -import { getAverageBandwidth, getStoredMute, getStoredVolume, saveAverageBandwidth, saveMuteInStore, saveVolumeInStore } from './utils' -import minBy from 'lodash-es/minBy' -import maxBy from 'lodash-es/maxBy' +import { + getAverageBandwidth, + getStoredMute, + getStoredVolume, + saveAverageBandwidth, + saveMuteInStore, + saveVolumeInStore, + videoFileMaxByResolution, + videoFileMinByResolution +} from './utils' import * as CacheChunkStore from 'cache-chunk-store' import { PeertubeChunkStore } from './peertube-chunk-store' @@ -339,9 +346,9 @@ class PeerTubePlugin extends Plugin { }) // If the download speed is too bad, return the lowest resolution we have - if (filteredFiles.length === 0) return minBy(this.videoFiles, 'resolution.id') + if (filteredFiles.length === 0) return videoFileMinByResolution(this.videoFiles) - return maxBy(filteredFiles, 'resolution.id') + return videoFileMaxByResolution(filteredFiles) } private getAndSaveActualDownloadSpeed () { -- cgit v1.2.3