This repository was archived by the owner on May 23, 2025. It is now read-only.
Correct backgrounding behavior for both video and audio (does not work)#4162
Draft
mcclure wants to merge 4 commits intotuskyapp:developfrom
Draft
Correct backgrounding behavior for both video and audio (does not work)#4162mcclure wants to merge 4 commits intotuskyapp:developfrom
mcclure wants to merge 4 commits intotuskyapp:developfrom
Conversation
Uses KEEP_SCREEN_ON for video, WAKE_LOCK for audio. Requests WAKE_LOCK permission.
This was referenced Dec 11, 2023
|
Do you mind if I take a look at getting this hooked up with the foreground service? |
Collaborator
Author
|
Feel free, I am no longer looking at this as I do not have background with the parts that need to be connected. |
Contributor
|
This pull request is now outdated and should either be closed or rewritten. Here are a few updates:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #4161 for full explanation.
This is a followup to #4160. It causes keep-screen-alive to only occur for videos (and GIFVs), and for audio attachments it uses setWakeMode (with the required permission added to AndroidManifest.xml). This patch does not work. I can confirm we are hitting the setWakeMode branch*, but when the screen goes to sleep the audio also stops. The documentation says that setWakeMode "should be used together with a foreground android.app.Service for use cases where playback occurs and the screen is off (e.g. background audio playback)", and we have a foreground service but there is no specific provision to switch the audio playback from the activity to the foreground service. I do not know what to do from here.
If the foreground service could assume audio playback, would that mean we could allow audio attachments to keep playing even after the user switches to another app? I think that would be pretty neat.
* I added a log.d to the setWakeMode if, and it printed. I looked in the logcat and there were no warnings around the setWakeMode indicating a permission denial or anything. One minute later I see in the log:
ActivityTrigger activityPauseTriggerI then immediately see a bunch of audio-related messages I can't decipher, such as:
There were more similar messages after this but I didn't catch them all before they cleared. Various objects claiming both that the music is playing and is not playing.