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);
}
}
Aggregations