Class PictureInPictureController.SessionPictureInPicture

Object
org.mozilla.geckoview.PictureInPictureController.SessionPictureInPicture
Enclosing class:
PictureInPictureController

public static class PictureInPictureController.SessionPictureInPicture extends Object
Session picture-in-picture drives the picture-in-picture window for the video a single session is playing.
  • Method Details

    • request

      @HandlerThread @NonNull public GeckoResult<Void> request()
      Requests a picture-in-picture window for the video this session last started playing.
      Returns:
      A GeckoResult that completes once the picture-in-picture window is showing the video, or completes exceptionally if it could not be set up. It completes with no window having been opened if the session is not playing a video.
    • exit

      @UiThread @NonNull public GeckoResult<Void> exit()
      Notifies Gecko that the picture-in-picture window showing a video from this session has been closed by the application. Must be called when the application tears the window down itself, so that state held for the video can be released.
      Returns:
      A GeckoResult that completes once that state has been released.
    • setKeepActive

      @UiThread public void setKeepActive(boolean keepActive)
      Sets whether the GeckoView showing this session leaves it active when it stops showing it. An inactive page is hidden, and pages commonly pause their video when hidden, so set this while a picture-in-picture window is showing one of this session's videos.

      Once the window is gone, clear it and call GeckoSession.setActive(boolean) with false if the session is no longer showing anywhere, since the view will not do it.

      Parameters:
      keepActive - Whether to keep this session active.