ActivityPub-federated video streaming platform using P2P directly in your web browser
Support video.js mainContent attribute
Chocobozzzbedeb18cc325
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.tsindex 033bff093f..9ccb7a4015 100644--- a/client/src/app/+video-watch/video-watch.component.ts+++ b/client/src/app/+video-watch/video-watch.component.ts@@ -854,6 +854,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {theaterButton: true,+ mainContent: true,+controls: urlOptions.controls,controlBar: urlOptions.controlBar,diff --git a/client/src/standalone/player/src/peertube-player.ts b/client/src/standalone/player/src/peertube-player.tsindex bbad0d5f7c..58076793cb 100644--- a/client/src/standalone/player/src/peertube-player.ts+++ b/client/src/standalone/player/src/peertube-player.ts@@ -465,6 +465,8 @@ export class PeerTubePlayer {previousVideo: () => this.currentLoadOptions.previousVideo})+ const autoplay = this.getAutoPlayValue(this.currentLoadOptions.autoplay)+const videojsOptions = {html5,@@ -477,11 +479,15 @@ export class PeerTubePlayer {? this.options.muted: undefined, // Undefined so the player knows it has to check the local storage- autoplay: this.getAutoPlayValue(this.currentLoadOptions.autoplay),+ autoplay,poster: getPoster(),preload: 'none' as 'none',+ // The poster is only worth prioritizing if we actually display it: on autoplay it's hidden as soon as playback+ // starts, so eagerly fetching it would just compete with the video segments+ mainContent: this.options.mainContent === true && autoplay === false,+inactivityTimeout: this.options.inactivityTimeout,playbackRates: [ 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.5, 3 ],diff --git a/client/src/standalone/player/src/types/peertube-player-options.ts b/client/src/standalone/player/src/types/peertube-player-options.tsindex 5ea643f880..ba3400cf21 100644--- a/client/src/standalone/player/src/types/peertube-player-options.ts+++ b/client/src/standalone/player/src/types/peertube-player-options.ts@@ -25,6 +25,9 @@ export type PeerTubePlayerConstructorOptions = {theaterButton: boolean+ // The player is the main content of the page, so its poster is likely the LCP element+ mainContent?: boolean+authorizationHeader: () => stringmetricsUrl: stringdiff --git a/client/src/standalone/player/src/types/peertube-videojs-typings.ts b/client/src/standalone/player/src/types/peertube-videojs-typings.tsindex 0ed053d944..d5f101a876 100644--- a/client/src/standalone/player/src/types/peertube-videojs-typings.ts+++ b/client/src/standalone/player/src/types/peertube-videojs-typings.ts@@ -428,6 +428,9 @@ export type VideojsPlayerOptions = Partial<VideojsPlayer['options_']> & {poster?: stringpreload?: 'none'+ // Load the poster with `loading="eager"` + `fetchpriority="high"` instead of the video.js `lazy`/`auto` defaults+ mainContent?: boolean+plugins?: VideoJSPluginOptionscontrolBar?: {diff --git a/client/src/standalone/videos/shared/player-options-builder.ts b/client/src/standalone/videos/shared/player-options-builder.tsindex 5b4f719225..9e6ce45fc4 100644--- a/client/src/standalone/videos/shared/player-options-builder.ts+++ b/client/src/standalone/videos/shared/player-options-builder.ts@@ -216,6 +216,8 @@ export class PlayerOptionsBuilder {theaterButton: false,+ mainContent: true,+serverUrl: getBackendUrl(),stunServers: serverConfig.webrtc.stunServers,language: navigator.language,