Skip to content

Commit

Permalink
Merge branch 'feature/WD-1079' into fast-reconnects
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Dec 11, 2023
2 parents 2698ffa + 8627ca0 commit 85d0480
Show file tree
Hide file tree
Showing 28 changed files with 446 additions and 146 deletions.
6 changes: 5 additions & 1 deletion packages/client/src/__tests__/server-side/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ describe('call API', () => {
});

it('RTMP address', async () => {
const resp = await call.getOrCreate();
const resp = await call.getOrCreate({
data: {
created_by_id: 'john',
},
});
const address = resp.call.ingress.rtmp.address;

expect(address).toBeDefined();
Expand Down
7 changes: 6 additions & 1 deletion packages/react-sdk/src/components/Button/CompositeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export const CompositeButton = forwardRef<
ref,
) => {
return (
<div className="str-video__composite-button" ref={ref}>
<div
className={clsx('str-video__composite-button', {
'str-video__composite-button--caption': caption,
})}
ref={ref}
>
<div
className={clsx('str-video__composite-button__button-group', {
'str-video__composite-button__button-group--active': active,
Expand Down
48 changes: 12 additions & 36 deletions packages/react-sdk/src/components/DeviceSettings/DeviceSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import clsx from 'clsx';
import { ChangeEventHandler, useCallback } from 'react';

import { Icon } from '../Icon';
import { generateCode } from '../../utilities';

import { DefaultDropDownSelectOption, DropDownSelect } from '../DropdownSelect';

type DeviceSelectorOptionProps = {
id: string;
label: string;
name: string;
name?: string;
selected?: boolean;
value: string;
disabled?: boolean;
Expand Down Expand Up @@ -49,36 +49,10 @@ const DeviceSelectorOption = ({
);
};

const DeviceDropdownSelectorOption = ({
label,
selected,
icon,
}: {
label: string;
selected: boolean;
icon: string;
}) => {
return (
<label
className={clsx('str-video__device-settings__option', {
'str-video__device-settings__option--selected': selected,
})}
>
<Icon
className={clsx('str-video__device-settings__icon', {
'str-video__device-settings__icon--selected': selected,
})}
icon={icon}
/>
{label}
</label>
);
};

export const DeviceSelectorList = (props: {
devices: MediaDeviceInfo[];
selectedDeviceId?: string;
title: string;
title?: string;
onChange?: (deviceId: string) => void;
}) => {
const {
Expand All @@ -87,7 +61,8 @@ export const DeviceSelectorList = (props: {
title,
onChange,
} = props;
const inputGroupName = title.replace(' ', '-').toLowerCase();
const inputGroupName =
title?.replace(' ', '-').toLowerCase() || generateCode();

// sometimes the browser (Chrome) will report the system-default device
// with an id of 'default'. In case when it doesn't, we'll select the first
Expand All @@ -102,9 +77,11 @@ export const DeviceSelectorList = (props: {

return (
<div className="str-video__device-settings__device-kind">
<div className="str-video__device-settings__device-selector-title">
{title}
</div>
{title && (
<div className="str-video__device-settings__device-selector-title">
{title}
</div>
)}
{!devices.length ? (
<DeviceSelectorOption
id={`${inputGroupName}--default`}
Expand Down Expand Up @@ -139,7 +116,7 @@ export const DeviceSelectorList = (props: {
export const DeviceSelectorDropdown = (props: {
devices: MediaDeviceInfo[];
selectedDeviceId?: string;
title: string;
title?: string;
onChange?: (deviceId: string) => void;
visualType?: 'list' | 'dropdown';
icon: string;
Expand All @@ -151,7 +128,6 @@ export const DeviceSelectorDropdown = (props: {
title,
onChange,
icon,
placeholder,
} = props;

// sometimes the browser (Chrome) will report the system-default device
Expand Down Expand Up @@ -207,7 +183,7 @@ export const DeviceSelectorDropdown = (props: {
export const DeviceSelector = (props: {
devices: MediaDeviceInfo[];
selectedDeviceId?: string;
title: string;
title?: string;
onChange?: (deviceId: string) => void;
visualType?: 'list' | 'dropdown';
icon: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallStateHooks, useI18n } from '@stream-io/video-react-bindings';
import { useCallStateHooks } from '@stream-io/video-react-bindings';
import { DeviceSelector } from './DeviceSelector';

export type DeviceSelectorAudioInputProps = {
Expand All @@ -10,7 +10,6 @@ export const DeviceSelectorAudioInput = ({
title,
visualType,
}: DeviceSelectorAudioInputProps) => {
const { t } = useI18n();
const { useMicrophoneState } = useCallStateHooks();
const { microphone, selectedDevice, devices } = useMicrophoneState();

Expand All @@ -21,7 +20,7 @@ export const DeviceSelectorAudioInput = ({
onChange={async (deviceId) => {
await microphone.select(deviceId);
}}
title={title || t('Select a Mic')}
title={title}
visualType={visualType}
icon={'mic'}
/>
Expand All @@ -37,7 +36,6 @@ export const DeviceSelectorAudioOutput = ({
title,
visualType,
}: DeviceSelectorAudioOutputProps) => {
const { t } = useI18n();
const { useSpeakerState } = useCallStateHooks();
const { speaker, selectedDevice, devices, isDeviceSelectionSupported } =
useSpeakerState();
Expand All @@ -51,7 +49,7 @@ export const DeviceSelectorAudioOutput = ({
onChange={(deviceId) => {
speaker.select(deviceId);
}}
title={title || t('Select Speakers')}
title={title}
icon="speaker"
visualType={visualType}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DeviceSelector } from './DeviceSelector';
import { useCallStateHooks, useI18n } from '@stream-io/video-react-bindings';
import { useCallStateHooks } from '@stream-io/video-react-bindings';

export type DeviceSelectorVideoProps = {
title?: string;
Expand All @@ -10,7 +10,6 @@ export const DeviceSelectorVideo = ({
title,
visualType,
}: DeviceSelectorVideoProps) => {
const { t } = useI18n();
const { useCameraState } = useCallStateHooks();
const { camera, devices, selectedDevice } = useCameraState();

Expand All @@ -21,7 +20,7 @@ export const DeviceSelectorVideo = ({
onChange={async (deviceId) => {
await camera.select(deviceId);
}}
title={title || t('Select a Camera')}
title={title}
visualType={visualType}
icon="camera"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ export const DeviceSettings = ({ visualType = MenuVisualType.MENU }) => {
);
};

const Menu = () => (
<div className="str-video__device-settings">
<DeviceSelectorVideo />
<DeviceSelectorAudioInput />
<DeviceSelectorAudioOutput />
</div>
);
const Menu = () => {
const { t } = useI18n();
return (
<div className="str-video__device-settings">
<DeviceSelectorVideo title={t('Select a Camera')} />
<DeviceSelectorAudioInput title={t('Select a Mic')} />
<DeviceSelectorAudioOutput title={t('Select Speakers')} />
</div>
);
};

const ToggleMenuButton = forwardRef<HTMLButtonElement, ToggleMenuButtonProps>(
({ menuShown }, ref) => {
Expand Down
1 change: 1 addition & 0 deletions packages/react-sdk/src/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './isComponentType';
export * from './chunk';
export * from './applyElementToRef';
export * from './random';
13 changes: 13 additions & 0 deletions packages/react-sdk/src/utilities/random.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function getRandomUppercaseChar() {
var r = Math.floor(Math.random() * 26);
return String.fromCharCode(65 + r);
}

export function generateCode() {
var prefix = new Array(2)
.fill(() => getRandomUppercaseChar())
.map(() => getRandomUppercaseChar())
.join(''),
integer = Math.floor(Math.random() * 9999 * 7);
return prefix + integer;
}
7 changes: 5 additions & 2 deletions packages/styling/src/Button/Button-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@

.str-video__composite-button {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
height: 100%;

&--caption {
flex-direction: column;
gap: 0.25rem;
}

.str-video__composite-button__button-group {
display: flex;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@
border-radius: var(--str-video__border-radius-lg);
background-color: var(--str-video__button-primary-base);
padding: var(--str-video__spacing-xs) var(--str-video__spacing-md);
margin-top: 8px;

gap: 8px;

font-weight: 600;
font-size: var(--str-video__font-size-sm);

&:not(:first-of-type) {
margin-top: 8px;
}

&__icon {
&--selected {
background-color: var(--str-video__brand-color1);
Expand Down
5 changes: 5 additions & 0 deletions packages/styling/src/Icon/Icon-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
-webkit-mask-image: var(--str-video__icon--mediation);
}

&--copy {
mask-image: var(--str-video__icon--copy);
-webkit-mask-image: var(--str-video__icon--copy);
}

&--layout-speaker-bottom {
mask-image: var(--str-video__icon--layout-speaker-bottom);
-webkit-mask-image: var(--str-video__icon--layout-speaker-bottom);
Expand Down
2 changes: 1 addition & 1 deletion packages/styling/src/_global-theme-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
--str-video__icon--connection-quality-poor: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzMiIGhlaWdodD0iMzMiIHZpZXdCb3g9IjAgMCAzMyAzMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAuMjU0ODgzIDYuMjVDMC4yNTQ4ODMgMi45MzYyOSAyLjk0MTE3IDAuMjUgNi4yNTQ4OCAwLjI1SDMyLjI1NDlWMjYuMjVDMzIuMjU0OSAyOS41NjM3IDI5LjU2ODYgMzIuMjUgMjYuMjU0OSAzMi4yNUgwLjI1NDg4M1Y2LjI1WiIgZmlsbD0iIzBDMEQwRSIgZmlsbC1vcGFjaXR5PSIwLjY1Ii8+CjxwYXRoIGQ9Ik0xNi4yNTQ5IDIwLjI1TDE2LjI1NDkgMTUuMjUiIHN0cm9rZT0iI0UzRTRFNSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTExLjI1NDkgMjAuMjVMMTEuMjU0OSAxOC4yNSIgc3Ryb2tlPSIjREM0MzNCIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMjEuMjU0OSAyMC4yNUwyMS4yNTQ5IDEyLjI1IiBzdHJva2U9IiNFM0U0RTUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo=');
--str-video__icon--connection-quality-good: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0i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bGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg==');
--str-video__icon--download: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik01MTIgNjY2LjUgMzY3LjIgNTIxLjdsMzYuMi0zNi4yIDgzIDgzVjI1Nmg1MS4ydjMxMi41bDgzLTgzIDM2LjIgMzYuMkw1MTIgNjY2LjV6bS0yMDQuOCA1MC4zVjc2OGg0MDkuNnYtNTEuMkgzMDcuMnoiLz48L3N2Zz4K');
Expand Down
26 changes: 19 additions & 7 deletions sample-apps/react/react-dogfood/components/ActiveCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
RecordCallButton,
ScreenShareButton,
SpeakingWhileMutedNotification,
ToggleAudioPublishingButton,
ToggleVideoPublishingButton,
useCallStateHooks,
} from '@stream-io/video-react-sdk';
import { StreamChat } from 'stream-chat';

import { ActiveCallHeader } from './ActiveCallHeader';
import { Stage } from './Stage';
import { InvitePanel } from './InvitePanel/InvitePanel';
import { InvitePanel, InvitePopup } from './InvitePanel/InvitePanel';
import { ChatWrapper } from './ChatWrapper';
import { ChatUI } from './ChatUI';
import { ToggleSettingsTabModal } from './Settings/SettingsTabModal';
Expand All @@ -26,10 +26,13 @@ import { ToggleDeveloperButton } from './ToggleDeveloperButton';
import { ToggleMoreOptionsListButton } from './ToggleMoreOptionsListButton';
import { ToggleLayoutButton } from './ToggleLayoutButton';
import { ToggleParticipantListButton } from './ToggleParticipantListButton';
import { ToggleDualCameraButton } from './ToggleDualCameraButton';
import { ToggleDualMicButton } from './ToggleDualMicButton';
import { NewMessageNotification } from './NewMessageNotification';
import { UnreadCountBadge } from './UnreadCountBadge';
import { DEFAULT_LAYOUT, getLayoutSettings, LayoutMap } from './LayoutSelector';
import { useWatchChannel, useBreakpoint } from '../hooks';

import { useBreakpoint, useWatchChannel } from '../hooks';

export type ActiveCallProps = {
chatClient?: StreamChat | null;
Expand All @@ -41,6 +44,7 @@ export type ActiveCallProps = {
export const ActiveCall = (props: ActiveCallProps) => {
const { chatClient, activeCall, onLeave, onJoin } = props;
const [showParticipants, setShowParticipants] = useState(false);
const [showInvitePopup, setShowInvitePopup] = useState(true);
const [showChat, setShowChat] = useState(false);
const [layout, setLayout] = useState<keyof typeof LayoutMap>(() => {
const storedLayout = getLayoutSettings()?.selectedLayout;
Expand All @@ -51,6 +55,8 @@ export const ActiveCall = (props: ActiveCallProps) => {
: DEFAULT_LAYOUT;
});

const { useParticipantCount } = useCallStateHooks();
const participantCount = useParticipantCount();
const breakpoint = useBreakpoint();

useEffect(() => {
Expand Down Expand Up @@ -94,14 +100,20 @@ export const ActiveCall = (props: ActiveCallProps) => {
<PermissionRequests />
<div className="rd__layout">
<Stage selectedLayout={layout} />
{showInvitePopup && participantCount === 1 && (
<InvitePopup
callId={activeCall.id}
close={() => setShowInvitePopup(false)}
/>
)}
{showSidebar && (
<div className="rd__sidebar">
{showParticipants && (
<div className="rd__participants">
<CallParticipantsList
onClose={() => setShowParticipants(false)}
/>
<InvitePanel callId={activeCall.id} />
<InvitePanel />
</div>
)}

Expand Down Expand Up @@ -152,8 +164,8 @@ export const ActiveCall = (props: ActiveCallProps) => {
<ReactionsButton />
</div>

<ToggleAudioPublishingButton />
<ToggleVideoPublishingButton />
<ToggleDualMicButton />
<ToggleDualCameraButton />
<div className="str-video__call-controls__desktop">
<CancelCallConfirmButton onLeave={onLeave} />
</div>
Expand Down
Loading

0 comments on commit 85d0480

Please sign in to comment.