Hello, I am trying to implement Picture in Picture...
# sdk-native
l
Hello, I am trying to implement Picture in Picture, using Livekit Flutter Sdk. Android works fine, but when I minimize the app, camera stops working and I am seeing black screen on PiP. I didn’t find solution, what can be a reason, or does it work in PiP iOS at all?
r
I am not sure but maybe this will help. Looking at the docs looks like we describe how to do background mode with audio. This is outside my area of expertise but I asked our Codebase LLM and this is what it suggests: The issue you're encountering with Picture-in-Picture (PiP) on iOS using the LiveKit Flutter SDK may stem from several factors related to iOS's handling of background tasks and the specific requirements for enabling PiP functionality. 1. Background Modes: For PiP to work correctly on iOS, you need to ensure that your app has the appropriate background modes enabled. Specifically, you must enable "Audio, AirPlay, and Picture in Picture" in the Background Modes section of your app's capabilities in Xcode. This allows your app to continue processing audio and video even when it is minimized or running in the background README.md#L45-L64. 2. AVAudioSession Configuration: The
AVAudioSession
must be configured correctly to allow audio to continue playing when the app is in the background. This is crucial for maintaining the video feed in PiP mode. You should ensure that your audio session is set up to handle background audio reference. 3. Camera and Microphone Permissions: Ensure that your
Info.plist
file includes the necessary permissions for camera and microphone usage. Without these permissions, the camera may not function correctly when the app is minimized README.md#L79-L119. 4. Flutter Background Services: If you are using any background services (like
flutter_background_service
), ensure that they do not conflict with the LiveKit's audio visualizer or video rendering. Conflicts can lead to issues where the camera feed does not display correctly in PiP mode reference. 5. Testing on Real Devices: Note that PiP functionality may not work as expected in the iOS simulator. Always test on a physical device to ensure that all features, including PiP, function correctly README.md#L202-L254. If you have checked all these configurations and the issue persists, you may want to look into any specific logs or error messages that could provide further insight into what might be going wrong. Notes • Ensure that your app's deployment target is set to at least iOS 12.1, as this is a requirement for using the LiveKit Flutter SDK README.md#L79-L119. • If you are still having issues, consider checking for updates to the LiveKit Flutter SDK and related dependencies, as newer versions may contain bug fixes or improvements related to PiP functionality. Refs: • https://github.com/livekit-examples/swift-example-collection/blob/main/minimal-pip/README.md#L1-L16 • https://github.com/livekit/client-sdk-flutter/blob/main/README.md#L1-L64 • https://github.com/livekit/client-sdk-flutter/blob/main/README.md#ios