Getting Spotify to stop playing when using picture in picture Youtube Vanced

162 views
Skip to first unread message

-_-

unread,
Jul 30, 2018, 5:58:18 PM7/30/18
to Tasker
Hi all,

I've gotten the following tasker setup working:
  1. When headset plugged in
  2. Play [Simulated Only] in Spotify app
  3. Wait 5 seconds
Now I've added an exception for Youtube Vanced, so that if I have it open, it won't be overridden by Spotify using the Invert App function.

However, when I press the home key to enable picture-in-picture mode, Spotify starts up and pauses Vanced. How can I work around this?

I've been playing around with AutoInput UI Query this but still haven't been able to get this to work.

  1. App package: com.google.android.apps.nexuslauncher (when it was in pip mode).
  2. Media Control: Cmd > Stop (Simulate Media Button On) > App: Spotify
Spotify is still overriding, where am I going wrong here?

Much appreciated for the help!

João Dias

unread,
Aug 1, 2018, 7:55:11 AM8/1/18
to tas...@googlegroups.com
Sorry, what do you that spotify overrides it? What does that mean exactly?

Thanks

Noel Yap

unread,
Aug 3, 2018, 5:21:06 PM8/3/18
to tas...@googlegroups.com
It sounds like the App condition for YouTube is retiring as "negative" when running in PIP. You should be able to verify this by opening up Tasker and seeing whether or not that condition is green.

As for what can be done about it, I don't know. Maybe look through the available going variables to see if there are any that report currently running applications.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

-_-

unread,
Aug 7, 2018, 4:22:35 AM8/7/18
to Tasker
Hi Joao, apologies on the delay. 

When I have Vanced open as PIP, the task seems to start up again and play Spotify, as if the headphones were just inserted. I've tried setting a limit number of repeats as well as a cooldown time, but this obviously just delays the issue.

Is there a way to detect that Vanced is running and prevent this from happening?

Thanks

-_-

unread,
Aug 15, 2018, 8:27:15 AM8/15/18
to Tasker
I've gotten the following task, which uses the AutoTools state to check for playing media.

Profile: AutoSpotify (38)
Restore: no Enforce: no Notification: no
State: Headset Plugged [ Type:Any ]
Application: Not YouTube Vanced or Messenger
Enter: SpotifyAutoShuffle (46)
A1: AutoTools System State [ Configuration:Audio: true Timeout (Seconds):0 ] 
A2: Stop [ With Error:Off Task: ] If [ %atmusicplaying ~ true ]
A3: Wait [ MS:250 Seconds:0 Minutes:0 Hours:0 Days:0 ] 
A4: Flash [ Text: Media playing Spotify stopped%atmusicplaying Long:Off ] If [ %atmusicplaying ~ false ]
A5: Wait [ MS:0 Seconds:2 Minutes:0 Hours:0 Days:0 ] 
A6: Flash [ Text:Starting shuffle... Long:Off ] If [ %atmusicplaying ~ false ]
A7: Launch App [ App:Spotify Data: Exclude From Recent Apps:On Always Start New Copy:On ] 

However, whenever I go into another application, Spotify seems to start back up again. I had thought that by using true/false variables to check for running media would solve this but apparently not. Any ideas?

João Dias

unread,
Aug 15, 2018, 11:20:19 AM8/15/18
to tas...@googlegroups.com
That happens because you're not in YouTube Vanced or Messenger, right? :)

What exactly did you mean to happen?

--

-_-

unread,
Aug 15, 2018, 12:06:53 PM8/15/18
to Tasker
What I mean to happen is: 

1. Plug my headphones in
2. IF NOT in Vanced or Messenger, launch Spotify and do the AutoInput shuffle stuff (which works).
3. If Vanced is in picture in picture mode, DO NOT launch Spotify. (Should probably extend this to messenger as well).

I've come across a workaround that checks if there is any media playing, using THIS task, which checks if there is any media playing. There is a %is_playing variable that is set to null, then IsMusicPlaying task runs, sets it to true or false, and I use a Stop if %is_playing ~ false. 

So far this seems to work, ONLY when media is running. When YouTube Vanced is paused, however, it has a notification but for some reason, I cannot get the Notification Listener plugin to do a Stop on my original AutoShuffle task.

Is there any way to detect that YouTube Vanced is in the background and prevent it from launching the AutoShuffle task?
Reply all
Reply to author
Forward
0 new messages