diff options
Diffstat (limited to 'client/src/assets/player')
4 files changed, 15 insertions, 2 deletions
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts index f8116f4bc..e97925ab5 100644 --- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts | |||
@@ -153,6 +153,7 @@ class P2pMediaLoaderPlugin extends Plugin { | |||
153 | this.statsHTTPBytes.pendingUpload = [] | 153 | this.statsHTTPBytes.pendingUpload = [] |
154 | 154 | ||
155 | return this.player.trigger('p2pInfo', { | 155 | return this.player.trigger('p2pInfo', { |
156 | source: 'p2p-media-loader', | ||
156 | http: { | 157 | http: { |
157 | downloadSpeed: httpDownloadSpeed, | 158 | downloadSpeed: httpDownloadSpeed, |
158 | uploadSpeed: httpUploadSpeed, | 159 | uploadSpeed: httpUploadSpeed, |
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts index a359b8595..f1e614499 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/peertube-videojs-typings.ts | |||
@@ -175,6 +175,8 @@ type AutoResolutionUpdateData = { | |||
175 | } | 175 | } |
176 | 176 | ||
177 | type PlayerNetworkInfo = { | 177 | type PlayerNetworkInfo = { |
178 | source: 'webtorrent' | 'p2p-media-loader' | ||
179 | |||
178 | http: { | 180 | http: { |
179 | downloadSpeed: number | 181 | downloadSpeed: number |
180 | uploadSpeed: number | 182 | uploadSpeed: number |
diff --git a/client/src/assets/player/videojs-components/p2p-info-button.ts b/client/src/assets/player/videojs-components/p2p-info-button.ts index db6806fed..b1f7cd751 100644 --- a/client/src/assets/player/videojs-components/p2p-info-button.ts +++ b/client/src/assets/player/videojs-components/p2p-info-button.ts | |||
@@ -84,8 +84,17 @@ class P2pInfoButton extends Button { | |||
84 | const totalUploaded = bytes(p2pStats.uploaded + httpStats.uploaded) | 84 | const totalUploaded = bytes(p2pStats.uploaded + httpStats.uploaded) |
85 | const numPeers = p2pStats.numPeers | 85 | const numPeers = p2pStats.numPeers |
86 | 86 | ||
87 | subDivWebtorrent.title = this.player().localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' + | 87 | subDivWebtorrent.title = this.player().localize('Total downloaded: ') + totalDownloaded.join(' ') + '\n' |
88 | this.player().localize('Total uploaded: ' + totalUploaded.join(' ')) | 88 | |
89 | if (data.source === 'p2p-media-loader') { | ||
90 | const downloadedFromServer = bytes(httpStats.downloaded).join(' ') | ||
91 | const downloadedFromPeers = bytes(p2pStats.downloaded).join(' ') | ||
92 | |||
93 | subDivWebtorrent.title += | ||
94 | '* ' + this.player().localize('From the server: ') + downloadedFromServer + '\n' + | ||
95 | '* ' + this.player().localize('From peers: ') + downloadedFromPeers + '\n' | ||
96 | } | ||
97 | subDivWebtorrent.title += this.player().localize('Total uploaded: ') + totalUploaded.join(' ') | ||
89 | 98 | ||
90 | downloadSpeedNumber.textContent = downloadSpeed[ 0 ] | 99 | downloadSpeedNumber.textContent = downloadSpeed[ 0 ] |
91 | downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ] | 100 | downloadSpeedUnit.textContent = ' ' + downloadSpeed[ 1 ] |
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index 782c91cbd..96ba497a0 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts | |||
@@ -487,6 +487,7 @@ class WebTorrentPlugin extends Plugin { | |||
487 | if (this.webtorrent.downloadSpeed !== 0) this.downloadSpeeds.push(this.webtorrent.downloadSpeed) | 487 | if (this.webtorrent.downloadSpeed !== 0) this.downloadSpeeds.push(this.webtorrent.downloadSpeed) |
488 | 488 | ||
489 | return this.player.trigger('p2pInfo', { | 489 | return this.player.trigger('p2pInfo', { |
490 | source: 'webtorrent', | ||
490 | http: { | 491 | http: { |
491 | downloadSpeed: 0, | 492 | downloadSpeed: 0, |
492 | uploadSpeed: 0, | 493 | uploadSpeed: 0, |