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.