File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
android/java/org/chromium/chrome/browser/app Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2732,6 +2732,27 @@ public void showYouTubeFeaturesLayout(final boolean show) {
2732
2732
}
2733
2733
}
2734
2734
2735
+ public void enterPipMode () {
2736
+ if (!deviceSupportedPictureInPictureMode (this )) {
2737
+ Toast .makeText (this , R .string .picture_in_picture_not_supported , Toast .LENGTH_LONG ).show ();
2738
+ return ;
2739
+ }
2740
+
2741
+ if (!hasPictureInPicturePermissionEnabled (this )) {
2742
+ launchPictureInPictureSettings (this );
2743
+ return ;
2744
+ }
2745
+
2746
+ final Tab currentTab = getActivityTab ();
2747
+ if (TabUtils .isYouTubeVideo (currentTab )) {
2748
+ if (getLifecycleDispatcher ().getCurrentActivityState () != RESUMED_WITH_NATIVE ) {
2749
+ return ;
2750
+ }
2751
+ BackgroundVideoPlaybackTabHelper .setFullscreen (currentTab .getWebContents ());
2752
+ enterPictureInPictureMode (new PictureInPictureParams .Builder ().build ());
2753
+ }
2754
+ }
2755
+
2735
2756
@ Override
2736
2757
public void onUserInteraction () {
2737
2758
super .onUserInteraction ();
You can’t perform that action at this time.
0 commit comments