diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-12-05 18:43:15 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-12-05 18:43:15 +0100 |
commit | a06a31c75c0cd4d337e3e193c670a77cabcd9507 (patch) | |
tree | 822371bb0233e9f161a52eeb3e77ae144c349b1d /client | |
parent | f3aaa9a95cc2b61f1f255472d7014d08faa66561 (diff) | |
download | PeerTube-a06a31c75c0cd4d337e3e193c670a77cabcd9507.tar.gz PeerTube-a06a31c75c0cd4d337e3e193c670a77cabcd9507.tar.zst PeerTube-a06a31c75c0cd4d337e3e193c670a77cabcd9507.zip |
Fix player control bar when video is not loaded
Diffstat (limited to 'client')
-rw-r--r-- | client/src/assets/player/peertube-videojs-plugin.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts index 977455bff..add4e521e 100644 --- a/client/src/assets/player/peertube-videojs-plugin.ts +++ b/client/src/assets/player/peertube-videojs-plugin.ts | |||
@@ -117,10 +117,12 @@ const WebTorrentButton = videojsUntyped.extend(Button, { | |||
117 | 117 | ||
118 | createEl: function () { | 118 | createEl: function () { |
119 | const div = document.createElement('div') | 119 | const div = document.createElement('div') |
120 | const subDiv = document.createElement('div') | ||
121 | div.appendChild(subDiv) | ||
120 | 122 | ||
121 | const downloadIcon = document.createElement('span') | 123 | const downloadIcon = document.createElement('span') |
122 | downloadIcon.classList.add('icon', 'icon-download') | 124 | downloadIcon.classList.add('icon', 'icon-download') |
123 | div.appendChild(downloadIcon) | 125 | subDiv.appendChild(downloadIcon) |
124 | 126 | ||
125 | const downloadSpeedText = document.createElement('span') | 127 | const downloadSpeedText = document.createElement('span') |
126 | downloadSpeedText.classList.add('download-speed-text') | 128 | downloadSpeedText.classList.add('download-speed-text') |
@@ -129,11 +131,11 @@ const WebTorrentButton = videojsUntyped.extend(Button, { | |||
129 | const downloadSpeedUnit = document.createElement('span') | 131 | const downloadSpeedUnit = document.createElement('span') |
130 | downloadSpeedText.appendChild(downloadSpeedNumber) | 132 | downloadSpeedText.appendChild(downloadSpeedNumber) |
131 | downloadSpeedText.appendChild(downloadSpeedUnit) | 133 | downloadSpeedText.appendChild(downloadSpeedUnit) |
132 | div.appendChild(downloadSpeedText) | 134 | subDiv.appendChild(downloadSpeedText) |
133 | 135 | ||
134 | const uploadIcon = document.createElement('span') | 136 | const uploadIcon = document.createElement('span') |
135 | uploadIcon.classList.add('icon', 'icon-upload') | 137 | uploadIcon.classList.add('icon', 'icon-upload') |
136 | div.appendChild(uploadIcon) | 138 | subDiv.appendChild(uploadIcon) |
137 | 139 | ||
138 | const uploadSpeedText = document.createElement('span') | 140 | const uploadSpeedText = document.createElement('span') |
139 | uploadSpeedText.classList.add('upload-speed-text') | 141 | uploadSpeedText.classList.add('upload-speed-text') |
@@ -142,19 +144,19 @@ const WebTorrentButton = videojsUntyped.extend(Button, { | |||
142 | const uploadSpeedUnit = document.createElement('span') | 144 | const uploadSpeedUnit = document.createElement('span') |
143 | uploadSpeedText.appendChild(uploadSpeedNumber) | 145 | uploadSpeedText.appendChild(uploadSpeedNumber) |
144 | uploadSpeedText.appendChild(uploadSpeedUnit) | 146 | uploadSpeedText.appendChild(uploadSpeedUnit) |
145 | div.appendChild(uploadSpeedText) | 147 | subDiv.appendChild(uploadSpeedText) |
146 | 148 | ||
147 | const peersText = document.createElement('span') | 149 | const peersText = document.createElement('span') |
148 | peersText.textContent = ' peers' | 150 | peersText.textContent = ' peers' |
149 | peersText.classList.add('peers-text') | 151 | peersText.classList.add('peers-text') |
150 | const peersNumber = document.createElement('span') | 152 | const peersNumber = document.createElement('span') |
151 | peersNumber.classList.add('peers-number') | 153 | peersNumber.classList.add('peers-number') |
152 | div.appendChild(peersNumber) | 154 | subDiv.appendChild(peersNumber) |
153 | div.appendChild(peersText) | 155 | subDiv.appendChild(peersText) |
154 | 156 | ||
155 | div.className = 'vjs-webtorrent' | 157 | div.className = 'vjs-webtorrent' |
156 | // Hide the stats before we get the info | 158 | // Hide the stats before we get the info |
157 | div.style.display = 'none' | 159 | subDiv.style.display = 'none' |
158 | 160 | ||
159 | this.player_.on('torrentInfo', (event, data) => { | 161 | this.player_.on('torrentInfo', (event, data) => { |
160 | const downloadSpeed = bytes(data.downloadSpeed) | 162 | const downloadSpeed = bytes(data.downloadSpeed) |
@@ -169,7 +171,7 @@ const WebTorrentButton = videojsUntyped.extend(Button, { | |||
169 | 171 | ||
170 | peersNumber.textContent = numPeers | 172 | peersNumber.textContent = numPeers |
171 | 173 | ||
172 | div.style.display = 'block' | 174 | subDiv.style.display = 'block' |
173 | }) | 175 | }) |
174 | 176 | ||
175 | return div | 177 | return div |