Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Faster player ratio change on video update

Chocobozzz9808b179a573
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index c7c36103a6..90524ebb57 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -225,11 +225,19 @@ class PeerTubePlugin extends Plugin {
const defaultRatio = getComputedStyle(this.player.el()).getPropertyValue(this.options.autoPlayerRatio.cssRatioVariable)
- if (this.options.videoRatio()) {
+ const updateFromOptions = () => {
+ if (!this.options.videoRatio()) return
+
this.adaptPlayerFromRatio({ ratio: this.options.videoRatio(), defaultRatio })
}
+ updateFromOptions()
+
+ this.player.on('video-change', () => updateFromOptions())
+
this.player.on('video-ratio-changed', (_event, data: { ratio: number }) => {
+ if (this.options.videoRatio()) return
+
this.adaptPlayerFromRatio({ ratio: data.ratio, defaultRatio })
})
}