android / media-samples

Multiple samples showing the best practices in media APIs on Android (audio, video, etc.).
Apache License 2.0
1.28k stars 741 forks source link

how can i received callback when pip was closed #19

Open haohaozaici opened 6 years ago

haohaozaici commented 6 years ago

when pip window was closed, my app still playing the video. i'm unwilling to stop video when onStop called, because maybe it just restored fullscreen. So i hope receive closed callback, i can really destroy activity and release my MediaPlayer.

imrankhanluhar commented 6 years ago

don't finish the activity

romichandra commented 5 years ago

I need the same callback to finish my activity. I am working with GLSurfaceView and PIP, my game renders in the PIP mode well, but i would like to destroy my resources and finish the game activity on PIP CLOSE. Help appreciated!

anonym24 commented 1 year ago

don't finish the activity

are you ok? don't answer to questions if you have no idea what are you talking about

anonym24 commented 1 year ago

yeah, it seems close button on the PIP just stops the activity but doesn't destroy it, I would expect it be finished as it happens with back button behavior

Dvl-es commented 1 year ago

@haohaozaici You can do something like this:


  public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
    super.onPictureInPictureModeChanged(isInPictureInPictureMode);

    if (!isInPictureInPictureMode) { 
// Pip is closed here
   }
  }