Jump to content
Posted

How would you best recommend accomplishing this? I was thinking of using python and the StartAndroidActivity() function, but I was running into errors. Has anyone successfully figured out how to launch an app?

I'm basically wanting to launch VLC on sequence pause with a pseaction to emulate a commercial since we dont have the function to add markers mid-features yet.

Edit: Bonus points if you know how to launch a video already playing - I'm thinking of using tasker to auto play video once VLC launches.

Edited by DIYTVKodi

Featured Replies

  • Author

I ended up using an outside app to solve for this, Tasker and Button Mapper. I used tasker to create a task that opens an "android android.intent.action.VIEW", and Button Mapper to toggle that task with my preferred shortcut. Before creating the task I cleared my default players so the first time it ran, the shield would ask me which media player I'd like to use (and set as default).

Basically the Tasker task is as follows:

  1. Intent Action to Open Video using "android.intent.action.VIEW" and file:///storage/emu.../0/Download/MyVideo.mp4 (there's prob another setting I'm forgetting here)
  2. Wait Action - Set to 38 seconds
  3. Back Button Action
  4. Wait Action - Set to 77ms
  5. Back Button Action
  6. Switch Focus to Previous App Action

By default, Kodi will pause whatever video if you open another app and it loses focus, so setting up the whole task chain was pretty easy.

Edit: Another key was finding a video player that will allow you to toggle a setting to "quit" the app if you press back twice - in my case, I ended up using MX player. If you cant quit the player like this, it will just try to resume the video again if its not quit properly the next time you toggle the commercial.

Edit 2: Be mindful that if you wait too long, Android might decide to kill Kodi cause its eating up too much ram. So if you're using this strategy, try to kill as many background apps as possible if you want a longer commercial.

Edited by DIYTVKodi
Add task details

Create an account or sign in to comment

Topics