Search in sources :

Example 96 with Rational

use of android.util.Rational in project Conversations by siacs.

the class RtpSessionActivity method startPictureInPicture.

@RequiresApi(api = Build.VERSION_CODES.O)
private void startPictureInPicture() {
    try {
        final Rational rational = this.binding.remoteVideo.getAspectRatio();
        final Rational clippedRational = Rationals.clip(rational);
        Log.d(Config.LOGTAG, "suggested rational " + rational + ". clipped to " + clippedRational);
        enterPictureInPictureMode(new PictureInPictureParams.Builder().setAspectRatio(clippedRational).build());
    } catch (final IllegalStateException e) {
        // this sometimes happens on Samsung phones (possibly when Knox is enabled)
        Log.w(Config.LOGTAG, "unable to enter picture in picture mode", e);
    }
}
Also used : Rational(android.util.Rational) PictureInPictureParams(android.app.PictureInPictureParams) RequiresApi(androidx.annotation.RequiresApi)

Aggregations

Rational (android.util.Rational)96 SmallTest (android.test.suitebuilder.annotation.SmallTest)50 Range (android.util.Range)15 Size (android.util.Size)6 Point (android.graphics.Point)5 Pair (android.util.Pair)5 InvalidObjectException (java.io.InvalidObjectException)5 PictureInPictureParams (android.app.PictureInPictureParams)4 TargetApi (android.annotation.TargetApi)3 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)2 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 RemoteAction (android.app.RemoteAction)1 Intent (android.content.Intent)1 Rect (android.graphics.Rect)1 RequiresApi (androidx.annotation.RequiresApi)1 RequiresPermission (androidx.annotation.RequiresPermission)1 CameraSelector (androidx.camera.core.CameraSelector)1 StringBuilder (java.lang.StringBuilder)1 DecimalFormat (java.text.DecimalFormat)1