Tasker - Play video using MX Player while another is currently playing I have an Android mini-pc connected to a television through a HDMI cable. I use Tasker to automatically start playing an mp4 video using MX Player when the device boots. MX Player then continues to play all the videos from the same folder in a random order and on a loop.

(the task contains one action - Open File - under File I have the path to the mp4 file )

The problem is I then have Tasker set to play another mp4 video (from another directory) using MX Player one hour after the device has booted but MX Player ignores this and continues to play the current video.

(the second task is the same as the first- it contains one action - Open File - under File I have the path to the mp4 file )

The reason why I need to use MX Player (instead of BS Player, VLC etc.) is because it has more options than the other players like the option to play all the videos in the same folder in shuffle and on a loop, resize the video so it fills the screen, play each video from the beginning and hide the video controls from the screen.

I have also tried using the Tasker action Send Intent


Action: android.intent.action.VIEW  
Data: path to mp4 file
Package: com.mxtech.videoplayer.ad
Target: Activity


But this produced the same results - As MX Player was playing a video this task would run telling it to play a video and MX Player would ignore it and continue to play its current video.

Is there any way of getting Tasker to play a video using MX Player while MX Player is currently playing another video?
I cannot give my assurance for the mini-PC you've got, but the following works well on my Nexus 6 running stock Android 6.0.1 with MX Player v1.8.3. 

Alright, so discard whatever actions you've setup and follow this simple one:

Code &rarr; Run Shell &rarr; 


Command: 

am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d "file://FILE" --user ID --activity-clear-task


where, 


FILE refers to the location of your media file in Android. E.g. /sdcard/Movies/lolcat.mkv, /storage/emulated/0/Prime_time/after_dark.mkv and so on. 
ID refers to the ID of the user account currently active. For primary user, it is always 0.
--activity-clear-task is a flag which makes sure no multiple instances of the same activity are spawned. 


Example command:

am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d "file:///sdcard/Movies/The egg of the King.mp4" --user 0 --activity-clear-task


If MX Player is the default video player in your Android, for fun, you can replace -n com.mxtech.videoplayer.ad/.ActivityScreen with -a android.intent.action.VIEW in the said command.
tick Continue Task After Error


You can now setup a wait timer or anything that you intend to do after the execution of that action. In order to fire a new video, just copy everything from aforesaid action except of FILE which needs to be replaced with new file location. 

In case Tasker doesn't work out, try with Automate. It has a neat block named App Start which is specifically meant to launch an activity of an app.

(Click image to enlarge it)