-
Notifications
You must be signed in to change notification settings - Fork 46
fix(llc): fix for multitasking camera enabling on iOS #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds an Unreleased changelog entry documenting an iOS camera multitasking fix. In code, updates setCameraEnabled to conditionally enable iOS multitasking camera access only once and persist its state, preventing repeated enable calls when toggling the camera. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as Call UI
participant Call as Call.setCameraEnabled
participant iOS as iOS Camera API
participant SM as StateManager
User->>UI: Toggle Camera (on/off)
UI->>Call: setCameraEnabled(enabled)
alt enabled == true
Call->>SM: Read iOSMultitaskingCameraAccessEnabled
opt if not enabled yet
Call->>iOS: setMultitaskingCameraAccessEnabled(true)
iOS-->>Call: result (enabled/err)
Call->>SM: Update multitaskingEnabled state
end
Call->>SM: participantSetCameraEnabled(true, multitaskingEnabled)
else enabled == false
Call->>SM: participantSetCameraEnabled(false, current multitaskingEnabled)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(None) Possibly related PRs
Suggested reviewers
Poem
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/stream_video/CHANGELOG.md (1)
3-4: Polish the entry for clarity and consistency.Minor grammar and style tweak; also cross-reference the issue.
-🐞 Fixed -* Multitasking camera on iOS is now enabled only once and kept enabled. This fixes potential errors when quickly toggling camera. +🐞 Fixed +* Multitasking camera on iOS is now enabled only once and kept enabled, preventing errors when rapidly toggling the camera. See #1057.packages/stream_video/lib/src/call/call.dart (2)
2604-2612: Avoid unnecessary platform call and preserve previous state on failure.
- Skip the helper call when we know we won’t enable (mute-in-background).
- Don’t overwrite to false on failure; retain previous state to avoid UI/state drift.
- var multitaskingEnabled = state.value.iOSMultitaskingCameraAccessEnabled; - if (enabled && !multitaskingEnabled) { - // Set multitasking camera access for iOS - final multitaskingResult = await setMultitaskingCameraAccessEnabled( - enabled && !_streamVideo.options.muteVideoWhenInBackground, - ); - - multitaskingEnabled = multitaskingResult.getDataOrNull() ?? false; - } + var multitaskingEnabled = state.value.iOSMultitaskingCameraAccessEnabled; + final shouldEnableMultitasking = enabled && + !multitaskingEnabled && + !_streamVideo.options.muteVideoWhenInBackground; + if (shouldEnableMultitasking) { + // Set multitasking camera access for iOS + final multitaskingResult = + await setMultitaskingCameraAccessEnabled(true); + // Preserve previous value if the call fails. + multitaskingEnabled = + multitaskingResult.getDataOrNull() ?? multitaskingEnabled; + }
2632-2634: Correct permission error message.Minor copy fix: it’s audio, not video.
- if (enabled && !hasPermission(CallPermission.sendAudio)) { - return Result.error('Missing permission to send video'); + if (enabled && !hasPermission(CallPermission.sendAudio)) { + return Result.error('Missing permission to send audio');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
packages/stream_video/CHANGELOG.md(1 hunks)packages/stream_video/lib/src/call/call.dart(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: stream_video_screen_sharing
- GitHub Check: stream_video_noise_cancellation
- GitHub Check: stream_video_push_notification
- GitHub Check: stream_video_flutter
- GitHub Check: stream_video
- GitHub Check: build
- GitHub Check: analyze_legacy_version
- GitHub Check: analyze
🔇 Additional comments (1)
packages/stream_video/lib/src/call/call.dart (1)
2604-2617: Good fix: enable once, keep enabled.This guards against repeated enable/disable flapping on iOS and should mitigate the AVCaptureMultiCamSession exception during rapid toggles.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1061 +/- ##
========================================
- Coverage 4.83% 4.83% -0.01%
========================================
Files 577 577
Lines 38830 38831 +1
========================================
Hits 1877 1877
- Misses 36953 36954 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
resolves FLU-245, #1057
This PR fixes an issue on iOS where rapidly toggling the camera could trigger an error related to AVCaptureMultiCamSession. The multitasking camera is now enabled once and remains enabled, rather than being repeatedly toggled with each camera switch.
Summary by CodeRabbit
Bug Fixes
Documentation