Create a Music Playing state that you can use as a profile condition

%MTRACK doesn't usually work so learn how to create a profile that enables when music is playing

  1. joaomgcd
    In this example we're going to create an all black screen whenever music is playing.

    On this screen you can swipe down to stop playing music.

    You can add more commands to skip to the next or previous track if you want, but for now this'll be the flow:
    • If music starts playing your screen will be pitch black, great for AMOLED devices
    • if you swipe down on the screen music will stop and the screen will go away
    This is how it'll look like in the end:


    STEP 1 - PROFILE THAT SETS MUSICPLAYING VARIABLE


    (i) Most music apps will update a notification whenever music stops or starts playing so this is a great event to check if music is playing or not and set a global variable with the value

    • Create a new profile with the AutoNotification Intercept event condition
    • Select the music apps you're interested in knowing if they're playing music or not. In this example I selected Google Play Music
    • Accept and create an entry task
    • In the task add an AutoTools System State action and check the Audio option
    • Accept and add a Variable Set action that sets %MusicPlaying to %atmusicplaying
    (i) Now every time a music app's notification is updated the %MusicPlaying variable will be updated with the music playing status


    STEP 2 - PROFILE THAT ENABLES WHEN MUSIC IS PLAYING


    • Create a new profile with the Variable Value state condition
    • Set the Condition to %MusicPlaying matches true
    • Create an entry task and add a Flash action with the text Music is playing!
    (i) If you want you can add more conditions like for example, only do this if you're connected to your car bluetooth radio so that this only happens when in your car


    STEP 3 - SHOW GESTURES SCREEN


    • Add an AutoTools Gestures Screen action
    • Set the AutoApps commands -> Swipes -> Down -> Distances field to 100 and the Commands field to stopplaying
    (i) This will make the stopplaying command be sent whenever you swipe down on the screen more than 100 dip.
    (i) You can add other commands here like playnext on right swipe and swipeleft on left swipe for example. You'd need other profiles to handle these commands like the one we're creating next.
    • Set the Background Color to black
    • Accept and go back to the task
    /!\ If you want you can add a Status Bar -> Collapsed action to make sure that the notification tray goes away when music starts playing


    STEP 4 - STOP PLAYING ON COMMAND


    • Create a new profile with the AutoApps Command condition
    • Set the Command Filter to stopplaying
    • Accept and create the entry task
    • Add a Media Control action with the Stop command
    (i) Whenever the stopplaying command is issued Tasker will now stop whatever music app is playing


    STEP 5 - CLOSE GESTURES SCREEN IF MUSIC STOPS


    • Go back to the profile with the Variable Value condition and add an Exit Task
    • Add a Flash action with the text Music stopped!
    • Add an AutoTools Gestures Screen and select the Close Screen option.
    • Back out of Tasker to save


    STEP 6 - TEST


    If you now start playing music in any of the apps selected in the AutoNotification Intercept profile the screen will show up.

    If you swipe down on the screen music will stop and the screen will go away.

    Don't forget to only make this screen show up when you really need it, like in your car or when you're going to sleep, etc. :cool:

Recent Reviews

  1. alienclone
    alienclone
    5/5,
    step 1 has cleaned up my previous %musicisplaying mess. i now have a 100% reliable way to monitor music playing.
  2. froz
    froz
    5/5,
    Nice. A reliable alternative for %MTRACK at last.