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 {
) {
// Automatically choose the adapted video file
if (videoFile === undefined) {
- const savedAverageBandwidth = getAverageBandwidth()
+ const savedAverageBandwidth = getAverageBandwidthInStore()
videoFile = savedAverageBandwidth
? this.getAppropriateFile(savedAverageBandwidth)
: this.pickAverageVideoFile()
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)
}
}
private addViewToVideo () {
+ if (!this.videoViewUrl) return Promise.resolve(undefined)
+
return fetch(this.videoViewUrl, { method: 'POST' })
}