Package 

Class PictureInPictureManager

    • Method Detail

      • setAspectRatio

         PictureInPictureManager setAspectRatio(@Nullable() Rational aspectRatio)

        Sets the aspect ratio. This aspect ratio is defined as the desired width / height, anddoes not change upon device rotation.

        Parameters:
        aspectRatio - the new aspect ratio for the activity in picture-in-picture, must bebetween 2.39:1 and 1:2.39 (inclusive).
      • setSourceRectHint

         PictureInPictureManager setSourceRectHint(@Nullable() Rect sourceRectHint)

        Sets the source bounds hint. These bounds are only used when an activity first enterspicture-in-picture, and describe the bounds in window coordinates of activity enteringpicture-in-picture that will be visible following the transition. For the best effect,these bounds should also match the aspect ratio in the arguments.

        Parameters:
        sourceRectHint - window-coordinate bounds indicating the area of the activity thatwill still be visible following the transition into picture-in-picture (eg.
      • setClosedCaptionsEnabled

         PictureInPictureManager setClosedCaptionsEnabled(boolean closedCaptionsEnabled)

        Enables or disables closed captions for Picture in Picture mode.

        Parameters:
        closedCaptionsEnabled - true to enable closed captions.
      • setOnUserLeaveEnabled

         PictureInPictureManager setOnUserLeaveEnabled(boolean onUserLeaveEnabled)

        Enables or disables entering into Picture in Picture mode when the user has put the activity inthe background, for example, when of pressing the Home key.

        Parameters:
        onUserLeaveEnabled - true to enable.
      • registerActivity

         void registerActivity(@NonNull() Activity activity, @NonNull() BaseVideoView videoView)

        This method registers and holds a weak reference to the Activitythat will be put into Picture-in-Picture mode.You can have only one registered Activity at a time.This method is only supported for Android versions equal or greater than O,otherwise the method will not do anything.

        Parameters:
        activity - the Activity
        videoView - the BaseVideoView
      • unregisterActivity

         void unregisterActivity(Activity activity)

        Unregister the previously registered activity and clean its references.

        Parameters:
        activity - the activity to unregister.
      • enterPictureInPictureMode

         void enterPictureInPictureMode()

        This method puts the registered Activity into Picture-in-Picture mode.This method is only supported for Android versions equal or greater than O,otherwise the method will not do anything.

      • isInPictureInPictureMode

         boolean isInPictureInPictureMode()

        Checks if there is a registered activity and calls that activitymethod isInPictureInPictureMode.This only applies for Android Oreo or higher, otherwise it will always return false.

      • isPictureInPictureEnabled

         boolean isPictureInPictureEnabled()

        PictureInPictureManager will be disabled if there is no Activity registered orif the Activity previously registered was destroyed.This only applies for Android Oreo or higher, otherwise it will always return false.PictureInPictureManager will be temporarily disabled if the current videois a 360 video, which is currently not supported in Picture-in-Picture mode.