Best plugin/app for remote playback

If you have a question or need help, this is the place to be.
Post Reply
slattynan
Experienced User
Posts: 52
Joined: Fri Jul 06, 2018 12:15 pm

Best plugin/app for remote playback

Post by slattynan » Sun Oct 28, 2018 8:28 am

Hi Guys,

Long story short, I need to switch from one to another queue of videos automatically on an Android TV box. I also want to interrupt the queue with a short clip and then resume the previous video and queue based on eventghost triggers.

Any thoughts as how this can be done? My preference would be to use plex, but I can't find details of how to trigger playback based on command line commands.

My daughters creepy Halloween window projections rely on it :D

jachin99
Experienced User
Posts: 582
Joined: Sat Feb 13, 2016 8:39 pm

Re: Best plugin/app for remote playback

Post by jachin99 » Sun Oct 28, 2018 8:05 pm

If your going to use Plex, then I would first confirm that plex is going to resume your first video where it left off after it has been interrupted. Second I would also make sure that plex doesn't apply any overlays when the video first starts because I'm assuming you want the focus to only be the video, and not the video player. i haven't found any plex plugins for eventghost but if it takes command line switches then it would seem to work that way. I always kinda thought EG could help build something like this. What are you using to trigger switching videos? I think the big trick to pulling it off would be to find the right video player. It seems like you would need something that can save resume points, and allow for easy hiding of the OSD. If your using a projector then depending on the video you want to play you might be able to cut off OSDs by zooming the picture.

slattynan
Experienced User
Posts: 52
Joined: Fri Jul 06, 2018 12:15 pm

Re: Best plugin/app for remote playback

Post by slattynan » Sun Oct 28, 2018 8:26 pm

You're right, finding the right video player is key. Plex isn't going to cut it for this. something like VLC would be more appropriate, but I haven't seen any remote playback commands through my limited hunt so far. I was hoping that others had attempted similar things :D

The fact I want to trigger events on an android device is the tricky part. I think I might need to use tasker in the middle, or Bi-pass EG completely (although its already being used for a bunch of other event-driven Halloween tasks.

To trigger the EG actions I'm using webcore in smartthings with a bunch of motion and doorbell triggered events.

jachin99
Experienced User
Posts: 582
Joined: Sat Feb 13, 2016 8:39 pm

Re: Best plugin/app for remote playback

Post by jachin99 » Mon Oct 29, 2018 1:49 am

Look at MPC HC. I know there is an option to save resume points and you might be able to get rid of the old by removing the graphics files from their folders. It also has an option for splash screens if need be including one that is just a black screen. You can also specify custom splash screens. I can't help much with Tasker integrations but you should share your setup when it's all setup. I wish you had a little more time to try things out because if you could find an Android client, I bet the weberver plugin could be helpful also. Better yer, maybe mpchc has an Android remote that would work. I hope you get it all figured out either way

User avatar
kgschlosser
Site Admin
Posts: 4623
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Best plugin/app for remote playback

Post by kgschlosser » Mon Oct 29, 2018 11:02 pm

almost all players will allow you to start playback where you left off via some sort of remote API. it is a matter of grabbing the position. then stopping the playback. and when you want to play it again. you play then seek to that position.

What plugins are available and for which players that is something you will have to look for. but also what command sets the player supports.

I wish ya gave us a wee bit more time then a few days to get this going for ya. :shock:
If there was more time I know 100% the right solution can be found.

Now as far as the android TV Box. if all you need to do there is control the playback via something like eventghost. have you considered DLNA at all?
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4623
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Best plugin/app for remote playback

Post by kgschlosser » Mon Oct 29, 2018 11:04 pm

I do also know that kodi is available for android. However I do not know if Kodi on an android device has the ability to be controlled remotly like the windows variant.
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 268
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Best plugin/app for remote playback

Post by yokel22 » Tue Oct 30, 2018 2:33 pm

The arm version of kodi supports/uses the same json-rpc api that the xbmc repeat plugin uses.

Kodi has a jumpto item command when dealing with playlist positioning. This should be do-able.

User avatar
kgschlosser
Site Admin
Posts: 4623
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Best plugin/app for remote playback

Post by kgschlosser » Wed Oct 31, 2018 5:26 pm

and there is the solution i think you needed.

Kodi installed on the android TV box should be able to be controlled using the kodi plugin for eventghost. and it should allow you to jump to a specific position when playing the file. and I am pretty sure you should be able to get the current position before you change the playing media.
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 268
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Best plugin/app for remote playback

Post by yokel22 » Wed Oct 31, 2018 8:03 pm

Yep, 2 macros.

getCurrentPlaylistItem > Save to eg variable > jumpToPlaylistItem

Then Second macro would use the kodi event for track change. JumpTo saved eg variable.

I have most of this done for other purposes. Ill post when i get home. It may not be in time for you to implement though.

slattynan
Experienced User
Posts: 52
Joined: Fri Jul 06, 2018 12:15 pm

Re: Best plugin/app for remote playback

Post by slattynan » Sun Nov 04, 2018 10:47 am

Great, sorted for next year 8)

