Picture in Picture Mode Sketchware

 


Today we are going to Implement Pip mode, Picture in Picture mode in Sketchware.

Hey Today we are going to make Picture in Picture mode for activity. We all saw the youtube videos continue playing in a popup window on bottom after we click back. Thats we gonna do in this tutorial. In the all new applications we see the Picture in Picture mode. AKA PIP mode What is PIP Mode or Picture in Picture mode? Android 8.0 (API level 26) allows activities to launch in picture-in-picture (PIP) mode. PIP is a special type of multi-window mode. You can play video. or put the whole activity to pip mode ---------------------------------------------------------------------------- NOTE ❌ It only supports from ANDROID 8 or above ---------------------------------------------------------------------------- So in the code we check for API level

WATCH VIDEO  https://youtu.be/9byVvi9reWY


Official by DreamPLAY Dev.

First on youtube.

ASD CODES :


  if (android.os.Build.VERSION.SDK_INT >= 26) {
    //Trigger PiP mode
    try {
    Rational rational = new Rational(youTubeView.getWidth(), youTubeView.getHeight());
ActionBar ab = getActionBar();
ab.hide();
 PictureInPictureParams mParams =
 new PictureInPictureParams.Builder()
 .setAspectRatio(rational)
 .build();
 enterPictureInPictureMode(mParams);
 } catch (IllegalStateException e) {
 e.printStackTrace();
 }
} else {
Toast.makeText(MainActivity.this, "API 26 needed to perform PiP", Toast.LENGTH_SHORT).show();
; }