INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: An app launcher for Theater View  (Read 15304 times)

Don W

  • World Citizen
  • ***
  • Posts: 185
An app launcher for Theater View
« on: August 02, 2017, 01:36:06 pm »

For a long time I've thought that if I had an app I wanted to run on my HTPC, and if it could be adequately controlled with the keyboard, that I would write a launcher for it that could be started via a custom menu item in theater view. The idea was that this launcher would start the app, listen for remote control input and convert button presses to keyboard events to be passed along to the application. And there would be a way to shut the app down and return to theater view.

The problem is that up to now I haven't known about anything that fit the bill. I subscribe to Google Music but its support for keyboard navigation is limited, and I tried a lot of the other streaming services, looking for one with good keyboard support. Finally, thanks to a thread started by justsomeguy here https://yabb.jriver.com/interact/index.php/topic,111262.0.html, I found YouTube TV. It's a perfect for what I want, and what's more YouTube Red is included with a Google Music subscription. I had barely even looked at YouTube until recently because I can't stand watching video on my phone and when at my computer I'm usually working. But being able to watch it from the couch using a remote control is great.

Making the launcher wasn't quite as straight forward as I expected because of the way MC wants to hold on to the keyboard focus. But I did work through that. I'm the calling it TVAppLauhcher. That's TV for Theater View, if you wish, or just television, it works both ways. At first I called it YouTubeLauncher, but when that was nearing completion there just wasn't much more to do to make it a more generalized. By default it will open www.YouTube.com/tv# in Chrome, but you can use it to open pretty much any URL or any application, though at present Windows Universal application are not supported.

I want to share TVAppLauncher with the JRiver community. I've uploaded it as an attachment to this post. Inside the zip file is a single exe file. It doesn't make any changes to your computer. Simply download it, unzip it, and put the exe where you want it to live. Then add a menu item of type "External Program" in theater view which executes the file.

IMPORTANT: When creating the menu item, do not check the option "Hide Media Center while program is running." It is checked by default, so you'll need to uncheck it.

It's written in C# using WPF. I don't have a problem sharing the code. If there's interest I'll post it here or maybe put it on GitHub.

Now for the details.

A couple of things are done specifically when the URL points to YouTube TV. First, a few remote buttons are mapped to keyboard keys that are supported by YouTube TV: pause (mapped to space) play (mapped to enter) rewind (mapped to J) and fast forward (mapped to L). Second, the back button normally sends a Browser Back command but that is changed to emulate an escape key. Two reasons for this. One is I think the escape key behavior is a better user experience than the browser back experience, if you have to choose between the two. The other reason is that it doesn't seem to be possible to inject a Browser Back command into Chrome when Chrome doesn't have the focus. (This is important because MC likes to keep keyboard focus to itself.) I think its a Windows security thing and I haven't found a work around.

Another thing about YouTube TV, if it's opened in Chrome using the default command line arguments. It will be necessary to log in again to YouTube, even if you have already logged in using Chrome normally. This is because Chrome is started with an argument that specifies a custom location for the user data. The reason for this is so that a new Chrome window will open in full screen mode if Chrome is already running. Otherwise it won't go into full screen mode. Its just a weird thing about how Chrome works.

Strangely, YouTube TV doesn't hide the mouse cursor, so the program moves the cursor to the side of the screen to get it out of the way.

There are a few ways to close the browser (or whatever app you have running) and return to theater view:
  • press Alt-F4
  • long press the escape key
  • press the green button on the MCE remote
  • long press the back button or the stop button on the remote
  • execute the program with the word 'quit' in the command line arguments
Long pressing the back or stop buttons will bring up a dialog with the options to quit or hide. If you choose Hide, the browser window will be hidden making theater view visible. This might be desirable if you want to do something in theater view without loosing your current state. Bring it back using the same method you used to start it. The long press shouldn't need to be very long. Its possible you're remote won't do a long press. I have one that doesn't. The problem is that it sends the button up notification immediately after the button pressed notification. But my Microsoft MCE remote and my Inteset remote both work, so I think most MCE clones will probably work.

You can change the destination URL, the executable, or the arguments passed to the executable. You do this in MC when you define the command by adding items to the arguments box. Note: arguments that have spaces should be enclosed in quotes.
  • To open to a different URL, simply the desired URL to the arguments. If the URL starts with "www" or "http" it will be picked up, otherwise preface it with "URL:" (without the quotes.)
  • To start a different browser, or any other executable, include the full file path as an argument. If the path ends with .exe it will be picked up. Otherwise you can preface it with "exe:" (without the quotes.)
  • To specify the arguments to be passed to the exe, define them as a single entry in the args list (enclosed in quotes if there are spaces) and preface that with "args:" (without the quotes.) If you specify args then the URL will be ignored. It is necessary to include the URL in the args.
