Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
customYoutubePlayEventName,
} from '../lib/video';
import { palette } from '../palette';
import type { RoleType } from '../types/content';
import type { VideoPlayerFormat } from '../types/mainMedia';
import { CardPicture, type Props as CardPictureProps } from './CardPicture';
import { useConfig } from './ConfigContext';
Expand Down Expand Up @@ -245,6 +246,7 @@ type Props = {
*/
containerAspectRatioMobile?: number;
containerAspectRatioDesktop?: number;
role?: RoleType;
};

export const SelfHostedVideo = ({
Expand All @@ -269,6 +271,7 @@ export const SelfHostedVideo = ({
maxAspectRatio,
containerAspectRatioMobile,
containerAspectRatioDesktop,
role,
}: Props) => {
const adapted = useShouldAdapt();
const { renderingTarget } = useConfig();
Expand Down Expand Up @@ -778,7 +781,9 @@ export const SelfHostedVideo = ({
isVideoCroppedAtLeftRight,
containerAspectRatioDesktop,
)}
className={`video-container ${videoStyle.toLocaleLowerCase()}`}
className={`video-container ${videoStyle.toLocaleLowerCase()} ${
role === 'immersive' ? 'element-video-immersive' : ''
}`}
data-component="gu-video-loop"
>
<SelfHostedVideoPlayer
Expand Down
5 changes: 4 additions & 1 deletion dotcom-rendering/src/components/SelfHostedVideoInArticle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getFirstVideoAsset,
getSubtitleAsset,
} from '../lib/video';
import type { MediaAtomBlockElement } from '../types/content';
import type { MediaAtomBlockElement, RoleType } from '../types/content';
import type { VideoPlayerFormat } from '../types/mainMedia';
import { Caption } from './Caption';
import { Island } from './Island';
Expand All @@ -16,13 +16,15 @@ type SelfHostedVideoInArticleProps = {
format: ArticleFormat;
isMainMedia: boolean;
videoStyle: VideoPlayerFormat;
role?: RoleType;
};

export const SelfHostedVideoInArticle = ({
element,
format,
isMainMedia,
videoStyle,
role = 'inline',
}: SelfHostedVideoInArticleProps) => {
const posterImageUrl = element.posterImage?.[0]?.url;
const caption = element.title;
Expand Down Expand Up @@ -53,6 +55,7 @@ export const SelfHostedVideoInArticle = ({
videoStyle={videoStyle}
uniqueId={element.id}
width={firstVideoAsset?.dimensions?.width ?? 500}
role={role}
/>
</Island>
{!!caption && (
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/frontend/schemas/feArticle.json
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,9 @@
},
"videoPlayerFormat": {
"$ref": "#/definitions/VideoPlayerFormat"
},
"role": {
"$ref": "#/definitions/RoleType"
}
},
"required": [
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/lib/renderElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ export const renderElement = ({
format={format}
isMainMedia={isMainMedia}
videoStyle={element.videoPlayerFormat}
role={element.role}
/>
);
} else {
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/model/block-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,9 @@
},
"videoPlayerFormat": {
"$ref": "#/definitions/VideoPlayerFormat"
},
"role": {
"$ref": "#/definitions/RoleType"
}
},
"required": [
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/types/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ export interface MediaAtomBlockElement {
title?: string;
duration?: number;
videoPlayerFormat?: VideoPlayerFormat;
role?: RoleType;
}

export interface MultiImageBlockElement {
Expand Down
Loading