@@ -81,10 +81,14 @@ export type VideoTrackProps = {
8181 *
8282 * iOS only. Requires iOS 15.0 or above, and the PIP background mode capability.
8383 *
84- * If `iosPIP.enabled` is true, startIOSPIP and stopIOSPIP can be used to manually
85- * trigger the PIP mode. `iosPIP.startAutomatically` can be used to automatically
84+ * If `iosPIP.enabled` is true, the methods `startIOSPIP` and `stopIOSPIP`
85+ * can be used to manually trigger the PIP mode.
86+ *
87+ * `iosPIP.startAutomatically` can be used to automatically
8688 * enter PIP when backgrounding the app.
8789 *
90+ * `iosPIP.preferredSize` is used to provide a suggested aspect ratio.
91+ *
8892 * @example
8993 * ```tsx
9094 * import { startIOSPIP, stopIOSPIP } from '@livekit/react-native-webrtc';
@@ -98,8 +102,8 @@ export type VideoTrackProps = {
98102 * enabled: true,
99103 * startAutomatically: true,
100104 * preferredSize: {
101- * width: 800 ,
102- * height: 800 ,
105+ * width: 9 ,
106+ * height: 16 ,
103107 * },
104108 * }}
105109 * ...
@@ -151,9 +155,12 @@ export const VideoTrack = forwardRef<Component, VideoTrackProps>(
151155 ( event : LayoutChangeEvent ) => elementInfo . onLayout ( event ) ,
152156 [ elementInfo ]
153157 ) ;
158+
159+ const iosPIPEnabled = iosPIP ?. enabled ?? false ;
154160 const visibilityOnChange = useCallback (
155- ( isVisible : boolean ) => elementInfo . onVisibility ( isVisible ) ,
156- [ elementInfo ]
161+ ( isVisible : boolean ) =>
162+ elementInfo . onVisibility ( isVisible || iosPIPEnabled ) ,
163+ [ elementInfo , iosPIPEnabled ]
157164 ) ;
158165
159166 const videoTrack = trackRef ?. publication . track ;
0 commit comments