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

PR for main to dev backmerge #1910

Merged
merged 6 commits into from
Sep 13, 2023
Merged
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
4 changes: 2 additions & 2 deletions apps/100ms-custom-app/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions apps/100ms-web/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hls-player/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hls-stats/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hms-noise-suppression/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/hms-video-store/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/hms-video-web/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions packages/hms-video-web/src/media/settings/HMSVideoTrackSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IAnalyticsPropertiesProvider } from '../../analytics/IAnalyticsPropertiesProvider';
import { HMSFacingMode, HMSVideoCodec, HMSVideoTrackSettings as IHMSVideoTrackSettings } from '../../interfaces';
import { isMobile } from '../../utils/support';

export class HMSVideoTrackSettingsBuilder {
private _width?: number = 320;
Expand Down Expand Up @@ -115,9 +116,10 @@ export class HMSVideoTrackSettings implements IHMSVideoTrackSettings, IAnalytics
if (isScreenShare) {
dimensionConstraintKey = 'max';
}
const aspectRatio = this.improviseConstraintsAspect();
return {
width: { [dimensionConstraintKey]: this.width },
height: { [dimensionConstraintKey]: this.height },
width: { [dimensionConstraintKey]: aspectRatio.width },
height: { [dimensionConstraintKey]: aspectRatio.height },
frameRate: this.maxFramerate,
deviceId: this.deviceId,
facingMode: this.facingMode,
Expand All @@ -134,4 +136,18 @@ export class HMSVideoTrackSettings implements IHMSVideoTrackSettings, IAnalytics
facingMode: this.facingMode,
};
}

// reverse the height and width if mobile as mobile web browsers override the height and width basis orientation
private improviseConstraintsAspect(): Partial<IHMSVideoTrackSettings> {
if (isMobile() && this.height && this.width && this.height > this.width) {
return {
width: this.height,
height: this.width,
};
}
return {
width: this.width,
height: this.height,
};
}
}
4 changes: 2 additions & 2 deletions packages/hms-virtual-background/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-icons/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-sdk/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/roomkit-react/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/roomkit-react/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ const StyledButton = styled('button', {
variants: {
variant: {
standard: getButtonVariants(
'$secondary_default',
'$secondary_bright',
'$secondary_dim',
'$secondary_disabled',
'$on_secondary_high',
'$on_secondary_low',
'$surface_brighter',
'$surface_bright',
'$surface_default',
'$surface_dim',
'$on_surface_high',
'$on_surface_low',
),
danger: getButtonVariants(
'$alert_error_default',
Expand Down
4 changes: 1 addition & 3 deletions packages/roomkit-react/src/Prebuilt/components/Chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const PinnedMessage = ({ clearPinnedMessage }) => {
) : null;
};

export const Chat = ({ screenType, hideControls = false }) => {
export const Chat = ({ screenType }) => {
const notification = useHMSNotifications(HMSNotificationTypes.PEER_LEFT);
const [peerSelector, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER_ID);
const [roleSelector, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
Expand Down Expand Up @@ -122,8 +122,6 @@ export const Chat = ({ screenType, hideControls = false }) => {
css={{
size: '100%',
gap: '$4',
marginTop: hideControls && elements?.chat?.is_overlay ? '$17' : '0',
transition: 'margin 0.3s ease-in-out',
}}
>
{isMobile && elements?.chat?.is_overlay ? null : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const useEmojiPickerStyles = showing => {
font-family: var(--hms-ui-fonts-sans);
}
.sticky {
top: 0.25rem;
background-color: var(--hms-ui-colors-surface_bright);
margin-top: 0.5rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ import { useDropdownList } from '../hooks/useDropdownList';
export const DesktopLeaveRoom = ({
leaveRoom,
screenType,
endRoom,
}: {
leaveRoom: (args: { endstream: boolean }) => void;
screenType: keyof ConferencingScreen;
endRoom: () => void;
}) => {
const [open, setOpen] = useState(false);
const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
const [showEndStreamAlert, setShowEndStreamAlert] = useState(false);
const isConnected = useHMSStore(selectIsConnectedToRoom);
const permissions = useHMSStore(selectPermissions);
const { isStreamingOn } = useRecordingStreaming();
const showStream = permissions?.hlsStreaming && isStreamingOn;
const showStream = screenType !== 'hls_live_streaming' && isStreamingOn;

useDropdownList({ open: open || showEndStreamAlert || showLeaveRoomAlert, name: 'LeaveRoom' });

Expand All @@ -36,7 +38,7 @@ export const DesktopLeaveRoom = ({

return (
<Fragment>
{permissions.hlsStreaming ? (
{screenType !== 'hls_live_streaming' && (permissions?.hlsStreaming || permissions?.endRoom) ? (
<Flex>
<LeaveIconButton
key="LeaveRoom"
Expand All @@ -46,11 +48,7 @@ export const DesktopLeaveRoom = ({
borderBottomRightRadius: 0,
}}
onClick={() => {
if (screenType === 'hls_live_streaming') {
setShowLeaveRoomAlert(true);
} else {
leaveRoom({ endstream: false });
}
leaveRoom({ endstream: false });
}}
>
<Tooltip title="Leave Room">
Expand Down Expand Up @@ -94,7 +92,7 @@ export const DesktopLeaveRoom = ({
css={{ p: 0 }}
/>
</Dropdown.Item>
{isStreamingOn && permissions?.hlsStreaming ? (
{permissions?.endRoom || permissions?.hlsStreaming ? (
<Dropdown.Item
css={{
bg: '$alert_error_dim',
Expand Down Expand Up @@ -148,7 +146,7 @@ export const DesktopLeaveRoom = ({
<Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
<EndSessionContent
setShowEndStreamAlert={setShowEndStreamAlert}
leaveRoom={leaveRoom}
leaveRoom={isStreamingOn ? leaveRoom : endRoom}
isStreamingOn={isStreamingOn}
isModal
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
ToastManager.addToast({ title: 'Error in stopping the stream', type: 'error' });
}
};
const endRoom = () => {
hmsActions.endRoom(false, 'End Room');
redirectToLeave();
};

const leaveRoom = async ({ endstream = false }) => {
if (endstream || (hlsState.running && peersWithStreamingRights.length === 1)) {
Expand All @@ -59,8 +63,8 @@ export const LeaveRoom = ({ screenType }: { screenType: keyof ConferencingScreen
return null;
}
return isMobile ? (
<MwebLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
<MwebLeaveRoom leaveRoom={leaveRoom} screenType={screenType} endRoom={endRoom} />
) : (
<DesktopLeaveRoom leaveRoom={leaveRoom} screenType={screenType} />
<DesktopLeaveRoom leaveRoom={leaveRoom} screenType={screenType} endRoom={endRoom} />
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ import { useDropdownList } from '../hooks/useDropdownList';
export const MwebLeaveRoom = ({
leaveRoom,
screenType,
endRoom,
}: {
leaveRoom: (args: { endstream: boolean }) => void;
screenType: keyof ConferencingScreen;
endRoom: () => void;
}) => {
const [open, setOpen] = useState(false);
const [showLeaveRoomAlert, setShowLeaveRoomAlert] = useState(false);
const [showEndStreamAlert, setShowEndStreamAlert] = useState(false);
const isConnected = useHMSStore(selectIsConnectedToRoom);
const permissions = useHMSStore(selectPermissions);
const { isStreamingOn } = useRecordingStreaming();
const showStream = screenType !== 'hls_live_streaming' && isStreamingOn;

const showStream = permissions?.hlsStreaming && isStreamingOn;
useDropdownList({ open, name: 'LeaveRoom' });

if (!permissions || !isConnected) {
Expand All @@ -37,7 +39,7 @@ export const MwebLeaveRoom = ({

return (
<Fragment>
{permissions?.hlsStreaming ? (
{screenType !== 'hls_live_streaming' ? (
<Sheet.Root open={open} onOpenChange={setOpen}>
<Sheet.Trigger asChild>
<LeaveIconButton
Expand Down Expand Up @@ -67,7 +69,8 @@ export const MwebLeaveRoom = ({
onClick={() => leaveRoom({ endstream: false })}
css={{ pt: 0, mt: '$10', color: '$on_surface_low', '&:hover': { color: '$on_surface_high' } }}
/>
{isStreamingOn && permissions?.hlsStreaming ? (

{permissions?.endRoom || permissions?.hlsStreaming ? (
<LeaveCard
title={showStream ? 'End Stream' : 'End Session'}
subtitle={`The will end the ${
Expand Down Expand Up @@ -108,7 +111,7 @@ export const MwebLeaveRoom = ({
<Sheet.Content css={{ bg: '$surface_dim', p: '$10', pb: '$12' }}>
<EndSessionContent
setShowEndStreamAlert={setShowEndStreamAlert}
leaveRoom={leaveRoom}
leaveRoom={isStreamingOn ? leaveRoom : endRoom}
isStreamingOn={isStreamingOn}
/>
</Sheet.Content>
Expand Down
Loading
Loading