Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hls layout for mweb #2637

Merged
merged 19 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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 @@ -86,7 +86,7 @@ export const Chat = () => {
isLandscapeStream: false,
isChatEnabled: true,
},
() => ({ bottom: '$19', right: '$8' }),
() => ({ bottom: '$20', right: '$8' }),
)
.otherwise(() => ({})),
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
<Flex>
<ChatSelectorContainer />
{canDisableChat && isMobile && isOverlayChat ? (
<Flex align="center" justify="end" css={{ mb: '$4' }}>
<Flex align="center" justify="end" css={{ mb: '$4' }} onClick={e => e.stopPropagation()}>
<Popover.Root>
<Popover.Trigger asChild>
<IconButton css={{ border: '1px solid $border_bright' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { Box, Flex } from '../../Layout';
import { useHMSPrebuiltContext } from '../AppContext';
import { VideoStreamingSection } from '../layouts/VideoStreamingSection';
// @ts-ignore: No implicit Any
import { EmojiReaction } from './EmojiReaction';
// @ts-ignore: No implicit Any
import FullPageProgress from './FullPageProgress';
import { Header } from './Header';
import { PreviousRoleInMetadata } from './PreviousRoleInMetadata';
Expand Down Expand Up @@ -195,12 +197,22 @@ export const ConferenceScreen = () => {
alignItems: 'center',
pr: '$4',
pb: '$4',
position: 'relative',
}}
justify="end"
gap="1"
>
{noAVPermissions ? <RaiseHand /> : null}
<MoreSettings elements={screenProps.elements} screenType={screenProps.screenType} />
<Box
css={{
position: 'absolute',
bottom: '100%',
mb: '$4',
}}
>
<EmojiReaction />
</Box>
</Flex>
)}
<RoleChangeRequestModal />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { EMOJI_REACTION_TYPE } from '../common/constants';

init({ data });

export const EmojiReaction = () => {
export const EmojiReaction = ({ showCard = false }) => {
const [open, setOpen] = useState(false);
const isConnected = useHMSStore(selectIsConnectedToRoom);
useDropdownList({ open: open, name: 'EmojiReaction' });
Expand Down Expand Up @@ -68,7 +68,7 @@ export const EmojiReaction = () => {
return null;
}

if ((isMobile || isLandscape) && !(isLandscapeStream || isMobileHLSStream)) {
if (showCard) {
return <EmojiCard sendReaction={sendReaction} />;
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const DropdownWrapper = ({ children }: { children: React.ReactNode }) => {
if (React.Children.toArray(children).length === 0) {
return null;
}
React.Children.map(children, child => {
console.log({ child });
});
return (
<Dropdown.Root open={openOptions} onOpenChange={setOpenOptions}>
<Dropdown.Trigger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React, { forwardRef } from 'react';
import { useMedia } from 'react-use';
import { config, Flex } from '../../../';
import { useIsLandscape } from '../../common/hooks';
import { Flex } from '../../../Layout';

export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
const isLandscape = useIsLandscape();
const isMobile = useMedia(config.media.md);
return (
<Flex
data-testid="hms-video"
css={{
size: '100%',
position: 'relative',
justifyContent: 'center',
'@md': {
height: 'auto',
'& video': {
height: '$60 !important',
},
},
'& video::cue': {
color: 'white',
whiteSpace: 'pre-line',
Expand All @@ -34,13 +37,12 @@ export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
>
<video
style={{
flex: '1 1 0',
margin: '0 auto',
minHeight: '0',
objectFit: 'contain',
width: 'inherit',
height: isLandscape || isMobile ? '100%' : '',
position: isLandscape || isMobile ? 'absolute' : '',
width: 'auto',
height: 'auto',
maxWidth: '100%',
maxHeight: '100%',
}}
ref={videoRef}
playsInline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export const MwebOptions = ({
mx: '$4',
}}
>
<EmojiReaction />
<EmojiReaction showCard />
</Box>
)}
{showRecordingOn && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import { useMedia } from 'react-use';
import { match, P } from 'ts-pattern';
import { RefreshIcon } from '@100mslive/react-icons';
import { Button } from '../../Button';
import { Box, Flex } from '../../Layout';
Expand All @@ -22,21 +23,26 @@ export const MwebLandscapePrompt = () => {
}

if (!window.screen?.orientation) {
setShowMwebLandscapePrompt(isLandscape);
setShowMwebLandscapePrompt(isLandscape && !isLandscapeHLSStream);
return;
}
const handleRotation = () => {
const angle = window.screen.orientation.angle;
const type = window.screen.orientation.type || '';
// Angle check needed to diff bw mobile and desktop
setShowMwebLandscapePrompt(angle ? angle >= 90 && type.includes('landscape') : isLandscape);
setShowMwebLandscapePrompt(
match({ angle, isLandscapeHLSStream, isLandscape, type })
.with({ isLandscapeHLSStream }, () => false)
.with({ angle: P.when(angle => angle && angle >= 90) }, ({ type }) => type.includes('landscape'))
.otherwise(() => isLandscape),
);
};
handleRotation();
window.screen.orientation.addEventListener('change', handleRotation);
return () => {
window.screen.orientation.removeEventListener('change', handleRotation);
};
}, [isLandscape]);
}, [isLandscape, isLandscapeHLSStream]);

if (isLandscapeHLSStream) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ const ParticipantCount = ({ count }: { count: number }) => {

export const SidePaneTabs = React.memo<{
active: 'Participants | Chat';
hideControls?: boolean;
hideTab?: boolean;
}>(({ active = SIDE_PANE_OPTIONS.CHAT, hideControls, hideTab = false }) => {
}>(({ active = SIDE_PANE_OPTIONS.CHAT, hideTab = false }) => {
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
const resetSidePane = useSidepaneReset();
Expand Down Expand Up @@ -85,7 +84,6 @@ export const SidePaneTabs = React.memo<{
css={{
color: '$on_primary_high',
h: '100%',
marginTop: hideControls && isOverlayChat ? '$17' : '0',
transition: 'margin 0.3s ease-in-out',
position: 'relative',
}}
Expand All @@ -103,7 +101,6 @@ export const SidePaneTabs = React.memo<{
css={{
color: '$on_primary_high',
h: '100%',
marginTop: hideControls && isOverlayChat ? '$17' : '0',
transition: 'margin 0.3s ease-in-out',
}}
>
Expand Down
Loading
Loading