Skip to content

Commit

Permalink
conditionally add the Watermark to the basic and cast receiver layout
Browse files Browse the repository at this point in the history
  • Loading branch information
stonko1994 committed Jan 15, 2025
1 parent ca16850 commit 9e83224
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/ts/UIFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export namespace UIFactory {
* @param config The UIConfig object
*/
export function buildCastReceiverUI(player: PlayerAPI, config: UIConfig = {}): UIManager {
return new UIManager(player, castReceiverUILayout(), config);
return new UIManager(player, castReceiverUILayout(config), config);
}

/**
Expand Down Expand Up @@ -309,6 +309,10 @@ function uiLayout(config: UIConfig) {
],
});

const conditionalElements = [
config.includeWatermark ? new Watermark() : null,
].filter((e) => e);

return new UIContainer({
components: [
subtitleOverlay,
Expand All @@ -318,8 +322,8 @@ function uiLayout(config: UIConfig) {
controlBar,
new TitleBar(),
new RecommendationOverlay(),
new Watermark(),
settingsPanel,
...conditionalElements,
new ErrorMessageOverlay(),
],
hideDelay: 2000,
Expand Down Expand Up @@ -543,7 +547,7 @@ function smallScreenAdsUILayout() {
});
}

function castReceiverUILayout() {
function castReceiverUILayout(config: UIConfig) {
let controlBar = new ControlBar({
components: [
new Container({
Expand All @@ -563,14 +567,18 @@ function castReceiverUILayout() {
],
});

const conditionalElements = [
config.includeWatermark ? new Watermark() : null,
].filter((e) => e);

return new CastUIContainer({
components: [
new SubtitleOverlay(),
new BufferingOverlay(),
new PlaybackToggleOverlay(),
new Watermark(),
controlBar,
new TitleBar({ keepHiddenWithoutMetadata: true }),
...conditionalElements,
new ErrorMessageOverlay(),
],
cssClasses: ['ui-cast-receiver'],
Expand Down

0 comments on commit 9e83224

Please sign in to comment.