2

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?

2
  • I could imagine MX Player understands the second command as "add to the playlist". So maybe you could check for alternative approaches like first clearing the (current) playlist, or completely stopping MX Player before sending it the command to play the other file?
    – Izzy
    Commented Apr 2, 2016 at 17:52
  • @Firelord Yeah the answer worked great, thanks!
    – Frocca
    Commented Apr 3, 2016 at 16:33

1 Answer 1

1

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 → Run Shell →

  • 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)

IMG:

3
  • It worked! I've been trying to get this to work for a long time. Thanks!
    – Frocca
    Commented Apr 3, 2016 at 16:33
  • 3
    Recently figured out that you can also set what position in the video you want to start playing at using --ei position (which is in milliseconds, so 60000 starts the video at 1 minute in ...) code is am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d "file:///sdcard/Movies/mymovie.mp4" --ei position 60000 --user 0 --activity-clear-task there are more options at the MX Player API page link
    – Frocca
    Commented Jun 4, 2016 at 20:44
  • For mx player pro the actual link a bit different: am start -n com.mxtech.videoplayer.pro/.ActivityScreen -d "file:///sdcard/Other/buffers_listed_and_hidden.ogv" --ei position 120000 --user 0 --activity-clear-task
    – Pavel S.
    Commented Dec 8, 2019 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .