@@ -18,6 +18,7 @@ import {
1818 customSelfHostedVideoPlayAudioEventName ,
1919 customYoutubePlayEventName ,
2020} from '../lib/video' ;
21+ import { palette } from '../palette' ;
2122import type { VideoPlayerFormat } from '../types/mainMedia' ;
2223import { CardPicture , type Props as CardPictureProps } from './CardPicture' ;
2324import { useConfig } from './ConfigContext' ;
@@ -29,9 +30,18 @@ import type {
2930import { SelfHostedVideoPlayer } from './SelfHostedVideoPlayer' ;
3031import { ophanTrackerWeb } from './YoutubeAtom/eventEmitters' ;
3132
32- const videoContainerStyles = css `
33+ const videoAndBackgroundStyles = css `
34+ position : relative;
35+ display : flex;
36+ justify-content : space-around;
3337 z-index : ${ getZIndex ( 'video-container' ) } ;
38+ background-color : ${ palette ( '--video-background' ) } ;
39+ ` ;
40+
41+ const videoContainerStyles = ( width : number , height : number ) => css `
3442 position : relative;
43+ height : 100% ;
44+ width : ${ ( width / height ) * 80 } %;
3545` ;
3646
3747const cinemagraphContainerStyles = css `
@@ -662,45 +672,47 @@ export const SelfHostedVideo = ({
662672 : undefined ;
663673
664674 return (
665- < figure
666- ref = { setNode }
667- css = { [
668- videoContainerStyles ,
669- isCinemagraph && cinemagraphContainerStyles ,
670- ] }
671- className = { `video-container ${ videoStyle . toLocaleLowerCase ( ) } ` }
672- data-component = "gu-video-loop"
673- >
674- < SelfHostedVideoPlayer
675- sources = { sources }
676- atomId = { atomId }
677- uniqueId = { uniqueId }
678- width = { width }
679- height = { height }
680- videoStyle = { videoStyle }
681- posterImage = { optimisedPosterImage }
682- FallbackImageComponent = { FallbackImageComponent }
683- currentTime = { currentTime }
684- setCurrentTime = { setCurrentTime }
685- ref = { vidRef }
686- isPlayable = { isPlayable }
687- playerState = { playerState }
688- isMuted = { isMuted }
689- handleLoadedMetadata = { handleLoadedMetadata }
690- handleLoadedData = { handleLoadedData }
691- handleCanPlay = { handleCanPlay }
692- handlePlayPauseClick = { handlePlayPauseClick }
693- handleAudioClick = { handleAudioClick }
694- handleKeyDown = { handleKeyDown }
695- handlePause = { handlePause }
696- onError = { onError }
697- AudioIcon = { hasAudio ? AudioIcon : null }
698- preloadPartialData = { preloadPartialData }
699- showPlayIcon = { showPlayIcon }
700- subtitleSize = { subtitleSize }
701- subtitleSource = { subtitleSource }
702- activeCue = { activeCue }
703- />
704- </ figure >
675+ < div css = { videoAndBackgroundStyles } className = "loop-video-container" >
676+ < figure
677+ ref = { setNode }
678+ css = { [
679+ videoContainerStyles ( width , height ) ,
680+ isCinemagraph && cinemagraphContainerStyles ,
681+ ] }
682+ className = { `video-container ${ videoStyle . toLocaleLowerCase ( ) } ` }
683+ data-component = "gu-video-loop"
684+ >
685+ < SelfHostedVideoPlayer
686+ sources = { sources }
687+ atomId = { atomId }
688+ uniqueId = { uniqueId }
689+ width = { width }
690+ height = { height }
691+ videoStyle = { videoStyle }
692+ posterImage = { optimisedPosterImage }
693+ FallbackImageComponent = { FallbackImageComponent }
694+ currentTime = { currentTime }
695+ setCurrentTime = { setCurrentTime }
696+ ref = { vidRef }
697+ isPlayable = { isPlayable }
698+ playerState = { playerState }
699+ isMuted = { isMuted }
700+ handleLoadedMetadata = { handleLoadedMetadata }
701+ handleLoadedData = { handleLoadedData }
702+ handleCanPlay = { handleCanPlay }
703+ handlePlayPauseClick = { handlePlayPauseClick }
704+ handleAudioClick = { handleAudioClick }
705+ handleKeyDown = { handleKeyDown }
706+ handlePause = { handlePause }
707+ onError = { onError }
708+ AudioIcon = { hasAudio ? AudioIcon : null }
709+ preloadPartialData = { preloadPartialData }
710+ showPlayIcon = { showPlayIcon }
711+ subtitleSource = { subtitleSource }
712+ subtitleSize = { subtitleSize }
713+ activeCue = { activeCue }
714+ />
715+ </ figure >
716+ </ div >
705717 ) ;
706718} ;
0 commit comments