From ffacd78f21d4021b3c0f654ff63ef29ca7afcde3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Jun 2021 10:17:47 +0200 Subject: Load embed api resolutions on init --- client/src/standalone/videos/embed-api.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'client/src/standalone') diff --git a/client/src/standalone/videos/embed-api.ts b/client/src/standalone/videos/embed-api.ts index 94e39ec29..75174f2f8 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts @@ -140,12 +140,14 @@ export class PeerTubeEmbedApi { }) // PeerTube specific capabilities - if (this.isWebtorrent()) { this.embed.player.webtorrent().on('autoResolutionUpdate', () => this.loadWebTorrentResolutions()) this.embed.player.webtorrent().on('videoFileUpdate', () => this.loadWebTorrentResolutions()) + + this.loadWebTorrentResolutions() } else { this.embed.player.p2pMediaLoader().on('resolutionChange', () => this.loadP2PMediaLoaderResolutions()) + this.embed.player.p2pMediaLoader().on('resolutionsLoaded', () => this.loadP2PMediaLoaderResolutions()) } this.embed.player.on('volumechange', () => { @@ -207,6 +209,6 @@ export class PeerTubeEmbedApi { } private isWebtorrent () { - return this.embed.player.webtorrent + return !!this.embed.player.webtorrent } } -- cgit v1.2.3