import videojs from 'video.js'
+import { secondsToTime } from '@shared/core-utils'
import { PlayerNetworkInfo as EventPlayerNetworkInfo } from '../peertube-videojs-typings'
-import { bytes, secondsToTime } from '../utils'
+import { bytes } from '../utils'
interface StatsCardOptions extends videojs.ComponentOptions {
videoUUID: string
this.container.style.display = 'block'
this.updateInterval = setInterval(async () => {
try {
- const options = this.mode === 'webtorrent'
- ? await this.buildWebTorrentOptions()
- : await this.buildHLSOptions()
+ const options = this.mode === 'p2p-media-loader'
+ ? await this.buildHLSOptions()
+ : await this.buildWebTorrentOptions() // Default
this.list.innerHTML = this.getListTemplate(options)
} catch (err) {
const duration = player.duration()
- let volume = `${player.volume() * 100}`
+ let volume = `${Math.round(player.volume() * 100)}`
if (player.muted()) volume += ' (muted)'
const networkActivity = playerNetworkInfo.downloadSpeed
: undefined
return `
+ ${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')}
+
${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)}
${this.buildElement(player.localize('Viewport / Frames'), frames)}