Here is the full list of supported arguments:
  • youtube - defines the URL as "www.YouTube.com/tv#"
  • chrome - defines the executable as Chrome.exe (including its default install path.)
  • quit - if an existing instance is running it will be terminated.
  • start - if quit is present and an existing instance is not running, then a new instance will be started.
  • no-opening-overlay - makes it so the opening overlay is not displayed.
  • force-fullscreen - an attempt is made to force the app's window into full screen mode.
A note about MCE remote control buttons. Some of the buttons, when pressed, MC will receive the notification and react as it always does, whether or not it is the topmost window. I haven't found a way to prevent this. The buttons on my Microsoft remote for which this is true are: Green Button, More, Recorded TV, Guide, Live TV, Channel Up/Down, Replay, Skip, Rew, Fwd. Just something to be aware of in case you get confused.

A note about the quit and start arguments. In theory it would be possible to define a single custom command and assign it to a remote button that could be used to both start and quit. In practice this doesn't seem to work because it seems MC won't send the command a second time if the application started by the first time is still running.

A note about Firefox. Firefox doesn't have a command line option to make it open in full screen, as far as I have found. Plus it guards against being put into full screen mode programmatically, by injecting an F11 key event, for example. I'm sure the latter is a security thing for them, but I don't know why no full screen command line option. For this reason I don't have support for Firefox built-in. If anyone knows how to open Firefox in full screen mode let me know.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72367
  • Where did I put my teeth?
Re: An app launcher for Theater View
« Reply #1 on: August 02, 2017, 01:40:07 pm »

Thanks for sharing your work.
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #2 on: August 02, 2017, 03:52:22 pm »

This is great. I tried the program with my Intel NUC controlled by a Harmony remote and all is working as it should. I have been using Justsomeguys version which also worked but I had problems exiting and returning to MC. That's now working fine.

Haven't tried other programs yet but will play with BBC Iplayer and Amazon Video and report.

One issue, if I pause and resume a video or forward fast and play in Youtube, MC (Theatre View) jumps back to the foreground. The video continues to play but I cant bring it back to the foreground.

Not a huge issue. Loving the function though and very grateful for your work, and making it available. Massively adds to the functionality of my Media set up.

Thanks a lot.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #3 on: August 02, 2017, 04:43:44 pm »

One issue, if I pause and resume a video or forward fast and play in Youtube, MC (Theatre View) jumps back to the foreground. The video continues to play but I cant bring it back to the foreground.

I was having this issue with the skip/next and replay/previous buttons on my Microsoft MCE remote and fixed it with a little hack. But I haven't seen it with pause/resume or fast forward/play like you describe. In theory MC shouldn't even be receiving the play or pause event messages. It will get the fast forward message but I haven't seen that cause a problem.

I'd expect you'd be able to bring it back to the front if you opened it with a custom menu item in theater view, by clicking on that menu item. But not if you opened it with a custom remote control button command. If the former is the case, what happens if you long press the back button and select "Hide" from the menu. If that works, can you bring it back into view?

Do you happen to have an MCE remote you could test to find out if the problem is related to the remote you're using?

It's also possible there are behavioral differences between my PC running Windows 10 and your NUC. What OS are you running?

Edit: I was wrong about MC not getting the play and pause messages. It will get them. I'm just not seeing that cause MC to make itself the top window. There could be a timing issue involved and the relative performance of your NUC vs. my PC is playing a role. I say that since I see the same issue with the previous/next buttons. Maybe the timing is such that it just doesn't happen for me with Play or Pause or FF or Rew.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #4 on: August 02, 2017, 09:42:54 pm »

One issue, if I pause and resume a video or forward fast and play in Youtube, MC (Theatre View) jumps back to the foreground. The video continues to play but I cant bring it back to the foreground.

I made a new build that applies the technique for keeping MC from making itself the top window when Play, Rew and FF are pressed. See if it solves the issue. Its the same download, I just replaced the file.

I also fixed Mute and Volume Up / Down which I discovered weren't working the way they should.
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #5 on: August 03, 2017, 12:27:26 am »

I've downloaded and installed your new version but annoyingly I have run out of time to test.

I shall test it all later today when I get home. FYI I'm using a NUC6i3 with Win 10 and a Harmony One. I do have an MCE remote too so I'll try that too.

