VideoPlaybackPictureInPicture


public final class VideoPlaybackPictureInPicture extends BasicPictureInPicture implements AutoCloseable


Picture-in-Picture implementation optimized for Video Playback applications.

Enables seamless resize and allows tracking a View to automatically update the source rectangle hint for smooth animations using the package's ViewBoundsTracker.

Summary

Public constructors

Public methods

void

Releases resources used by this implementation, such as the ViewBoundsTracker.

final @NonNull VideoPlaybackPictureInPicture

Sets the View to be tracked for updating the source rectangle hint.

Inherited methods

From androidx.core.pip.BasicPictureInPicture
final @NonNull PictureInPictureParamsCompat.Builder
final @NonNull BasicPictureInPicture

Sets the custom actions to be available in the Picture-in-Picture menu.

final @NonNull BasicPictureInPicture

Sets the desired aspect ratio for the Picture-in-Picture window.

final @NonNull BasicPictureInPicture
setEnabled(boolean enabled)

Sets whether the activity should automatically enter Picture-in-Picture mode when eligible (e.g., when swiping to home).

From androidx.core.pip.PictureInPictureDelegate
final void

Adds OnPictureInPictureEventListener for events sent from system.

final void

Removes OnPictureInPictureEventListener for events sent from system.

final void
setPictureInPictureParams(
    @NonNull PictureInPictureParamsCompat pictureInPictureParamsCompat
)

Sets the PictureInPictureParamsCompat instance for PiP.

Public constructors

VideoPlaybackPictureInPicture

Added in 1.0.0-alpha02
public VideoPlaybackPictureInPicture(
    @NonNull PictureInPictureProvider provider
)

Public methods

close

Added in 1.0.0-alpha02
public void close()

Releases resources used by this implementation, such as the ViewBoundsTracker. Call this when the implementation is no longer needed (e.g., in Activity.onDestroy).

setPlayerView

Added in 1.0.0-alpha02
public final @NonNull VideoPlaybackPictureInPicture setPlayerView(View view)

Sets the View to be tracked for updating the source rectangle hint. The bounds of this View (e.g., the player view) will be used to ensure smooth entry/exit animations into/out of Picture-in-Picture.

Parameters
View view

The View to track, or null to stop tracking and clear the hint.

Returns
@NonNull VideoPlaybackPictureInPicture

This implementation instance for chaining.