-
Notifications
You must be signed in to change notification settings - Fork 226
Improve audio focus management #4707
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
(and remove a duplicated one)
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4707 +/- ##
===========================================
- Coverage 80.11% 80.07% -0.04%
===========================================
Files 2126 2129 +3
Lines 56303 56354 +51
Branches 7021 7028 +7
===========================================
+ Hits 45107 45128 +21
- Misses 8780 8810 +30
Partials 2416 2416 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thanks, it was relatively easy to test using split screen with EXA an another media app.
} | ||
AudioManager.AUDIOFOCUS_LOSS, | ||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT, | ||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> { |
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.
Maybe ignore it for the _CAN_DUCK
variant if the requester is the media viewer? https://developer.android.com/media/optimize/audio-focus#automatic-ducking
Apparently the OS will automatically duck the audio in that case, but we shouldn't do it for voice-related audio (messages, call).
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.
Reading the doc again, I think I can improve the code behavior yes. I will add more commits.
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.
OK, so I was about to check the result of the audio focus requester to prevent the start of the play back, but it seems that (well, on my phone at least) when there is an active call, the audio is ducked automatically by the system. Other apps does not always prevent playback during a phone call, for instance:
- Netflix: cannot play
- Youtube and Spotify: can start playback, but ducked.
So without doing anything, Element will have the same behavior than Youtube and Spotify, which is probably acceptable.
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.
Sounds good to me! Thanks for the changes and the documentation.
Yes, it's also possible to perform such tests using a video app (Youtube, Netflix, etc.) in Pip mode. |
|
Content
Motivation and context
Closes #4617 and better integration with the system.
Screenshots / GIFs
No change in the UI
Tests
Tested devices
Checklist