It all worked out pretty well, but I dropped the video playback element this year. That will come next year.

It was a good exercise to get many of my smart home devices cross-talking across eventghost, mqtt and smartthings. I'd been procrastinating somewhat getting that sorted.

BTW, one issue I did have was getting event ghost to trigger events in parallel. Is the only way to do this to run multiple instances of eventghost?

User avatar
kgschlosser
Site Admin
Posts: 4623
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Best plugin/app for remote playback

Post by kgschlosser » Sun Nov 04, 2018 5:08 pm

yes and no.

**** NOTICE ****
You have to be very careful running multiple instances on EG on the same computer. It is very easy to get the 2 into a "fight" one changing something one way and another changing the same thing to something different. The result of this happening is not good and can end up with a PC blue screening or possibly worse. My suggestion is to not do it. the sole purpose of running more then a single EG session is if you know 100% that there are no duplicated actions in each EG instance. (no loading the same tree). it is also handy if you are doing a rewrite of your tree as it is far easier to copy and paste items between the 2. But you have to be sure to disable every single item in the tree while doing this.

Now as far as the actual question goes.

EG does run in parallel. There is a but here.. the event thread which is what iterates over the tree to discover any macros that have an event in it that match the event that came in is a single thread. it is always running. so while it is busy doing it's hunting thing it cannot look for anything else during that process. if a macro gets found then the macro gets plunkered off into the action thread. and the event thread waits for that to finish and then continue on with it's search for more macros for that event. and if none exist it wqill move on to the next event that has been queued.

so by the definition above.. the answer would be no.. Another but...

But with the mechanics of Python and how open the code is. Meaning how accessable everything is. and EG not being locked down in any manner. You can create a thread that gets run at startup. and this "extra" thread you can designate to iterating over the container that holds the queued events. This is a bit tricky because you do not want it to keep making a circle over the queue if there is nothing there. you do not want it to grab an event if the event thread is doing nothing either. So you would have to set into place a log listener.. and you would need to keep that "extra" thread in a paused state . when an event comes in it would unpause the extra thread and at that time you are able to register for a notification of when the event that is being run by the event thread has finished. when that notification comes in it would pause the extra thread once again. once the extra thread gets unpaused it would be able to monitor for any events that come in while the event thread is busy. if one does come in you can set that guy up to dynamically create new threads to iterate over the tree to hunt for macros and to run any needed actions.

The setup above gets all kinds of screwy because it is going to severely mess up your log. But it is also going to cause problems if any macros that are being run rely on any variables like eg.event. because eg.event can contain only a single item at a time.

I did make a version of EG that overcomes all of the problems mentioned above. the log ends up getting changed so that if you double click an event it expands to show you the log data for that event. any dynamically changed variables that gets used by events will have the proper data returned based on what thread is asking for the data. It's actually pretty crafty how i coded it. I did it a long time ago and I am sure i could do a lot better job now.

