Skip to content

Conversation

@santhoshvai
Copy link
Member

💡 Overview

useIsInPiPMode only worked for Android. But with this change also works for iOS. Can be used for analytics in iOS.

📝 Implementation notes

Added an onPiPStateChange closure to StreamPictureInPictureController.swift, which is called when PiP starts or stops, enabling notification of PiP state changes from native code

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables Picture-in-Picture (PiP) mode detection for iOS by extending the existing Android-only functionality to work cross-platform. The implementation adds native iOS event handling to notify React Native when PiP state changes.

Key changes:

  • Added iOS-specific RxJS subject for PiP state tracking
  • Modified the useIsInPiPMode hook to handle both Android and iOS platforms
  • Implemented native iOS callback mechanism to communicate PiP state changes

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react-native-sdk/src/utils/internal/rxSubjects.ts Added iOS-specific RxJS subject for PiP state
packages/react-native-sdk/src/hooks/useIsInPiPMode.tsx Updated hook to support both platforms with platform-specific logic
packages/react-native-sdk/src/components/Call/CallContent/RTCViewPipNative.tsx Added PiP change event type and callback prop
packages/react-native-sdk/src/components/Call/CallContent/RTCViewPipIOS.tsx Implemented PiP state change handler and RxJS integration
packages/react-native-sdk/src/components/Call/CallContent/CallContent.tsx Added onPiPChange prop to public API
packages/react-native-sdk/ios/RTCViewPipManager.mm Exported onPiPChange event property to React Native bridge
packages/react-native-sdk/ios/RTCViewPip.swift Added event handling and callback setup for PiP state changes
packages/react-native-sdk/ios/PictureInPicture/StreamPictureInPictureController.swift Added PiP state change callback mechanism

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@santhoshvai santhoshvai merged commit 2fe1f9f into main Oct 6, 2025
6 checks passed
@santhoshvai santhoshvai deleted the pip-change-ios branch October 6, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants