Skip to content

Commit 7be61d2

Browse files
authored
fix: don't apply participant aspect ratios in screen share mode (#1531)
### Overview Applying portrait mode aspect ratios (9/16, or any similar) breaks the screen-sharing layout (some elements go off-screen). Until we provide a proper solution, we restore to the default aspect ratio once screen sharing is started. In the long run, we should consider separating the screen share layout configuration from the regular one. Context: https://getstream.slack.com/archives/C07KX5D7MFX/p1729017984964169?thread_ts=1727981915.684569&cid=C07KX5D7MFX This PR also includes a few other low-hanging fruits.
1 parent 82cb3e3 commit 7be61d2

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

.github/workflows/egress-composite-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: yarn build:react:deps
4242

4343
- name: Cache Playwright browsers
44-
uses: actions/cache@v3
44+
uses: actions/cache@v4
4545
id: playwright-cache
4646
with:
4747
path: ~/.cache/ms-playwright

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ services:
77
generate-screenshots:
88
build: ./
99
command: >
10-
yarn workspace @stream-io/egress-composite run test:e2e
11-
-u
10+
yarn workspace @stream-io/egress-composite run test:e2e
11+
-u
1212
--timeout 5000
1313
volumes:
1414
- ./sample-apps/react/egress-composite/tests/:/e2e/sample-apps/react/egress-composite/tests/
1515
environment:
16-
VITE_STREAM_API_KEY: <key>
16+
VITE_STREAM_API_KEY: hd8szvscpxvd
1717
VITE_STREAM_USER_TOKEN: <token>
1818
CI: true

sample-apps/react/egress-composite/src/components/LogoAndTitleOverlay.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const LogoAndTitleOverlay = () => {
77
options: { 'logo.image_url': imageURL, 'title.text': titleText },
88
} = useConfigurationContext();
99

10+
if (!titleText && !imageURL) return null;
11+
1012
return (
1113
<div
1214
data-testid="logo-and-title-overlay"

sample-apps/react/egress-composite/src/components/layouts/DominantSpeaker/DominantSpeakerScreenShare.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ export const DominantSpeakerScreenShare = () => {
3636
muteAudio // audio is handled by <ParticipantsAudio />
3737
ParticipantViewUI={null}
3838
/>
39-
<span>
40-
{`Presenter: ${
41-
screensharingParticipant.name || screensharingParticipant.userId
42-
}`}
43-
</span>
4439
<div className="eca__dominant-speaker-screen-share__current-speaker">
4540
<ParticipantView
4641
participant={screensharingParticipant}

sample-apps/react/egress-composite/src/components/layouts/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ import { Spotlight } from './Spotlight';
77
export const DEFAULT_LAYOUT: Layout = 'spotlight';
88
export const DEFAULT_SCREENSHARE_LAYOUT: ScreenshareLayout = 'spotlight';
99

10-
export type Layout = 'grid' | 'single-participant' | 'spotlight' | 'mobile';
10+
export type Layout =
11+
| 'grid'
12+
| 'single-participant'
13+
| 'spotlight'
14+
| 'mobile'
15+
| 'dominant-speaker';
1116
// NOTE: should always be a subset of the Layout type
12-
export type ScreenshareLayout = 'single-participant' | 'spotlight';
17+
export type ScreenshareLayout =
18+
| 'single-participant'
19+
| 'spotlight'
20+
| 'dominant-speaker';
1321

1422
export const layoutMap: Record<
1523
Layout,
@@ -20,4 +28,5 @@ export const layoutMap: Record<
2028
grid: [PaginatedGrid],
2129
spotlight: [Spotlight, Spotlight],
2230
mobile: [DominantSpeaker, DominantSpeakerScreenShare],
31+
'dominant-speaker': [DominantSpeaker, DominantSpeakerScreenShare],
2332
};

sample-apps/react/egress-composite/src/hooks/options/useParticipantStyles.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { css } from '@emotion/css';
22
import clsx from 'clsx';
3+
import { useCallStateHooks } from '@stream-io/video-react-sdk';
34

45
import { useConfigurationContext } from '../../ConfigurationContext';
56

@@ -15,14 +16,21 @@ export const useParticipantStyles = () => {
1516
},
1617
} = useConfigurationContext();
1718

19+
const { useHasOngoingScreenShare } = useCallStateHooks();
20+
const hasScreenShare = useHasOngoingScreenShare();
1821
const styles = [
1922
participantBorderRadius &&
2023
css`
2124
& .str-video__participant-view {
2225
border-radius: ${participantBorderRadius};
2326
}
2427
`,
28+
// we don't want to apply the aspect ratio when screen share is
29+
// enabled, as it breaks our layouts.
30+
// we should think about this later, and most likely introduce
31+
// parallel configuration for screen sharing mode
2532
participantAspectRatio &&
33+
!hasScreenShare &&
2634
css`
2735
& .str-video__participant-view {
2836
aspect-ratio: ${participantAspectRatio};
Loading

0 commit comments

Comments
 (0)