X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Fpeertube-videojs-plugin.ts;h=fc07c35d61eca44fdead9fb29d2d9b21bd8720ec;hb=1a49822c321c34c39faf0411189a7073effa7eb7;hp=fe9fc1a696ffad27cdbe20e10aed5c4842ad93b4;hpb=b7f1747dc75171368df6ea2ab298971a33af56ed;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index fe9fc1a69..fc07c35d6 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts @@ -4,18 +4,17 @@ 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 { isMobile, videoFileMaxByResolution, videoFileMinByResolution } from './utils' +import * as CacheChunkStore from 'cache-chunk-store' +import { PeertubeChunkStore } from './peertube-chunk-store' import { - getAverageBandwidth, + getAverageBandwidthInStore, getStoredMute, - getStoredVolume, isMobile, + getStoredVolume, saveAverageBandwidth, saveMuteInStore, - saveVolumeInStore, - videoFileMaxByResolution, - videoFileMinByResolution -} from './utils' -import * as CacheChunkStore from 'cache-chunk-store' -import { PeertubeChunkStore } from './peertube-chunk-store' + saveVolumeInStore +} from './peertube-player-local-storage' const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin') class PeerTubePlugin extends Plugin { @@ -148,7 +147,7 @@ class PeerTubePlugin extends Plugin { ) { // Automatically choose the adapted video file if (videoFile === undefined) { - const savedAverageBandwidth = getAverageBandwidth() + const savedAverageBandwidth = getAverageBandwidthInStore() videoFile = savedAverageBandwidth ? this.getAppropriateFile(savedAverageBandwidth) : this.pickAverageVideoFile() @@ -467,7 +466,9 @@ class PeerTubePlugin extends Plugin { return this.trigger('torrentInfo', { downloadSpeed: this.torrent.downloadSpeed, numPeers: this.torrent.numPeers, - uploadSpeed: this.torrent.uploadSpeed + uploadSpeed: this.torrent.uploadSpeed, + downloaded: this.torrent.downloaded, + uploaded: this.torrent.uploaded }) }, this.CONSTANTS.INFO_SCHEDULER) } @@ -502,6 +503,8 @@ class PeerTubePlugin extends Plugin { } private addViewToVideo () { + if (!this.videoViewUrl) return Promise.resolve(undefined) + return fetch(this.videoViewUrl, { method: 'POST' }) }