Add P2P enabled/disabled in player card
This commit is contained in:
parent
bf1c3c78b0
commit
9576506763
|
@ -193,7 +193,8 @@ export class PeertubePlayerManager {
|
|||
player.stats({
|
||||
videoUUID: options.common.videoUUID,
|
||||
videoIsLive: options.common.isLive,
|
||||
mode
|
||||
mode,
|
||||
p2pEnabled: options.common.p2pEnabled
|
||||
})
|
||||
|
||||
player.on('p2pInfo', (_, data: PlayerNetworkInfo) => {
|
||||
|
|
|
@ -7,6 +7,7 @@ interface StatsCardOptions extends videojs.ComponentOptions {
|
|||
videoUUID: string
|
||||
videoIsLive: boolean
|
||||
mode: 'webtorrent' | 'p2p-media-loader'
|
||||
p2pEnabled: boolean
|
||||
}
|
||||
|
||||
interface PlayerNetworkInfo {
|
||||
|
@ -33,6 +34,7 @@ class StatsCard extends Component {
|
|||
updateInterval: any
|
||||
|
||||
mode: 'webtorrent' | 'p2p-media-loader'
|
||||
p2pEnabled: boolean
|
||||
|
||||
metadataStore: any = {}
|
||||
|
||||
|
@ -200,7 +202,7 @@ class StatsCard extends Component {
|
|||
? `${playerNetworkInfo.totalDownloaded} ⇓ / ${playerNetworkInfo.totalUploaded} ⇑`
|
||||
: undefined
|
||||
const downloadBreakdown = playerNetworkInfo.downloadedFromServer
|
||||
? `${playerNetworkInfo.downloadedFromServer} from server · ${playerNetworkInfo.downloadedFromPeers} from peers`
|
||||
? `${playerNetworkInfo.downloadedFromServer} from servers · ${playerNetworkInfo.downloadedFromPeers} from peers`
|
||||
: undefined
|
||||
|
||||
const bufferProgress = progress !== undefined
|
||||
|
@ -209,6 +211,7 @@ class StatsCard extends Component {
|
|||
|
||||
return `
|
||||
${this.buildElement(player.localize('Player mode'), this.mode || 'HTTP')}
|
||||
${this.buildElement(player.localize('P2P'), player.localize(this.p2pEnabled ? 'enabled' : 'disabled'))}
|
||||
|
||||
${this.buildElement(player.localize('Video UUID'), this.options_.videoUUID)}
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@ const playerKeys = {
|
|||
'Buffer Progress': 'Buffer Progress',
|
||||
'Buffer State': 'Buffer State',
|
||||
'Live Latency': 'Live Latency',
|
||||
'P2P': 'P2P',
|
||||
'enabled': 'enabled',
|
||||
'disabled': 'disabled',
|
||||
' off': ' off',
|
||||
'Player mode': 'Player mode'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue