"Music Play Dir" only playing one song then stopping

1,046 views
Skip to first unread message

Wojtek

unread,
Jun 15, 2012, 6:42:49 PM6/15/12
to tas...@googlegroups.com
Hello,

I have attempted to use the "Music Play Dir" action to play music for a while before I go to sleep before I trigger a sleep countdown by turning off my screen.
The actual activity works well but the in-built music action is playing up.

I have used the "Music Play Dir" action with Subdirs, Audio Only, Random and Flash all ticked, and Maximum Tracks set to both zero and 60 with the problem occurring where it will play only one track and then go quiet.

I do not have any "Music Stop" actions anywhere else in my Tasker scripts except for the following the sleep countdown triggering.

Is there a bug in Tasker? Can anyone please help here?


Task: Night Music (36)
A1: Media Volume [ Level:2 Display:Off Sound:Off ] 
A2: Variable Set [ Name:%NIGHTPOWER To:0 Do Maths:Off Append:Off ] 
A3: Stop [ With Error:Off ] If [ %MODECAR = 1 ]
A4: Flash [ Text:Night Mode already active! Long:On ] If [ %MODENIGHT = 1 ]
A5: Flash [ Text:Night Mode Music Long:On ] If [ %MODENIGHT = 0 ]
A6: Stop [ With Error:Off ] If [ %MODENIGHT = 1 ]
A7: Variable Set [ Name:%MODENIGHTMUSIC To:1 Do Maths:Off Append:Off ] 
A8: Display Brightness [ Level:20 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:On ] 
A9: Display Timeout [ Secs:0 Mins:2 Hours:0 ] 
A10: Stay On [ Mode:With AC or USB Power ] 
A11: Perform Task [ Name:Night Presleep Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 
A12: Media Control [ Cmd:Pause Simulate Media Button:On ] 
A13: Media Volume [ Level:2 Display:On Sound:Off ] 
A14: Music Play Dir [ Dir:external_sd/Music/Compilations/SomaFM Subdirs:On Audio Only:On Random:On Flash:On Maximum Tracks:60 Continue Task After Error:On ] 



** Sleep countdown is triggered when display is turned off and %MODENIGHTMUSIC=1
Task: Night Music Timer (41)
A1: Variable Set [ Name:%MODENIGHTTIMER To:0 Do Maths:Off Append:Off ] 
A2: Notify [ Title:Night Music Countdown Active Text: Icon:<icon> Number:0 Permanent:Off ] 
A3: Variable Set [ Name:%MODENIGHTENDTIMER To:300 - %MODENIGHTTIMER Do Maths:On Append:Off ] 
A4: Flash [ Text:Night Lullaby ending in ...
%MODENIGHTENDTIMER seconds Long:Off ] 
A5: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ] 
A6: Variable Add [ Name:%MODENIGHTTIMER Value:5 Wrap Around:0 ] 
A7: Flash [ Text:Night Mode Timer Stopped Long:On ] If [ %MODENIGHTMUSIC = 0 ]
A8: Notify Cancel [ Title:Night Music Countdown Active Warn Not Exist:Off ] If [ %MODENIGHTMUSIC = 0 ]
A9: Stop [ With Error:Off ] If [ %MODENIGHTMUSIC = 0 ]
A10: Goto [ Type:Action Number Number:3 Label: ] If [ %MODENIGHTTIMER < 300 ]
A11: Perform Task [ Name:Night Lullaby Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 


** At end of sleep countdown, Night Lullaby task is triggered:
Task: Night Lullaby (37)
A1: System Lock 
A2: Notify Cancel [ Title:Night Music Countdown Active Warn Not Exist:Off ] 
A3: Music Stop [ Clear Dir:On Continue Task After Error:On ] 
A4: Variable Set [ Name:%MODENIGHTMUSIC To:0 Do Maths:Off Append:Off ] 
A5: Variable Set [ Name:%MODENIGHTTIMER To:0 Do Maths:Off Append:Off ] 
A6: Variable Set [ Name:%TIMESLEEPON To:%TIMES Do Maths:Off Append:Off ] 
A7: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] 
A8: Media Volume [ Level:4 Display:Off Sound:Off ] 
A9: Music Play [ File:Tasker/Lullaby/Lullaby.mp3 Start:0 Loop:Off ] 
A10: Wait [ MS:0 Seconds:0 Minutes:2 Hours:0 Days:0 ] 
A11: Music Stop [ Clear Dir:Off ] 
A12: System Lock 
A13: Kill App [ App:UberMusic Use Root:Off ] 
A14: Perform Task [ Name:Night Sleep Stop:Off Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: ] 

Pent

unread,
Jun 16, 2012, 2:51:51 AM6/16/12
to Tasker
Perhaps another Music Play action ? I see you have one in there
somewhere. You can test by disabling Tasker and running the Music Play
Dir action via Menu / More / Run An Action. (or use Menu / More / Run
Log).

Pent

Wojtek

unread,
Jun 17, 2012, 7:28:53 AM6/17/12
to tas...@googlegroups.com
I hunted around for other conflicting Music Play and Music Stop commands and cleared anything that could potentially effect this and still experience this problem.
Is there a command I can run or is there a way I can run a logfile to see what is happening around the time the music stops?

Pent

unread,
Jun 17, 2012, 11:39:37 AM6/17/12
to Tasker
> >> what is happening around the time the music stops?

Have a look at Menu / More / Run Log.

Pent

Dennis

unread,
Jun 20, 2012, 3:00:34 PM6/20/12
to tas...@googlegroups.com
I have kind of the same problem for a reason.
My cellphone's really old and bad!
With the flash error option checked, going to Tasker after it stopped playing exactly at the end of a song it complains about memory.
The native player has got the same "feature" now and then, so it's the phone, not Tasker. At least in my case. I'm not sure why /changing/ a song is so much of a problem, but hey!
My head's also lacking memory from time to time, but that's an entirely different story.

On Wednesday, June 20, 2012 2:00:39 PM UTC+2, parosen wrote:
I have exactly the same problem! Were you able to find anything else?

parosen

unread,
Jun 21, 2012, 9:25:15 AM6/21/12
to tas...@googlegroups.com

I have the same problem and I have a Galaxy SII with Gingerbread 2.3.4. Looks like a Tasker problem

Wojtek

unread,
Jun 21, 2012, 4:24:10 PM6/21/12
to tas...@googlegroups.com
Hi Pent,

Like all the others whom are starting to comment on this thread, I am still not having any luck with the Music Play Dir command!
There are no other conflicting Music Play or Music Stop commands in my scripts.

Is it possible there is a Tasker app problem, or are you able to offer more assistance here please?

Wojtek

Michael White

unread,
Nov 18, 2012, 2:02:00 PM11/18/12
to tas...@googlegroups.com, theca...@gmail.com
Same problem here :/
Galaxy S2 phone, if phone type is an issue.
I'm bringing the subject back up in case there has been a solution found since.

Le jeudi 28 juin 2012 13:27:01 UTC+2, TheCarNinja a écrit :
I also have this problem. Even testing the command by itself yields only one song played.

Pent

unread,
Nov 18, 2012, 2:08:34 PM11/18/12
to Tasker
I spent a lot of time trying to reprodice this but couldn't.

Could you please create a test directory with just two tracks in
there. Also export the task description (not XML) here via long-click
and then export.

If it's still not working with the two tracks, could you please email
them to me.

Thanks,

Pent

Michael White

unread,
Nov 18, 2012, 3:00:14 PM11/18/12
to tas...@googlegroups.com
Hi,
A quick reply to say it doesn't seem simple.
A dummy test manages to play 2 short .mp3 files in a row.
I'm trying to nail down the problem in order to issue a short program (+test songs if need be) to reproduce the problem.
Right now, the program that shows the problem is much to big to be easily exploitable.
Hopefully I'll manage this soon.

Michael White

unread,
Nov 18, 2012, 4:22:35 PM11/18/12
to tas...@googlegroups.com
Ok I'm happy to say I've managed to nail down my problem.
It all has to do with having a parallel task running, that has a bluetooth action in it (even if that action is the running loop).

