Skip to content

Conversation

@rahul-lohra
Copy link
Contributor

@rahul-lohra rahul-lohra commented Oct 22, 2025

Goal

In the existing implementation, the SDK automatically entered Picture-in-Picture (PiP) mode without giving clients any control over this behavior.
This PR introduces a new API that allows clients to override and customize the PiP behavior, including whether automatic entry is enabled and how PictureInPictureParams are configured.

The goal is to make PiP handling more flexible and composable-friendly, ensuring that clients using either the SDK Activity, Compose UI, or both can define their preferred PiP entry logic and parameters.

Implementation

We introduced this configuration named PictureInPictureConfiguration

/**
 * Configuration for controlling Picture-in-Picture (PiP) behavior within a call UI.
 *
 * @property enable
 * Indicates whether Picture-in-Picture mode should be enabled for this call.
 * When `true`, the SDK will handle entering PiP mode automatically when appropriate
 * (for example, when the user navigates away from the app during an active call).
 *
 * @property autoEnterEnabled
 * Determines whether to call [android.app.PictureInPictureParams.Builder.setAutoEnterEnabled]
 * when configuring the PiP parameters. When `true`, the system automatically enters PiP mode
 * when the user presses the home button or performs an equivalent action. Set this to `false`
 * if you prefer to manually control when PiP mode should be entered.
 */
@Parcelize
public data class PictureInPictureConfiguration(
    val enable: Boolean,
    val autoEnterEnabled: Boolean = true,
) : Parcelable

PictureInPictureConfiguration can now be passed through all UI entry points:

  1. StreamCallActivity – via Intent extra named EXTRA_STREAM_CONFIG
  2. AbstractCallActivity – by overriding getPictureInPictureConfiguration()
  3. CallContent – via a function parameter
  4. CallScreen – via a function parameter
  5. AudioRoomContent – via a function parameter

API Updates and Deprecations

The following APIs that previously used the enableInPictureInPicture deprecated and replaced with a new, more flexible PictureInPictureConfiguration parameter.

Deprecated API Replacement API
@composable fun CallScreen(call: Call, showDebugOptions: Boolean = false, onCallDisconnected: () -> Unit = {}, onUserLeaveCall: () -> Unit = {}) @composable fun CallScreen(..., pictureInPictureConfiguration: PictureInPictureConfiguration? = null)
@composable fun CallContent(..., enableInPictureInPicture: Boolean) @composable fun CallContent(..., pictureInPictureConfiguration: PictureInPictureConfiguration(true, true))
@composable fun AudioRoomContent(..., enableInPictureInPicture: Boolean) @composable fun AudioRoomContent(..., pictureInPictureConfiguration: PictureInPictureConfiguration(true, true))

Testing

Smoke test pip in video-call

@rahul-lohra rahul-lohra self-assigned this Oct 22, 2025
@rahul-lohra rahul-lohra requested a review from a team as a code owner October 22, 2025 06:42
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@rahul-lohra rahul-lohra added the pr:improvement Enhances an existing feature or code label Oct 22, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 11.74 MB 11.74 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.25 MB 6.27 MB 0.02 MB 🟢

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
4.0% Coverage on New Code (required ≥ 80%)
39.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@rahul-lohra rahul-lohra changed the title Enhance PiP behavior with user-provided configuration support [AND-842] Enhance PiP behavior with user-provided configuration support Oct 22, 2025
@rahul-lohra rahul-lohra changed the title [AND-842] Enhance PiP behavior with user-provided configuration support Enhance PiP behavior with user-provided configuration support Oct 22, 2025
@aleksandar-apostolov aleksandar-apostolov merged commit f01f04a into develop Oct 24, 2025
20 of 23 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the feature/rahullohra/pip-configuration branch October 24, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Enhances an existing feature or code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants