So I have an icecast stream streaming a local radio of mine online. I am currently using PowerAmp (music player im sure most of you know) to stream my custom online IceCast stream (it's just an HTTPS url. I can use an m3u as well but it works with just a url too and its easier).
So I have just fed that URL into my PowerAmp and I run it and it works flawlessly. However, I have also made a php script on my server-side which plays the radio stream, to switch back and forth between stations (my IceCast stream is not a real playlist, rather its just one url) and I have a special php script "https://<my_ip>/next_station.php" and "https://<my_ip>/prev_station.php" which automatically changes radio station based on my algorithm. It works awesome.
However, the issue I am trying to automate is, I want that whenever I press BACK/NEXT in the media player, I want Tasker to detect whether I pressed BACK or NEXT track and call the correct php script respectively. I have tried looking up an API/Intent Received from PowerAmp's GitHub, but they only offer a "TRACK_CHANGED" which has 2 issues; 1) I cannot know if user hit NEXT or PREVIOUS, and 2) It is unstable. Even if I pause/play or even if i just start the track from playing nothing at all, this intent is triggered. So it does not work.
Other thing I tried is: Tasker's Music Changed Event trigger - that's great but again, gives no information whether track change happened because of hitting NEXT or PREV or whether it triggered because of anything else. I can add an IF condition for track name, album name and others - but again it doesnt help me solve on running the task ONLY if NEXT/PREV was hit.
The one option that does succeed however is the Media Button State trigger. This works really well but issue is, it only works if I have an external entity trigger the Media Buttons (that is a bluetooth headphone or anything). This is good, I can click next in my car via bluetooth and it works, but issue is, if I click Next from the PowerAmp or VLC or any media player (especially in Android Auto where its different), it fails and does not trigger.
What can I do here? I feel like it is such a basic task and I do not feel that I need to create a full Java Android App to make my custom music player just to re-program next/prev buttons - feels extreme. What can I do? Out of ideas guys