Which app is playing media

132 views
Skip to first unread message

Yoan

unread,
Dec 29, 2025, 8:45:35 PM (13 days ago) 12/29/25
to Tasker
Hi everyone,
Is there a event that can be triggered when there is a change of which app is playing media?

My issue: in my car, I have a standalone Android device running CarPlay navigation (connected to iPhone) and playing music (using the built-in audio player) at the same time. The navigation volume (from CarPlay) is way too low compared to the music volume. Both streams are treated as media, so I can't adjust the volume of one relative to the other.
There's also no volume control in the CarPlay settings.
I haven't found an app that can manage media volume individually by app (the menu SoundMaster of ShizuTools does not open and Volume manager needs Android 13 but my device is 12).

So my idea was to use Tasker to know which app is streaming and change the volume accordingly. Is there a way? I have tried with the event "Music track change" but it is never triggered.
Or I am open to any other idea that can fix my issue ?

Thanks in advance for your help :)

Chris Pque

unread,
Dec 29, 2025, 10:42:35 PM (13 days ago) 12/29/25
to Tasker
I don't know if this will work on non rooted but I use a combination of "dumpsys media.audio_flinger" and "dumpsys bluetooth_manager" on my rooted Android. 

Yoan

unread,
Dec 29, 2025, 10:46:05 PM (13 days ago) 12/29/25
to Tasker
Thanks for your answer 
Can you please give me more details, what event/action do you use? 

Chris Pque

unread,
Dec 29, 2025, 11:04:06 PM (13 days ago) 12/29/25
to tas...@googlegroups.com
Use "run shell" action. I tried and some can run without root. There are 3 command finally :

dumpsys media_session
dumpsys media.audio_flinger
dumpsys bluetooth_manager


FYI NovaLauncher (and other apps) can show the current app playing, maybe using Java API (Java function in Tasker) can work. Did you try ?

--
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.
To view this discussion visit https://groups.google.com/d/msgid/tasker/973f0b93-d123-4bc0-bfc3-6eb7a679df07n%40googlegroups.com.

Chris Pque

unread,
Dec 29, 2025, 11:31:03 PM (13 days ago) 12/29/25
to tas...@googlegroups.com
I tried the "music track changed", it worked but some apps don't expose correctly the fact that they are playing media (example even YouTube when it's fourground). Maybe this is your issue. 

Also, on Android (I don't know since which version, probably 12 is OK) but when most apps are playing music there is a "audio session" notification that naturally appears. 

You can simply poll all your notifications to know if your app is focusing it's audio --> you dont need a plug-in I think but if you have "AutoNotification" plug-in it will be easier : you create an event, select AutoNotification as event and filter the notifications by selecting "only media session" check box. This should be OK for most use cases. 

On Tue, Dec 30, 2025, 04:46 Yoan <yoan...@gmail.com> wrote:
--

Brenden M

unread,
Dec 31, 2025, 5:23:42 AM (12 days ago) 12/31/25
to Tasker
You mention being open to other ideas. Can you use a custom notification??

Something that occurs to me which is potentially too simple to be very clever is to note that the Loudness Units Full Scale or on another scale the RMS level of a lot of professionally mastered music is on the order of "-14" or higher...

Without explaining too much, a notification for an app might have at least two contributing deficiencies: 1) a lower volume overall, and 2) hard to distinguish frequencies and time envelope when your vehicle is moving and music is playing.

Depending on needs and tolerance, a 'single' notification that is 3 or 4 'pulses' of sound, at about 3-6 kHz (where speech sounds, baby screams, and seagulls reign), at a level of about -17 or -14 LUFS should get through the mud and energy of driving and music.

I believe that most brains that can make such a thing happen will learn to recognize such a sound piercing through nearly every time, unless you listen to super squelchy acid breakcore or noise metal a lot, or something, haha.

Yoan

unread,
Dec 31, 2025, 5:44:10 PM (11 days ago) 12/31/25
to Tasker
@pcp
It seems when something is played by CarPlay, the following is in mesia_session:
A2dpMediaBrowserService com.android.bluetooth/A2dpMediaBrowserService (userId=0)
      ownerPid=6979, ownerUid=1002, userId=0
      package=com.android.bluetooth
      launchIntent=null
      mediaButtonReceiver=null
      active=true
      flags=3
      rating type=0
      controllers: 1
      state=null
      audioAttrs=AudioAttributes: usage=USAGE_MEDIA content=CONTENT_TYPE_UNKNOWN flags=0x0 tags= bundle=null
      volumeType=1, controlType=2, max=0, current=0
      metadata:size=0, description=null
      queueTitle=null, size=0