Thanks
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #6 on: August 03, 2017, 09:46:09 pm »

I've downloaded and installed your new version but annoyingly I have run out of time to test.

I shall test it all later today when I get home. FYI I'm using a NUC6i3 with Win 10 and a Harmony One. I do have an MCE remote too so I'll try that too.

Thanks

You need to download again. There was a bug in the last one so it would not be a valid test. Sorry about that.

If this one doesn't work I have one more idea if you are up to it.
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #7 on: August 04, 2017, 12:31:16 am »

Ok, have downloaded the latest version and had a very quick try (work gets in the way again).

In the 5 minutes I had to have a look, I was able to pause and resume a couple of times but then theatre view jumped back again after I let the video run for a bit longer.

But its not a fair test at all so as soon as I get home today I'll have more time to investigate. I did get my old mce remote working yesterday so I can try that later and see if there is any difference.

Cheers
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #8 on: August 04, 2017, 12:32:17 am »

I am amazed no one else has downloaded and tried this.....
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #9 on: August 04, 2017, 03:01:49 pm »

I've had more time for testing and nearly everything works. The fast forward and rewind, play, stop all working. The long press stop brings the quit menu and the program exits properly.

The following wont work correctly. If I pause then Theatre View immediately jumps back to the front and pressing play or pause again just "flashes" Youtube to the front and then immediately Theatre View jumps back to the front again. Hide on the close menu also has a problem. It did hide (or minimise) the Youtube screen once when I tried but didn't return Theatre View to focus. On subsequent tries with hide, it just returns me to the maximised Youtube screen.

This is all using my Harmony One set from Harmonys database as an ir controller for the NUC or, if I use it to emulate an MCE remote. I haven't been able to get my actual MCE remote to work with the NUC as I need drivers (X10receiver) and haven't installed them yet.

So just a couple of issues for me, but nearly there. Definitely useable in its current state but I have to use my desktop and VNC to get out of Youtube once Theatre View has taken the focus by a pause command.

Just a note, on one occasion while watching a YT video I tried a pause and it worked correctly! For the duration of that "session" it continued to work correctly. After I exited Youtube and then the previous behaviour returned. I don't know what I did to make the difference and I cant get it to happen again.

Happy to do any more testing if required, and in more detail if that will help.

Cheers
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #10 on: August 04, 2017, 06:27:59 pm »

The following wont work correctly. If I pause then Theatre View immediately jumps back to the front and pressing play or pause again just "flashes" Youtube to the front and then immediately Theatre View jumps back to the front again. Hide on the close menu also has a problem. It did hide (or minimise) the Youtube screen once when I tried but didn't return Theatre View to focus. On subsequent tries with hide, it just returns me to the maximised Youtube screen.

I know why (most likely) the pause button brings theater view back. I didn't include it in the list of problematic buttons along with Play, FF, Rew, etc. So that shouldn't be a problem now. About not being able to bring Youtube back after Hiding with the menu item. I don't know. I've made a few changes in how that works but its a stab in the dark.

Couple questions for next time, if it still doesn't work.
- If it hides as expected and you're back in theater view, but pressing the custom menu item doesn't bring Youtube back, what happens if you then press the up or down button? Does that bring Youtube back?
- If you have a keyboard, what happens if you Alt-Tab from Youtube to theater view. Can you at that point bring Youtube back with the theater view menu item?
- Are there any issues associated with bringing up the menu and then selecting Cancel?

Posting the new build now. Thanks!
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #11 on: August 05, 2017, 04:09:17 am »

Downloaded latest version.

If I call the app via the Theatre view button, all works until I use any function - pause, ff, rwd when exactly three seconds later, Theatre View jumps back. This behaviour is consistent, but different to previous versions where the jump back to TV was immediate.

If I use ALT Tab on the keyboard to return the focus to the app, then all works, and works correctly controlled by keyboard or remote.

Having used ALT Tab, if I exit the app and then restart via remote, the flip back to TV view returns. So somehow using ALT tab changes something which makes Theater View behave as required and stay out of the way.

So the behaviour is different to previous versions and I hope that 3 second lag which wasn't there before tells you what you need to know.

The hide function doesnt seem to do anything and Youtube returns, as does cancel. The quit function works fine and as intended. When the app is running but Tview is on screen, the up button does nothing and the down button selects the app again which will come to the fore and then tview jumps back. Down seems to be the same as "OK" button which selects.

If I call the app and then Tview comes to the front and then I exit Tview (ctrl-1) and then test the functionality of the app, all the control buttons work as expected - ff, rwd, pause, play and screen navigation.

