Picture-in-Picture Mode - React Native
Picture-in-picture (PiP) is a commonly used feature in video conferencing software, enabling users to simultaneously engage in a video conference and perform other tasks on their device. With PiP, you can keep the video conference window open, resize it to a smaller size, and continue working on other tasks while still seeing and hearing the other participants in the conference. This feature proves beneficial when you need to take notes, send an email, or look up information during the conference.
This guide explains the steps to implement the Picture-in-Picture feature using VideoSDK.
- Picture-in-Picture (PiP) functionality is not supported after screen sharing
- PiP is available exclusively on Android devices.
Step 1:
Install Package
To begin with, you need to install a third party package react-native-pip-android to achieve PiP mode in android.
- NPM
- YARN
npm install react-native-pip-android
yarn add react-native-pip-android
Step 2:
Setup
Include the following attribute in /android/app/src/main/AndroidManifest.xml
file.
<activity
...
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
...
Step 3:
Import Activity in MainActivity.java
file
...
import com.reactnativepipandroid.PipAndroidModule;
public class MainActivity extends ReactActivity {
...
@Override
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode) {
PipAndroidModule.pipModeChanged(isInPictureInPictureMode);
}