the test build has expired. I can check and see if i can build it again if you are interested. But you have to understand that it is extremely experimental. and not everything has been sorted out in it.
If you like the work I have been doing then feel free to Image

slattynan
Experienced User
Posts: 52
Joined: Fri Jul 06, 2018 12:15 pm

Re: Best plugin/app for remote playback

Post by slattynan » Sun Nov 04, 2018 6:30 pm

Interesting, there may be a better way of dealing with the issue I was faced with than addressing the parallel event challenge. I can work around most of my issues using webCore, however finding a better way to manage the points below would help.

What I was struggling with is either the play sounds command and/or send http requests. One or both were causing huge delays in the next action triggering. For the play sound issue I tried Crystal Wolf Player, I'm not sure if this helped or not, as I didn't get chance to test fully.

The HTTP requests were sending RF commands to a broadlink transmitter to change light colours etc. These seemed erratic, the action always worked, but I was getting errors in the EG log that seemed to take time to come up and pause the queue of events.

Also does the wait command influence all triggered macros?

User avatar
kgschlosser
Site Admin
Posts: 4623
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Best plugin/app for remote playback

Post by kgschlosser » Mon Nov 05, 2018 3:31 am

if you are sending out an http command directly from a python script then those should be done in a thread. that is a simple task to overcome. so the script will get run and pass the data to be transmitted to the thread you set up to be responsible for sending the command.

as far as how events work...

say you have a tree that looks like so

Code: Select all

root
   |
   |____Folder1
   |           |____Macro1
   |           |          |____SOME.EVENT.1
   |           |____Macro2  
   |                      |____SOME.EVENT.2
   |____Folder2 
   |          |____Macro3
   |          |           |____SOME.EVENT.1
   |          |____Macro4
   |                       |____SOME.EVENT.1 
   |____Macro5
               |____SOME.EVENT.1
if SOME.EVENT.1 gets triggered the macros will get run in this order.
Macro1
Macro3
Macro4
Macro5

so if want to change the order in which the macro's get run. you can do that by placing them higher in the tree. and they will get run first. so if you have a large number of waits in a single macro which is stalling the running of the other macros. then move the one with the large number of waits to the end.

macros get run in a per branch fashion from top of tree to bottom of tree. so Macro5 does not get run before Macro1 even tho Macro5 is closer to the trunk (root). it's a top down thing.

if you were to put waits into Macro2 those waits would not effect SOME.EVENT.1 at all. if you have 3 seconds of waits in Macro1 it will be 3 seconds before Macro3 Macro4 and Macro5 get run.

you could simply smoosh all actions you want to get run into a single macro. this makes for a very sloppy tree layout. and it will become hard to read. it is wise to create macros with the "task" mentality. so if you want to say play a movie... that would be one macro. then you want to dim the lights. that would be a second macro. if dimming the lights is something that is a longer running action you would want to put the play movie macro ahead (closer to the top of the tree) then the dimming of the lights.

The system was designed like this intentionally for organizational purposes but also because of eg.StopMacro. eg.StopMacro can get run at any time during the running of a macro. this will stop anything after it from being run. but only in that macro. so as an example. if you wanted to play the movie then set the temperature and then dim the lights. in the setting of the temperature it does a check and it find that the temperature has already been set. eg.StopMacro can get run stopping the temperature from being set and the lights will still dim. This is not something that you would not be able to do with the actions. you would have to know python and code the python to skip over the setting of the temperature. I use the example above as an example. At the present there is no Stop Macro action it has to be done from python code. The Find Window action has the ability to stop the macro. This is something I have been meaning to add into EG. I just added it to our issue tracker so we will know it is something that needs to be done.

I would not use the Wait action for anything other then adding a pause between mouse movements and Window related actions. there is no purpose for it other then that. it is something that needs to be there because the amount of time that is needed between Actions when dealing with those kinds of actions is variable based on a number of factors. so it has to be a user adjustable thing so the best performance can be achieved.

Any time you do anything lengthy it is always best to perform it in a thread. I added making a Thread action to the todo list as well.
If you like the work I have been doing then feel free to Image

Post Reply