diff options
Diffstat (limited to 'client/src/standalone/videos')
-rw-r--r-- | client/src/standalone/videos/embed-api.ts | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/client/src/standalone/videos/embed-api.ts b/client/src/standalone/videos/embed-api.ts index b5c9da431..8443cb7e9 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts | |||
@@ -139,15 +139,8 @@ export class PeerTubeEmbedApi { | |||
139 | }) | 139 | }) |
140 | 140 | ||
141 | // PeerTube specific capabilities | 141 | // PeerTube specific capabilities |
142 | if (this.isWebtorrent()) { | 142 | this.embed.player.peertubeResolutions().on('resolutionsAdded', () => this.loadResolutions()) |
143 | this.embed.player.webtorrent().on('autoResolutionUpdate', () => this.loadWebTorrentResolutions()) | 143 | this.embed.player.peertubeResolutions().on('resolutionChanged', () => this.loadResolutions()) |
144 | this.embed.player.webtorrent().on('videoFileUpdate', () => this.loadWebTorrentResolutions()) | ||
145 | |||
146 | this.loadWebTorrentResolutions() | ||
147 | } else { | ||
148 | this.embed.player.p2pMediaLoader().on('resolutionChange', () => this.loadP2PMediaLoaderResolutions()) | ||
149 | this.embed.player.p2pMediaLoader().on('resolutionsLoaded', () => this.loadP2PMediaLoaderResolutions()) | ||
150 | } | ||
151 | 144 | ||
152 | this.embed.player.on('volumechange', () => { | 145 | this.embed.player.on('volumechange', () => { |
153 | this.channel.notify({ | 146 | this.channel.notify({ |
@@ -183,23 +176,15 @@ export class PeerTubeEmbedApi { | |||
183 | }) | 176 | }) |
184 | } | 177 | } |
185 | 178 | ||
186 | private loadP2PMediaLoaderResolutions () { | 179 | private loadResolutions () { |
187 | this.resolutions = [] | 180 | this.resolutions = this.embed.player.peertubeResolutions().getResolutions() |
188 | 181 | .map(r => ({ | |
189 | const qualityLevels = this.embed.player.qualityLevels() | 182 | id: r.id, |
190 | const currentResolutionId = this.embed.player.qualityLevels().selectedIndex | 183 | label: r.height + 'p', |
191 | 184 | active: r.selected, | |
192 | for (let i = 0; i < qualityLevels.length; i++) { | 185 | width: r.width, |
193 | const level = qualityLevels[i] | 186 | height: r.height |
194 | 187 | })) | |
195 | this.resolutions.push({ | ||
196 | id: level.id, | ||
197 | label: level.height + 'p', | ||
198 | active: level.id === currentResolutionId, | ||
199 | width: level.width, | ||
200 | height: level.height | ||
201 | }) | ||
202 | } | ||
203 | 188 | ||
204 | this.channel.notify({ | 189 | this.channel.notify({ |
205 | method: 'resolutionUpdate', | 190 | method: 'resolutionUpdate', |