Just create 3 tasks with 3 shortcuts on home screen :
Test (5)
        A1: Music Play Dir [ Dir:external_sd/Musique/Test Subdirs:Off Audio Only:Off Random:Off Flash:Off Maximum Tracks:60 ]

test off (86)
        A1: Music Stop [ Clear Dir:On ]
        A2: Stop [ With Error:Off Task:Testdummy ]

Testdummy (93)
        A1: Bluetooth X  [ Set:Off ]
        <here>
        A2: Wait [ MS:0 Seconds:5 Minutes:0 Hours:0 Days:0 ]
        A3: Goto [ Type:Action Label Number:1 Label:here ]

Test will bug if Testdummy is running. Disable the Bluetooth line and Test works like a charm.
Doesn't matter if Bluetooth is set on or off before running Testdummy.

Hope this helps !

Michael White

unread,
Nov 18, 2012, 4:54:37 PM11/18/12
to tas...@googlegroups.com
Little typo on the second line of previous message : read  (even if that action is not in the running loop).

And found an even easier way to reproduce bug : simply put bluetooth X and music play dir actions in the same task...

Michael White

unread,
Nov 18, 2012, 8:22:19 PM11/18/12
to tas...@googlegroups.com
Ok after a few more hours of fiddling, here's a work around :
- If you use BT connect, BT unconnect, or even test %BLUE, it will bug the Play Dir action. Even if it is in another task, and even if that task is not running anymore.
- Getting Bluetooth status by creating a profile is ok
- Using A2DPConnect plugin to set Bluetooth on works (nb for Pent : i've had this plugin installed all the time if this can be an issue)
- No way to turn Bluetooth off (or at least I haven't found any if someone has a hint...)
- I'm not exactly sure what resets the bug, but I had a task launched by a shortcut which had Music Stop and stop all my tasks functions, and that made the bug go away each time (but I had to launch it physically from the shortcut, didn't work if launched from another task).

Hope this will be of some help.

Pent

unread,
Nov 19, 2012, 2:56:35 AM11/19/12
to Tasker
Thanks for your investigations.

I tested with this:

Music Play Dir (same as your own)
Bluetooth On If %BLUE Matches off
Wait 2 Seconds
Bluetooth Off

But the second track played OK.

Pent

Pent

unread,
Nov 19, 2012, 2:58:01 AM11/19/12
to Tasker
Maybe you could enable Menu / More / Run Log and check there if
anything else relating to playing Media happens after the Music Play
Dir action ?

Pent

Pent

unread,
Nov 19, 2012, 3:00:30 AM11/19/12
to Tasker
Let's leave it till after the next Tasker update.

I have a feeling that Android is not broadcasting track completion so
Tasker never starts a new track, or possibly it's broadcasting an
error that Tasker is missing. I'll put a load of diagnostic log
statements in.

Next update will be in a day or two or three.

Pent

Michael White

unread,
Nov 19, 2012, 4:32:45 AM11/19/12
to tas...@googlegroups.com
@ Pent
The task you tried works with me too.
Simply invert first two lines (BT action before music play) and it will bug.
Hopefully it will act the same on your phone !

Pent

unread,
Nov 19, 2012, 5:54:59 AM11/19/12
to Tasker
> Simply invert first two lines (BT action before music play) and it will bug.
> Hopefully it will act the same on your phone !

Eureka!

Now to investigate...

Pent

Pent

unread,
Nov 23, 2012, 8:26:38 AM11/23/12
to Tasker
I think this will be fixed next release.

Pent

Andreas Mustola

unread,
Jul 21, 2015, 5:51:27 AM7/21/15
to tas...@googlegroups.com
Nexus 5
Lollipop

Created a profile with BT connected and added a end task
When testet the BT connected the music play dir now only plays one song.
When call the taskt to start the music play dir it starts to play the first one again
(No clear dir checked)
Removed the BT connected profile, music play dir still only play one song

Tried to reinstall tasker, no change.
Is there a fix for this?

technogeezer

unread,
Jul 21, 2015, 6:56:03 AM7/21/15
to tas...@googlegroups.com
Same here.  'Music play dir' action plays only one song.

Andreas Mustola

unread,
Jul 21, 2015, 7:59:10 AM7/21/15
to tas...@googlegroups.com
Tasker log:
13.49.33 Start      TaskService
13.49.40 Running RestartMusic
13.49.40 OK        RestartMusic.Music Play Dir
13.49.40 ExitOK  RestartMusic
13.49.45 Stop      TaskService

Start the task to play a dir.
Played one song and it went silent. 
Tried to start the task again but still silent. (Logged)
But the Log say all is ok.
Tried again to start it and the first song is now playing. (Logged)
The log is exactly the same as above.

Cleared the data from tasker but still no change.

technogeezer

unread,
Jul 21, 2015, 8:06:34 AM7/21/15
to tas...@googlegroups.com
There is a "Maximum Tracks" setting in the "Music play dir" action.  I don't remember it being there previously.  It defaults to zero  What does it do?

I just tested the music play dir action by itself and the it works correctly, playing random songs repeatedly.

It's only in my Bluetooth tasks where music play dir won't play more than one song.

???

Andreas Mustola

unread,
Jul 22, 2015, 5:29:59 AM7/22/15
to Tasker
technogeezer, I removed my 'bluetooth connect' profile but the 'music play dir' still only play one song in that project.
Moved all profiles and tasks to a new project, no change.

But I found a quick fix:

Move your project to the far left.
(I moved my NewMusic project to the far left and then back to far right)
Now 'music play dir' works :-)

