Skip to content

Commit

Permalink
fix(Android): fixes ending the call when in PiP (#822)
Browse files Browse the repository at this point in the history
* fixes ending the call when in PiP

* changelog added
  • Loading branch information
Brazol authored Jan 10, 2025
1 parent 06ab616 commit 52df588
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
9 changes: 6 additions & 3 deletions packages/stream_video_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
## Unreleased

🚧 Breaking changes
* The package is now compatible with Gradle 8. The minimum required Java version is now 17.
* Updated the `flutter_callkit_incoming` package to version 2.5.0, which also requires Java 17.
* https://github.com/GetStream/stream-video-flutter/pull/820: The package is now compatible with Gradle 8. The minimum required Java version is now 17.
* https://github.com/GetStream/stream-video-flutter/pull/820: Updated the `flutter_callkit_incoming` package to version 2.5.0, which also requires Java 17.

✅ Added
* Added out-of-the-box support for blur background filters and image filters. As well as the option to create custom video filters. For complete documentation of those features please check [here.](https://getstream.io/video/docs/flutter/advanced/apply-video-filters/)
* https://github.com/GetStream/stream-video-flutter/pull/799: Added out-of-the-box support for blur background filters and image filters. As well as the option to create custom video filters. For complete documentation of those features please check [here.](https://getstream.io/video/docs/flutter/advanced/apply-video-filters/)

🐞 Fixed
* https://github.com/GetStream/stream-video-flutter/pull/822: Fixed issues when ending the call while in Picture in Picture mode on Android.

## 0.6.1

Expand Down
1 change: 0 additions & 1 deletion packages/stream_video_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ android {
implementation 'androidx.media:media:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "io.github.crow-misia.libyuv:libyuv-android:0.34.0"
implementation "androidx.annotation:annotation:1.8.0"
implementation 'com.google.mlkit:segmentation-selfie:16.0.0-beta5'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ class PictureInPictureHelper {
const val PIP_ENABLED_PREF_KEY = "pip_enabled"

fun disablePictureInPicture(activity: Activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (activity.isInPictureInPictureMode) {
activity.moveTaskToBack(true)
}

val params = PictureInPictureParams.Builder()
params.setAutoEnterEnabled(false)
activity.setPictureInPictureParams(params.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ class _StreamCallParticipantsState extends State<StreamCallParticipants> {

@override
Widget build(BuildContext context) {
if (widget.layoutMode == ParticipantLayoutMode.pictureInPicture) {
if (_participants.isNotEmpty &&
widget.layoutMode == ParticipantLayoutMode.pictureInPicture) {
return widget.callParticipantBuilder(
context,
widget.call,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ class _StreamCallContentState extends State<StreamCallContent>
WidgetsBinding.instance.removeObserver(this);
}
}

if (widget.callState.status != oldWidget.callState.status) {
if (widget.callState.status.isDisconnected) {
StreamVideoFlutterBackground.setPictureInPictureEnabled(enable: false);
}
}
}

@override
Expand Down

0 comments on commit 52df588

Please sign in to comment.