admin管理员组

文章数量:1122832

I want to open the main UI and pip window at the same time in ReactNative.

Currently, when I enter the pip mode as shown below, the main UI switches to the pip screen as if it were the background and does not work as I want.

Rational rational = new Rational(16, 9);

PictureInPictureParams mParams =
null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  mParams = new PictureInPictureParams.Builder()
    .setAspectRatio(rational)
    .build();
  enterPictureInPictureMode(mParams);
}

Is there anything else I need to set?

My MainActivity is as follows.

<activity
 android:name=".MainActivity"
 android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
 android:launchMode="singleTask"
 android:supportsPictureInPicture="true"
 android:windowSoftInputMode="adjustResize"
 android:exported="true">
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
 </intent-filter>
 <intent-filter>
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
 <data android:scheme="" />
 </intent-filter>
 </activity>

I tried using [email protected] and also tried to create a new activity and display it separately. In the former case, the window changed as described above, and in the latter case, it stopped because it did not operate properly. I saw that the method handled in react-native-video was not wrong when I saw the introduction of multi-window in Android and other articles, so I think it is a problem with my settings, so I am checking it. Even when I changed from 'SingleTask' to 'Standard', the behavior did not change.

本文标签: androidHow to display Picture in Picture along with the main UIStack Overflow