[Tasker Tips & Tricks] JorgeLH:
Hello there folks!

First post here, believe me I've search through all the internets and this forum searching for a solution to this and I can't find it, so maybe I'm approaching this problem in a wrong way, let's see if the gurus around here can give me a hand.

I am looking for a way to play music from an url from 8 to 22 every day. I am trying this on an Android machine that is not a phone. It has Android Version 7.1.2 and Kernel Version 3.14.29.

What I'm doing at the moment is launching Chrome with the url in the DATA field in a task, and launching that task with a profile at 8h, then using the Media Control pausing it at 22h, and the next day at 8 launching again Chrome with the url in the DATA field. I tried to play again using the Media Control but I think after a few minutes Chrome closes the connection and it's not possible to play again, you have to reload.

This way of doing things brings a problem: Chrome always will open in a new tab, so after a week I'll have 7 tabs open in Chrome. Checking the "Always start a new copy" field does nothing in this regard. Also my device is not rooted so I can't kill Chrome, however I am not sure if I was able to kill it, if it would still open the last session with all the previous tabs, not solving the problem anyway. I am willing to root the device but it seems not being a commercial phone it's not a trivial task, some apps don't work and if it won't solve anything it'd be a waste of time.

Things that I've tried but haven't been able to achieve: close tabs, open Chrome from Tasker in Incognito Mode. Using Autoinput for this things seem to not work, or I think I may not have the right code for what Autoinput should look for. I've tried to use VLC to open the url because maybe I would solve the multitab problem and maybe I could just play and pause forever without being forced to relaunch. But VLC for Android doesn't seem to care if you tell it to open an url from Tasker.

So questions, do you guys think there would be a better approach for this? Chrome is not meant for playing music but it seemed like the easiest way to get the job done, giving that VLC is too simple in Android to manage urls. Maybe there's an app that would just do this and I'm going crazy for no reason.

A part B of the problem that would be great if I had some input is that I should monitor the network and the music so when it stops between 8 and 22 I do something. For instance, if it stops and the connection is down I'd play something from a folder, and whenever the connection is back I'd switch to the url again. My first approach to this is to check the Network and make a if_else routine doing changes. This routine runs infinitely through a GoTo at the end of it. If I'm not mistaken that's the only way in Tasker to check for instant changes in the Network (this device is connected through cable, not WiFi) since Tasker only checks changes every 2 minutes. If there is another way of doing this it'd be great to know, the machine seems to suffer a bit when I run this task.

Besides checking the Network I've also tried the Is Music Playing plugin but still with no success. Maybe it won't work with Chrome? I still have to invest some time on this, but there's not a lot of documentation available I believe.

Well, sorry for the long post! I'd be great to have some advice, I'm going a bit crazy doing something that it's probably basic. I am a newbie with this.

Thanks a lot!