BlazePiPManager
BlazePiPManager provides access to Picture-in-Picture (PIP) controls and state for the Videos player. It is accessible via BlazeSDK.pipManager.
Use it to:
- Check whether a PIP session is currently active
- Receive callbacks when PIP state changes (via delegate)
- Programmatically stop an active PIP session
PIP requires Android 8.0 (API level 26) or higher.
Properties
isActive
val isActive: BooleanWhether a PIP session is currently active. Updated automatically as the PIP state changes.
delegate
var delegate: BlazePipDelegate?Set to receive PIP state change callbacks. Callbacks are delivered on the main thread.
Methods
stopActivePiPSession
fun stopActivePiPSession()Stops the active PIP session and dismisses the player. Has no effect if PIP is not currently active.
BlazePipDelegate
Set BlazeSDK.pipManager.delegate to an implementation of BlazePipDelegate to be notified whenever PIP state changes.
onPipStateChanged
fun onPipStateChanged(playerType: BlazePlayerType, sourceId: String?, newState: BlazePipState)Called whenever the PIP state changes for any player in the SDK.
Parameters:
- playerType: The type of player for which the PIP state changed (e.g.
VIDEOS). - sourceId: Optional identifier for the entry point that triggered the player.
- newState: The new PIP state — either
BlazePipState.ON(PIP started) orBlazePipState.OFF(PIP stopped).
BlazePipState
enum class BlazePipState {
ON,
OFF
}| Value | Description |
|---|---|
ON | A PIP session is currently active. |
OFF | PIP is not active or has been stopped. |
Using PIP with the Inline Player
When a user moves the fullscreen player into PIP mode, the same content continues playing in the PIP window. If you have an inline Videos player on the same screen, you should pause it to avoid playing two streams simultaneously and resume it once PIP ends.
Use pausePlayer() / resumePlayer() on your BlazeVideosInlinePlayer instance (view-based) or on your BlazeVideosInlinePlayerComposeStateHandler instance (Compose):
BlazeSDK.pipManager.delegate = object : BlazePipDelegate {
override fun onPipStateChanged(
playerType: BlazePlayerType,
sourceId: String?,
newState: BlazePipState
) {
when (newState) {
BlazePipState.ON -> myInlinePlayer.pausePlayer()
BlazePipState.OFF -> myInlinePlayer.resumePlayer()
}
}
}Updated about 2 months ago