Hope that helps!

Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #12 on: August 05, 2017, 03:59:47 pm »

Thinking about how the behavior on your system could be so different from mine, it occurred to me that when you created the custom menu item for theater view, you might have checked the option to hide media center. I didn't mention it in my original post, but that option should not be set. With that option set I get the same results you describe for the Hide function - nothing happens. I still don't have MC taking the foreground with Play/Pause/FF/Rew, but you definitely should try unsetting that option before we go further.

About Alt-Tab. MC somehow opens the app without letting it take the keyboard focus. That's the crux of the issue. Once the user manually sets the focus using Alt-Tab or the mouse, theater view either can't or chooses not (I'm not sure which) prevent the app from taking focus any more. I haven't found a way to force MC to let go of the keyboard focus. justsomeguy with his YouTube vb script managed to do it by simulating the keystrokes "alt-space m" to minimize MC. NOTE: I wasn't successful with that approach until just now I tried it with the "hide media center" option checked and it worked. I'll need to think about that.
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #13 on: August 05, 2017, 04:39:02 pm »

I didnt think about the "hide Media Centre" check box and if I remember correctly, it was selected by default when I selected external program.

Anyway, what is far more important is the app is now working perfectly having unchecked that box. Responding correctly to all inputs and not once has Tview jumped back. Even "hide" was perfect and of course I now see the value, returning to the page I was on rather than a new page.

So congratulations on a great addition to the functionality of MC. I know Jim said thanks for sharing, but don't know if he really looked at this. And why others aren't all over this, I have no idea. They should be!

I shall now try to extend the function into Amazon Video and BBC Iplayer. If I can help any further with testing, more than happy to help.

Thanks again
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #14 on: August 05, 2017, 05:16:55 pm »

I didnt think about the "hide Media Centre" check box and if I remember correctly, it was selected by default when I selected external program.

Anyway, what is far more important is the app is now working perfectly having unchecked that box. Responding correctly to all inputs and not once has Tview jumped back. Even "hide" was perfect and of course I now see the value, returning to the page I was on rather than a new page.

So congratulations on a great addition to the functionality of MC. I know Jim said thanks for sharing, but don't know if he really looked at this. And why others aren't all over this, I have no idea. They should be!

I shall now try to extend the function into Amazon Video and BBC Iplayer. If I can help any further with testing, more than happy to help.

Thanks again

That's great to hear! I will edit my original post and include instruction to leave that option unchecked.

Whatever app or website you open with it needs to be keyboard or remote enabled. That is, you need to be able to navigate and control its functionality using the keyboard and/or remote. I don't think Amazon Video is, unless there's an app for it I don't know about. But if you DO find an app or website that's keyboard enabled, but doesn't respond to the remote as well as it could, I can customize the mapping from remote button to keyboard key for it specifically. It would be nice learn about other good apps to use with this.

There's going to be a problem if you try to open two different web sites at the same time with Chrome as the browser. I don't know how likely that is to happen, but its something I've been looking at.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: An app launcher for Theater View
« Reply #15 on: August 05, 2017, 06:25:28 pm »

Nice job Don.

I had been continuing to modify my script to add more functionality like keeping chrome open in the background so it could "remember" where you left off. Was pretty much working but it was "clunky" to get it right. VB script doesn't have a way of controlling the mouse so I was using EventGhost to trigger the mouse to move off screen when youtube was launched, works fine but I like the idea of one program to do it all better.

Long story short I think I'll use your program instead.

Only issue I have is that the remote I use is an old "ATI Theater Video" remote. Most of the buttons work as expected except the fast forward and rewind don't function. Whatever codes they send obviously don't match what you are capturing. So I'm having to use EventGhost again (which has a plugin that works with my remote) to map those buttons to J and L which then works. Not a huge deal but wish I didn't have to use EventGhost just for that reason. I don't expect you to try and support my old remote but would you be willing to post your code so I can take a look and see if I can maybe make it work with those buttons myself.

Good work!
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: An app launcher for Theater View
« Reply #16 on: August 05, 2017, 06:36:12 pm »

I shall now try to extend the function into Amazon Video and BBC Iplayer. If I can help any further with testing, more than happy to help.

I'm pretty sure Amazon Video won't work as they don't have an interface that can be driven with a keyboard. BBC doesn't appear to either. What I've found out though is that amazon has another site called primevideo.com which looks different than the normal Amazon video. I have no idea if that site can be keyboard driven either as it is only usable in certain countries and the US and UK are not one of those countries. So I couldn't test it.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #17 on: August 06, 2017, 07:55:24 pm »

I don't expect you to try and support my old remote but would you be willing to post your code so I can take a look and see if I can maybe make it work with those buttons myself.

I was going to put the code on GitHub but don't have the time right now so here it is. If you have any questions about it maybe PM me? And if you come up with something that could be helpful to someone else we'll figure out how to get it added in.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: An app launcher for Theater View
« Reply #18 on: August 06, 2017, 08:54:50 pm »

I was going to put the code on GitHub but don't have the time right now so here it is. If you have any questions about it maybe PM me? And if you come up with something that could be helpful to someone else we'll figure out how to get it added in.

Will do... Thanks
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #19 on: August 14, 2017, 03:38:06 pm »

Have no other users tried this? Seven downloads?

People, you are missing something here that adds great functionality to MC.

Come on, try this and support the efforts of the author...who knows what he might come up with next?
Logged

ThoBar

  • Citizen of the Universe
  • *****
  • Posts: 992
  • Was confishy
Re: An app launcher for Theater View
« Reply #20 on: September 16, 2017, 01:44:56 am »

Thanks, this is really quite useful!
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: An app launcher for Theater View
« Reply #21 on: September 16, 2017, 03:22:31 am »

It certainly is useful!

Just a bit of feedback for the author. After extended use, MC does tend to jump back to the screen, but selecting the appropiate Theater View button returns to Youtube.

Thanks again, I use this every day.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #22 on: September 16, 2017, 04:33:11 pm »

Just a bit of feedback for the author. After extended use, MC does tend to jump back to the screen, but selecting the appropiate Theater View button returns to Youtube.

I am not seeing this. If you can identify a specific cause or steps to make it happen consistently I'll try to fix it.
Logged

Mans

  • Galactic Citizen
  • ****
  • Posts: 418
Re: An app launcher for Theater View
« Reply #23 on: October 15, 2017, 12:20:18 pm »

Great day to all,

Anyone have the plug-in to work with MC x64 ? I'm @ the latest version: .72

It seems i can't have the .exe fixed under it's setting - Tools -> Theater View -> You Tube TV in my case.
After start-up of MC it returns to the Program File x86 folder ?

When on MC x86 it worked nicely.

Thanks for any hint or workaround !
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: An app launcher for Theater View
« Reply #24 on: October 15, 2017, 01:16:59 pm »

This isn't a plug-in so it doesn't matter which flavor of MC you are using. There's something else going on.
Logged

Roky

  • Member
  • *
  • Posts: 4
Re: An app launcher for Theater View
« Reply #25 on: November 09, 2017, 02:59:48 pm »

Thank you very much for your work. Seems to work really well !!!
Logged

Araj

  • World Citizen
  • ***
  • Posts: 190
Re: An app launcher for Theater View
« Reply #26 on: March 13, 2018, 01:10:28 pm »

Thanks! This is excellent!

Just found this post and now I can finally launch Netflix from Theater View without the focus of my remote staying on MC...
Logged

didiergo

  • Recent member
  • *
  • Posts: 8
Re: An app launcher for Theater View
« Reply #27 on: May 17, 2018, 03:57:15 pm »

Thank you for sharing your work.
This is exactly what I was looking for to use third-party applications with JRiver.
I will try it as soon as possible

Thank you
Logged

dgm1960

  • Recent member
  • *
  • Posts: 11
Re: An app launcher for Theater View
« Reply #28 on: June 12, 2018, 12:14:42 pm »

Thank you very much for this plugin. Works perfectly and is a great addition to the player.
Logged

Araj

  • World Citizen
  • ***
  • Posts: 190
Re: An app launcher for Theater View
« Reply #29 on: July 14, 2018, 09:39:43 am »

Rats! Was working well to launch Netflix for a while but now it mostly crashes :-(

Maybe there will be a built-in Theater View Netflix launcher one day...
Logged

Raildog

  • Member
  • *
  • Posts: 2
Re: An app launcher for Theater View
« Reply #30 on: January 23, 2019, 09:37:44 am »

I know this is an old thread but wanted to thank Don W for the great work. This is a wonderful solution for Hulu and Netflix integration.

Thanks!   
Logged

taozui

  • Member
  • *
  • Posts: 1
Re: An app launcher for Theater View
« Reply #31 on: February 22, 2020, 06:29:39 am »

感谢您分享您的作品
Logged

stevehughes

  • Recent member
  • *
  • Posts: 22
Re: An app launcher for Theater View
« Reply #32 on: February 13, 2021, 07:23:28 pm »

Another belated thank you to Don W. 
Logged
Pages: [1]   Go Up