Is that correct? But how to test that? Any event could help or should I test it every seconds ?


@Brenden
I am not sure I understood your suggestion. Do you propose to play a sound? But when?


Thank you for your help :)

Brenden M

unread,
Jan 1, 2026, 1:52:35 AM (11 days ago) Jan 1
to Tasker
Oh! It was late and I misread the issue. You're missing the navigation instructions due to their low volume. I interpreted or read that "notifications" were too low. I suppose the navigation is voice, so my suggestion won't help.

Something else that occurs to try is making the outputs different, one media and one another, so you can control the volume, but still find a way to get the stream to your ears. From one perspective, the media, notification, and ringer, etc., are just virtual channels being latched onto.

The "Bluetooth stream" I think is probably combining the media, ringer, and notification in relative proportions.

Something else that occurs to me: music generally is so much louder, and several music playing apps do indeed have a dedicated volume control, so lowering the music volume with the music app may be a possibility. To compensate for wanting loud enough music, turning up the overall car volume might be easy.

Chris Pque

unread,
Jan 1, 2026, 3:07:03 AM (11 days ago) Jan 1
to tas...@googlegroups.com
You need output the command when you play also the music. You need to compare each use case, when playing music alone, when playing music and the navigation, and when playing the navigation alone. 

You need to execute for each condition the three shell command line, hopefully you will find the string that changes in the output from the command line when you are in each condition.

From what you showed, it is not enough to conclude anything. Normally, if you play from Bluetooth and from internal music (from what I understood, from the Android device), this is already two separate streams which should reflect on the commands output. 

Chris Pque

unread,
Jan 1, 2026, 3:09:53 AM (11 days ago) Jan 1
to tas...@googlegroups.com
I meant by separate streams, two distinct audio sources, even tough they are (very logically by the way) displayed as "media stream" on the volume panel UI. 

Yoan

unread,
Jan 1, 2026, 10:37:20 AM (10 days ago) Jan 1
to Tasker
@Brenden
Is there a way to change the stream? I could make all the audio coming from Car play passing through alarm for example, but how? 

@pcp
Ok, I will get the output in the 3 situations. But my question was, what will trigger the action? Is there any event or I have to test it every second (for example)? 

Thank you, and happy new year :)

SDS

unread,
Jan 5, 2026, 4:44:39 AM (7 days ago) Jan 5
to Tasker
You can create you own   per app  volume manager using tasker.  Profile: event-> app changed or  state->app foreground (if you need both entry and exit task). Use global variables %Volm1, %Volm2 for storing the media volumes of the two different apps. You can further make it sophisticated by creating another profile event->variable->value set->%VOLM with task linked to sync %Volm1 or %Volm2 with media volume changed. 

Yoan

unread,
Jan 5, 2026, 7:30:46 AM (7 days ago) Jan 5
to Tasker
Thanks for your answer SDS, but it won't work.
The foreground app is not changing, the music app is playing in the background while CarPlay app is always on the foreground for GPS navigation 

SDS

unread,
Jan 6, 2026, 12:46:10 AM (6 days ago) Jan 6
to Tasker
You can detect the audio stream app using event->system->logcat entry and rest logics you can used as I have stated before. This will definitely solve the problem.

Yoan

unread,
Jan 7, 2026, 8:47:53 AM (4 days ago) Jan 7
to Tasker
Thanks SDS for your answer.
It seems a interesting way to do it. What parameters (Component and Filter) should I put?
Thanks 

SDS

unread,
Jan 7, 2026, 11:53:42 PM (4 days ago) Jan 7
to Tasker
You can find out using the floating bubble created by Tasker.

Yoan

unread,
Jan 9, 2026, 12:56:31 AM (3 days ago) Jan 9
to Tasker
Sorry but what is the floating bubble?
I don't know this feature and haven't found what it is on internet.
Thanks 

SDS

unread,
Jan 9, 2026, 1:12:07 AM (3 days ago) Jan 9
to Tasker
Tasker.PNG
Reply all
Reply to author
Forward
0 new messages