ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix broken embed in specific cases
Chocobozzzbd045c604305
diff --git a/client/src/standalone/player/src/peertube-player.ts b/client/src/standalone/player/src/peertube-player.tsindex eebe8ec82e..61ccb0ac35 100644--- a/client/src/standalone/player/src/peertube-player.ts+++ b/client/src/standalone/player/src/peertube-player.ts@@ -151,13 +151,15 @@ export class PeerTubePlayer {}setPoster (thumbnails: Thumbnail[]) {+ // window.innerWidth returns sometimes 0 on firefox if we load the page in background+ // So we fallback to screen.availWidth which seems more reliable, at least on desktop+ const getScreenWidth = () => window.innerWidth || screen.availWidth+// Use HTML video element to display posterif (!this.player) {const playerEl = this.options.playerElement()- // window.innerWidth returns sometimes 0 on firefox if we load the page in background- // So we fallback to screen.availWidth which seems more reliable, at least on desktop- const width = playerEl.clientWidth || window.innerWidth || screen.availWidth+ const width = playerEl.clientWidth || getScreenWidth()this.options.playerElement().poster = findAppropriateThumbnail(thumbnails, width, '16:9')?.fileUrl || ''return@@ -165,7 +167,8 @@ export class PeerTubePlayer {// Prefer using player poster APIif (this.player) {- const width = this.player.el().clientWidth || window.innerWidth+ //+ const width = this.player.el().clientWidth || getScreenWidth()this.player.poster(findAppropriateThumbnail(thumbnails, width, '16:9')?.fileUrl || '')}