Skip to content
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

deactivate "Resume Playback" after phone call (make it configurable) #500

Closed
andrenam opened this issue Apr 30, 2015 · 3 comments
Closed

Comments

@andrenam
Copy link

I'd like to turn off the feature that resumes playback after a phone call,
because I often disconnect my headphones before taking a call. If the playback resumes after the call, the music will be played on the device speakers which is often not what I want.
It would be cool if one could switch off/on that feature.

If I need to patch that myself, I just have to comment out that line in DownloadServiceLifecycleSupport.java, right?

diff --git a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
index c9f92f4..788a1b8 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java
@@ -431,7 +431,7 @@ public class DownloadServiceLifecycleSupport {
                            if (resumeAfterCall) {
                                resumeAfterCall = false;
                                if(downloadService.getPlayerState() == PlayerState.PAUSED_TEMP) {
-                                   downloadService.start();
+                                   //downloadService.start();
                                }
                            }
                            break;
@daneren2005
Copy link
Owner

I'm not making that optional, especially when your given scenario it should already work fine. I tested it on a few different phones I have and when you unplug headphones during a call, it should not resume playing once you start again.

In https://github.com/daneren2005/Subsonic/blob/master/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java#L427 it goes into the state PAUSED_TEMP. Headphones being unplugged should trigger https://github.com/daneren2005/Subsonic/blob/master/app/src/main/java/github/daneren2005/dsub/receiver/AudioNoisyReceiver.java#L46 which puts it in the PAUSED state if it was either playing or in the PAUSED_TEMP state before. On resume, https://github.com/daneren2005/Subsonic/blob/master/app/src/main/java/github/daneren2005/dsub/service/DownloadServiceLifecycleSupport.java#L433 checks to make sure it is still in PAUSED_TEMP. Since it is now in the PAUSED state, it does not resume playback.

The only setting which should effect this behavior is Pause on Disconnect, which would obviously make it so that it is not pausing when you disconnect your headphones. If you have not changed that, I imagine you will need to do some debugging to see what isn't being triggered correctly.

@andrenam
Copy link
Author

andrenam commented May 1, 2015

Hi, my bad. It was indeed the "pause on disconnect" setting. logcat tells me that Dsub switches from PAUSED_TEMP to PAUSED when I set "pause on disconnect" to "pause". Thanks for the help. :)

I didn't realize "pause on disconnect" had anything to do with the headphones/headset. I assumed it had to with the connection to the subsonic streaming server. The german translation "Verbindungsverlust" literally means "loss of connection". Perhaps it would be best to adjust the label and specifically mention headphones/headsets.

@daneren2005
Copy link
Owner

I have asked the guy who does the german translations to update it with a better translation. I'm not really sure if he will see that message though (Github sometimes makes it hard to communicate directly with people).

thknepper added a commit to thknepper/DSub that referenced this issue May 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants