VideoPlaybackPictureInPicture


class VideoPlaybackPictureInPicture : BasicPictureInPicture, 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

VideoPlaybackPictureInPicture(
    provider: PictureInPictureProvider,
    executor: Executor
)

Public functions

open Unit

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

VideoPlaybackPictureInPicture

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

Inherited functions

From androidx.core.pip.BasicPictureInPicture
Unit

Commits the changes made through the setter methods and applies them to the current Picture-in-Picture session.

BasicPictureInPicture

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

BasicPictureInPicture
setAspectRatio(aspectRatio: Rational)

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

BasicPictureInPicture
setEnabled(enabled: Boolean)

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

From androidx.core.pip.PictureInPictureDelegate

Public constructors

VideoPlaybackPictureInPicture

Added in 1.0.0-alpha03
VideoPlaybackPictureInPicture(
    provider: PictureInPictureProvider,
    executor: Executor
)
Parameters
provider: PictureInPictureProvider

PictureInPictureProvider instance that this delegate will call into for actual Picture-in-Picture functionalities.

executor: Executor

The executor to use for applying the Picture-in-Picture parameters. It is recommended to use a background executor to offload these framework calls from the main thread.

Public functions

close

Added in 1.0.0-alpha03
open fun close(): Unit

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-alpha03
fun setPlayerView(view: View?): VideoPlaybackPictureInPicture

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.

Callers must invoke commit to apply the changes.

Parameters
view: View?

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

Returns
VideoPlaybackPictureInPicture

This implementation instance for chaining.