Andreas Mustola

unread,
Jul 22, 2015, 5:33:28 AM7/22/15
to Tasker
Hold the project text/icon and click 'Left' to move a project.

Andreas Mustola

unread,
Jul 22, 2015, 3:26:17 PM7/22/15
to Tasker
Found another bug in the 'music play dir':
If the filename is 'MyMusic.MP3' instead of 'MyMusic.mp3' the 'music play dir' wont play it.
Simple fix. Change the MP3 to mp3.

Marta Hintz

unread,
Jul 23, 2015, 12:24:20 AM7/23/15
to Tasker, andreas...@gmail.com
Are you sure you are backing out of Tasker when you make your first changes?  I ask because some of the "solutions" you state here don't really make sense to me....however I am not the expert.  But it may be something you want to consider if you haven't already.   

cheers,
Marta

Andreas Mustola

unread,
Jul 24, 2015, 2:48:08 AM7/24/15
to Tasker
Hi Marta Hintz
I press the back Burton to save settings. But bugs are really nonlogical.

Found out that moving the projekt to the left dont work anymore. I tested more and when I moved the project. I also disabled bluetooth. And as long BT settings is disabled 'music play dir' works. But if I turn on BT it only play one song, is quiet, I start it again and it play the first song again. (Uninstalled sonys 'smart connect' and 'music play dir' now works when BT is enabled. But still not if a BT device is connected to my phone.)

This bug starten after I created a BT connected profile (on a Nexus 5). Before, the 'music play dir' worked. Even if BT was enabled. When I removed the BT connected profile the bug where still there. Therefore I quess that the BT connected profile save some settings in tasker that will make the bug appear.

Tested on another phone, same model. Installed tasker. 'Music play dir' works when BT is enabled.

TEST STEPS:
Created a BT connected profile but did not connect any BT device to the phone: still works.

Connected a BT device (another phone Nexus 5 lollipop). Profile activates and play first song only: Bug appeared.

Disconnect BT device and BT is enabled: works again.

Connected a BT device again. Used specific device name in the profile. Profile activates and play first song only: Bug appeared.

Removed BT connected profile while BT is enabled and manually start 'music play dir': bug, only play one song.

Disabled BT and manually start 'music play dir': works now

Enabled BT and manually start 'music play dir': still works.

Enabled BT and paired and connected a different device (handsfree): works this time ???

Tried again: works ???

Created a bluetooth connect profile but did not connect any device: works

Connected a device (Nexus 5 lollipop): bug again, only play one song.

Removed BT connected profile and disabled bt and enabled it again, press forget device (handsfree) in BT settings, paired and connected the bt handsfree device: works ??? !!!

