@@ -57,6 +57,7 @@ const App = ({
5757 const [ breadCrumbs , setBreadCrumbs ] = useState < any > ( ) ;
5858 const [ isShowMoreContent , setIsShowMoreContent ] = useState ( false ) ;
5959 const [ mimeType , setMemetype ] = useState ( '' ) ;
60+ const [ isVideo , setIsVideo ] = useState ( false ) ;
6061 const [ isDownloading , setIsDownloading ] = useState ( false ) ;
6162 const [ showSuccessMessage , setShowSuccessMessage ] = useState ( false ) ;
6263 const [ showJotFormModal , setShowJotFormModal ] = useState ( false ) ;
@@ -66,6 +67,31 @@ const App = ({
6667 mimeType : string ;
6768 } | null > ( null ) ;
6869
70+ const [ isPortrait , setIsPortrait ] = useState ( false ) ;
71+
72+ useEffect ( ( ) => {
73+ setIsVideo ( mimeType == 'video/mp4' || mimeType == 'video/webm' ) ;
74+ } , [ mimeType ] ) ;
75+
76+ // Check if device is in portrait mode (width < height)
77+ useEffect ( ( ) => {
78+ const checkOrientation = ( ) => {
79+ setIsPortrait ( window . innerWidth < window . innerHeight ) ;
80+ } ;
81+
82+ // Check on mount
83+ checkOrientation ( ) ;
84+
85+ // Listen for resize and orientation changes
86+ window . addEventListener ( 'resize' , checkOrientation ) ;
87+ window . addEventListener ( 'orientationchange' , checkOrientation ) ;
88+
89+ return ( ) => {
90+ window . removeEventListener ( 'resize' , checkOrientation ) ;
91+ window . removeEventListener ( 'orientationchange' , checkOrientation ) ;
92+ } ;
93+ } , [ ] ) ;
94+
6995 let activeLink = null ;
7096 if ( typeof window !== 'undefined' ) {
7197 const searchParams = new URLSearchParams ( window . location . search ) ;
@@ -403,9 +429,13 @@ const App = ({
403429 unitId = { unitId }
404430 mimeType = { mimeType }
405431 { ..._config ?. player }
432+ isPortrait = { isPortrait }
433+ isVideo = { isVideo }
406434 />
407435 { item ?. content ?. artifactUrl &&
436+
408437 isDownloadableMimeType ( item ?. content ?. mimeType || mimeType ) &&
438+ ( ! isPortrait || ( isVideo && ! isPortrait ) ) &&
409439 isDownloadContentEnabled ( ) && (
410440 < Box
411441 sx = { {
@@ -457,7 +487,8 @@ const App = ({
457487
458488 < Grid
459489 sx = { {
460- display : isShowMoreContent ? 'flex' : 'none' ,
490+ display : isShowMoreContent && ( ! isPortrait || ( isVideo && ! isPortrait ) ) ? 'flex' : 'none' ,
491+
461492 flexDirection : 'column' ,
462493 flex : { xs : 1 , sm : 1 , md : 9 } ,
463494 } }
@@ -615,13 +646,14 @@ const PlayerBox = ({
615646 trackable,
616647 isShowMoreContent,
617648 mimeType,
649+ isPortrait,
650+ isVideo
618651} : any ) => {
619652 const router = useRouter ( ) ;
620653 const { t } = useTranslation ( ) ;
621654 const theme = useTheme ( ) ;
622655 const isMobile = useMediaQuery ( theme . breakpoints . down ( 'md' ) ) ;
623656 const [ play , setPlay ] = useState ( false ) ;
624- const [ isPortrait , setIsPortrait ] = useState ( false ) ;
625657
626658 // Determine aspectRatio based on mimeType and mobile mode
627659 const getAspectRatio = ( ) => {
@@ -631,25 +663,6 @@ const PlayerBox = ({
631663 return '16/9' ;
632664 } ;
633665
634- // Check if device is in portrait mode (width < height)
635- useEffect ( ( ) => {
636- const checkOrientation = ( ) => {
637- setIsPortrait ( window . innerWidth < window . innerHeight ) ;
638- } ;
639-
640- // Check on mount
641- checkOrientation ( ) ;
642-
643- // Listen for resize and orientation changes
644- window . addEventListener ( 'resize' , checkOrientation ) ;
645- window . addEventListener ( 'orientationchange' , checkOrientation ) ;
646-
647- return ( ) => {
648- window . removeEventListener ( 'resize' , checkOrientation ) ;
649- window . removeEventListener ( 'orientationchange' , checkOrientation ) ;
650- } ;
651- } , [ ] ) ;
652-
653666 useEffect ( ( ) => {
654667 if ( checkAuth ( ) || userIdLocalstorageName ) {
655668 setPlay ( true ) ;
@@ -716,9 +729,7 @@ const PlayerBox = ({
716729 width : isShowMoreContent
717730 ? '100%'
718731 : { xs : '100%' , sm : '100%' , md : '90%' , lg : '80%' , xl : '70%' } ,
719- p :0 ,
720- ml :- 10 ,
721- mr :- 5 ,
732+ ...( isPortrait && isVideo ? { p :0 , ml :- 10 , mr :- 5 } : { } ) ,
722733 } }
723734 >
724735 < iframe
@@ -741,8 +752,8 @@ const PlayerBox = ({
741752 aspectRatio : getAspectRatio ( ) ,
742753 } }
743754 allowFullScreen
744- width = { "110%" }
745- height = { isPortrait ? '300%' : '100%' }
755+ width = { isPortrait && isVideo ? "110%" : "100 %"}
756+ height = { isPortrait && isVideo ? '300%' : '100%' }
746757 title = "Embedded Localhost"
747758 allow = "accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture"
748759 frameBorder = "0"
0 commit comments