80.3 Entering Picture-in-Picture Mode
The enterPipMode onClick callback method now needs to be added to the MainActivity.kt class file. Locate this file, open it in the code editor and add this method as follows:
.
.
import android.app.PictureInPictureParams
import android.util.Rational
import android.view.View
import android.content.res.Configuration
.
.
fun enterPipMode(view: View) {
val rational = Rational(binding.videoView1.width,
binding.videoView1.height)
val params = PictureInPictureParams.Builder()
.setAspectRatio(rational)
.build()
binding.pipButton.visibility = View.INVISIBLE
binding.videoView1...