Skip to content

fix: handle undefined participant in iOS pip #1878

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

Merged
merged 3 commits into from
Aug 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -39,7 +39,8 @@ export const RTCViewPipIOS = React.memo((props: Props) => {

// show the dominant remote speaker in PiP mode
// local speaker is shown only if remote doesn't exist
let participantInSpotlight = dominantSpeaker;
let participantInSpotlight: StreamVideoParticipant | undefined =
dominantSpeaker;
if (dominantSpeaker?.isLocalParticipant && dominantSpeaker2) {
participantInSpotlight = dominantSpeaker2;
}
Expand Down Expand Up @@ -94,9 +95,11 @@ export const RTCViewPipIOS = React.memo((props: Props) => {
}
}, []);

const { videoStream, screenShareStream } = participantInSpotlight;
const { videoStream, screenShareStream } = participantInSpotlight || {};

const isScreenSharing = hasScreenShare(participantInSpotlight);
const isScreenSharing = participantInSpotlight
? hasScreenShare(participantInSpotlight)
: false;

const videoStreamToRender = (isScreenSharing
? screenShareStream
Expand All @@ -112,12 +115,14 @@ export const RTCViewPipIOS = React.memo((props: Props) => {
return (
<>
<RTCViewPipNative streamURL={streamURL} ref={nativeRef} />
<DimensionsUpdatedRenderless
participant={participantInSpotlight}
trackType={isScreenSharing ? 'screenShareTrack' : 'videoTrack'}
onDimensionsUpdated={onDimensionsUpdated}
key={streamURL}
/>
{participantInSpotlight && (
<DimensionsUpdatedRenderless
participant={participantInSpotlight}
trackType={isScreenSharing ? 'screenShareTrack' : 'videoTrack'}
onDimensionsUpdated={onDimensionsUpdated}
key={streamURL}
/>
)}
</>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
getLogger(['RTCViewPipNative'])('debug', 'onNativeCallClosed');
UIManager.dispatchViewManagerCommand(
reactTag,
// @ts-expect-error - types issue

Check failure on line 24 in packages/react-native-sdk/src/components/Call/CallContent/RTCViewPipNative.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Unused '@ts-expect-error' directive.
UIManager.getViewManagerConfig(COMPONENT_NAME).Commands.onCallClosed,
[],
);
Expand All @@ -37,6 +38,7 @@
});
UIManager.dispatchViewManagerCommand(
reactTag,
// @ts-expect-error - types issue

Check failure on line 41 in packages/react-native-sdk/src/components/Call/CallContent/RTCViewPipNative.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Unused '@ts-expect-error' directive.
UIManager.getViewManagerConfig(COMPONENT_NAME).Commands
.setPreferredContentSize,
[width, height],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useIsIosScreenshareBroadcastStarted } from './useIsIosScreenshareBroadc
// ios >= 14.0 or android - platform restrictions
const CanDeviceScreenShare =
(Platform.OS === 'ios' &&
Number.parseInt(Platform.Version.split('.')[0], 10) >= 14) ||
Number.parseInt(Platform.Version?.split('.')[0] ?? '0', 10) >= 14) ||
Platform.OS === 'android';

export const useScreenShareButton = (
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"noUncheckedIndexedAccess": true,
"jsx": "react"
},
"include": ["src"]
Expand Down
Loading