TEST CONCLUSION:
If you create a BT connect profile (will make a bug in tasker) you can delete it and pair and connect a different BT device to remove the bug.

Andreas Mustola

unread,
Jul 24, 2015, 11:52:06 AM7/24/15
to Tasker, andreas...@gmail.com
There is another bug in 'Music play dir'.

TEST:
Create a scene.
Put a button on it.
On Tap add a 'Music play dir'
Go back to  tasks
Create a task with show scene
Run it
When you press the button in the scene only one song will play.

When I manually run 'music play dir' in tasker everything works fine.

Will

unread,
Aug 4, 2015, 4:47:07 PM8/4/15
to Tasker
I recently upgrade to Tasker 4.7u3m and am now seeing the issue with Music Play Dir only playing one MP3 file and then stopping.  Prior to the upgrade (not sure what version) it would happily play two MP3s in a row which is exactly what I wanted.

Since Music Play Dir appears to now not be working correctly, I tried to replace it with two calls to Music Play, for each of the two files that I want to hear.  This is the first time I've used Music Play and it does not seem to work the way I expected.  My plan was to call Music Play and then monitor %MTRACK to detect when the first file finished and then call Music Play again for the second file.  However, in my very simple test task, when I call Music Play the file starts but when the task exits, which is almost right away, the music playback stops.  I expected it to keep going until the end of the file was reached.

How do I get Music Play to play an entire MP3 file, even if the task that called it is no longer active?  Thanks.

Will

unread,
Aug 6, 2015, 8:39:58 PM8/6/15
to Tasker
I never found a solution to this so I decided to downgrade back to 4.6u3m.  That version works correctly and I'm not missing any of the new features of 4.7.  So, problem "solved".

Andreas Mustola

unread,
Aug 13, 2015, 6:32:13 AM8/13/15
to Tasker
Installed autoshare and now using Google music.

DMcDuck

unread,
Aug 13, 2015, 10:44:14 AM8/13/15
to Tasker
Confirmed that going back to 4.6u3 fixes this issue.

DMcDuck

unread,
Aug 13, 2015, 11:27:53 AM8/13/15
to Tasker
A little more information on this:

Using a widget, one song plays, then the audio stops.  You have to run the task 2 more times to get audio to play again.
Running the task from within Tasker works IF you leave the task open.  If you exit out of the task, the audio stops after one song, then you have to run the task 2 times to get audio to play again.

Message has been deleted

Zappos

unread,
Aug 17, 2015, 3:31:45 AM8/17/15
to Tasker
Ah, Glad it's not just me getting this! Can anyone point me in the direction of the 4.6 version as looks like I need to downgrade till this gets fixed. Thanks in advance.

Zappos

unread,
Aug 17, 2015, 3:43:35 AM8/17/15
to Tasker

Zappos

unread,
Aug 17, 2015, 3:53:56 AM8/17/15
to Tasker
Sorry for the Spam. I too can confirm version 4.6 works fine.

Pent

unread,
Nov 24, 2015, 9:36:01 AM11/24/15
to Tasker

Ah, that's why I couldn't reproduce it (I can now via widget)

Pent

Pent

unread,
Nov 25, 2015, 8:42:20 AM11/25/15
to Tasker
Think this will be fixed next update, thanks DMcDuck for the decisive info.

Pent

Pent

unread,
Nov 26, 2015, 8:04:21 AM11/26/15
to Tasker
The fix is in the beta at top of forum if anyone wants to try it.

Pent

Will

unread,
Nov 26, 2015, 11:00:33 PM11/26/15
to Tasker
I upgraded to 4.8b4m and Music Play Dir is working properly again for multiple tracks.  Thanks Pent!

technogeezer

unread,
Nov 30, 2015, 7:22:53 AM11/30/15
to Tasker
Yes, thanks.

Message has been deleted

Roxanne Clément

unread,
Aug 8, 2018, 2:52:39 PM8/8/18
to Tasker
Is anyone still experiencing this with the latest version (5.2.bf1) on Android 8; I have a task set to play one random song from a folder (Music Play Dir) and as described above, it will play once but then you need to run the task twice for it to play...
Reply all
Reply to author
Forward
0 new messages