INTERACT FORUM

Please login or register.

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

Author Topic: MC-YouTube - Better way to access YouTube from theaterview  (Read 8086 times)

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
MC-YouTube - Better way to access YouTube from theaterview
« on: July 23, 2017, 06:30:48 pm »

Based on a topic about YouTube improvements I started here https://yabb.jriver.com/interact/index.php/topic,111262.0.html I decided to try and come up with something that better suited my needs. Based on some suggestions in that thread I looked into https://www.youtube.com/tv. YouTube did a great job on that interface. So how to integrate that into MC?

I wrote a small vb script that can be launched from within theaterview. it will first minimize MC (I had to do this because for some reason while in Theaterview MC seemed to want to take focus even with "Hide MC" option checked in options). It will then launch your browser of choice to the YouTube TV page(Currently must use Chrome not Firefox). It will then put that page into fullscreen. After you exit the YouTube TV page (if you use a keyboard can be done with ALT-F4, with a remote will require additional setup, EventGhost maybe?) you return to MC. The script then ends. This isn't really integrating it into MC obviously but just launching an external program. Without JRiver themselves don't think we can get much closer than this though.

Download the script here:
https://drive.google.com/drive/folders/0B8STIzDFNsyoTjU3UUNkZWlwYlk?resourcekey=0-yQ6xEYttVgAHuEyqEr-OOg&usp=sharing

MC YouTube.vbs
Code: [Select]
Dim BrowserTitle
Dim BrowserCommand

' ****** Comment or unComment the following based on what browser you want to use ******

'BrowserCommand = """C:\Program Files\Mozilla Firefox\firefox.exe"" ""https://www.youtube.com/tv"
BrowserCommand = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" ""https://www.youtube.com/tv"

'BrowserTitle = "YouTube on TV - Mozilla Firefox"
BrowserTitle = "YouTube on TV - Google Chrome"

' **************************************************************************************

' ****** Don't change anything below this point ******

Set objShell = WScript.CreateObject("Wscript.Shell")

' Minimize MC
objShell.SendKeys "% n"

' Launch browser
objShell.Run BrowserCommand

' What for YouTube to open in the browser
Do
    act = objShell.AppActivate(BrowserTitle)
    If act = True Then
        Exit Do
    End If
    WScript.Sleep 1000
Loop

' Make browser fullscreen
objShell.SendKeys "{F11}"

' Wait for browser to exit
Do
    act = objShell.AppActivate(BrowserTitle)
    If act = False Then
        Exit Do
    End If
    WScript.Sleep 1000
Loop

Set objShell = Nothing

Install-Usage:
In "MC YouTube.vbs" change the following:
Select the browser you want to use by commenting or un-commenting out the corresponding lines for "BrowserCommand" and "BrowserTitle"
For now only use Chrome not Firefox. Chrome is selected by default so you should not have to change anything.

Image below shows changes needed in MediaCenter's Theaterview options.


Start MC Theaterview and test.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72534
  • Where did I put my teeth?
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #1 on: July 23, 2017, 06:39:47 pm »

Nice work.  Thank you!
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #2 on: July 23, 2017, 06:43:11 pm »

Thanks Jim.
I just noticed I posted this in the "Plugin Development" board and not the "   
Third Party Plug-ins, Programs, and Skins" board. I created a topic on there. Should you close this one?

Edit: Nevermind, see you moved the post. Thanks!
Logged

Castius

  • Citizen of the Universe
  • *****
  • Posts: 562
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #3 on: July 24, 2017, 12:00:14 am »

Good work! i look forward to testing this.
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #4 on: July 24, 2017, 03:29:08 am »

I just uploaded a new version. Link in first post is to the updated version.

Fixed MC wasn't allowing browser to take total focus and MC was intercepting the fullscreen command for the browser.
MC is now minimized instead of closed(fixed above issue as well) allowing the Media Server to continue running in the background.
Removed need to add manual timing delay.

There is still an issue I haven't been able to resolve if you use firefox as the browser. The first time you launch youtube from theater view firefox enters fullscreen fine. If you close firefox you are returned back to theater view but if you then again go back to youtube firefox will most of the time not enter fullscreen. I don't know why yet so for now you must use chrome, it works perfect every time. I haven't tested with any other browsers yet.
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #5 on: July 24, 2017, 11:50:43 am »

This works a treat for me and is controllable with my Harmony One handset. Really good, thanks and will save me casting from other devices.

Is there any way out of the browser screen other than ALT F4?

Thanks for your efforts...

Ps Would it be possible to do something similar for BBC IPlayer??
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #6 on: July 24, 2017, 02:59:20 pm »

Glad it works for you.

ALT-F4 is pretty much how you have to go about exiting the browser. I don't have any experience using the Harmony One. If it can simulate a key press you should be able to program a button or something for ALT-F4. I have no idea if you can though. I use a small keyboard most of the time so ALT-F4 isn't a big deal but also use a remote sometimes. I'm currently playing with configuring EventGhost to work with my remote and assigning a button to simulate the ALT-F4 key combo, you might want to loo into that. http://www.eventghost.net/

I took a look at BBC IPlayer and unless I'm missing something it looks to be totally mouse controlled? Doesn't seem you can control it with a keyboard or remote? You could certainly launch the IPlayer site the same way I'm doing with youtube tv. Once you are there though do you have a way of navigating it with your remote?
Logged

robt

  • Galactic Citizen
  • ****
  • Posts: 313
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #7 on: July 24, 2017, 04:33:35 pm »

Been playing all evening and its working very nicely. Very pleased!

I've been doing a bit of hunting around and came across eventghost so will have a play tomorrow, also I shall have a play with Iplayer and see what can be done. Also Amazon video...

Certainly the best way for accessing Youtube, perhaps the developers can incorporate this as its much better than the current implementation in MC?

Thanks again, I will update if I can get the exit sorted with my remote.
Logged

jachin99

  • Citizen of the Universe
  • *****
  • Posts: 559
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #8 on: July 24, 2017, 06:15:51 pm »

Correct me if I'm wrong but you can also use a modified version of this script for actual programs also, right?  So if someone wanted to add something like steam to theater view, they could tell that script to return focus to MC after steam closes? 
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #9 on: July 24, 2017, 06:44:47 pm »

Correct me if I'm wrong but you can also use a modified version of this script for actual programs also, right?  So if someone wanted to add something like steam to theater view, they could tell that script to return focus to MC after steam closes?

I don't see why not. You remove the sending of F11 for full screen obviously. Also would have to change BrowserTitle variable to match whatever the window name for Steam is when it's running and BrowserCommand would be the patch to you steam exe. However first you might try just launching steam directly from MC without going through the script and see if it works. Change the theater view option in MC like I showed but instead use the steam exe instead of my vbs. If it doesn't act right then you could try modifying the script to handle it.
Logged

Don W

  • World Citizen
  • ***
  • Posts: 185
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #10 on: August 02, 2017, 01:47:05 pm »

Just letting folks know, I made a general purpose launcher using C# and WPF. It works great with YouTube TV, and can close the app as well as translate MCE buttons to keystrokes and a few other things. What justsomeguy did with vb script is great, its just that WPF is a bit more powerful. Here's the thread: https://yabb.jriver.com/interact/index.php/topic,111645.0.html
Logged

Araj

  • World Citizen
  • ***
  • Posts: 190
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #11 on: December 01, 2017, 06:39:42 am »

I've been playing around with this script in an attempt to launch the Aeon standalone screensaver, seeing as the Aeon MC screensaver doesn't seem to detect/support the 64-bit version of MC.

I wrote "playing round" because I have almost no knowledge of VB scripts other than the few tips I have found online.

Here's what I have so far:

Code: [Select]
Dim AeonCommand

AeonCommand = """H:\Program Files (x86)\SoundSpectrum\Aeon\Aeon Standalone.x64.exe"""

Set objShell = WScript.CreateObject("Wscript.Shell")

' Minimize MC
objShell.SendKeys "% n"

' Launch Aeon
objShell.Run AeonCommand

' Make Aeon fullscreen
objShell.SendKeys "+{ENTER}"

Set objShell = Nothing

The script opens Aeon, but the SendKey variables don't seem to have any effect: MC isn't minimised and Aeon doesn't go fullscreen (which is what I was trying to automate). The fullscreen keys for Aeon are Shift+Enter, and according to what I found online, "+{ENTER}" would be the code to do that.

Thanks in advance for any tips!
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #12 on: December 02, 2017, 02:59:29 am »

How are you testing this script? Are you launching it from within Media Center or just running the file from desktop? When you use objShell.SendKeys "% n" it is sent to the current active window.

Try using:
' Minimize MC
objShell.AppActivate("JRiver Media Center 23")   'This makes MC the active window
objShell.SendKeys "% n"



You may also need to add a delay after launching Aeon. Otherwise you send your +{ENTER} before the app is fully loaded.
' Launch Aeon
objShell.Run AeonCommand
WScript.Sleep 5000   ' 5000 is 5 seconds, may need adjusted depending on how long it takes Aeon to load.

' Make Aeon fullscreen
objShell.SendKeys "+{ENTER}"


However using a loop to check for when Aeon has loaded would be better. This will check once a second if Aeon has loaded before continuing. You would use this to replace the WScript.Sleep 5000 above.
Do
    act = objShell.AppActivate(AeonWindowTitle)  ' AeonWindowTitle needs to be changed to whatever Aeon's actual window title is
    If act = True Then
        Exit Do
    End If
    WScript.Sleep 1000
Loop



Logged

Araj

  • World Citizen
  • ***
  • Posts: 190
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #13 on: December 02, 2017, 05:24:29 am »

Thanks JSG!

All I needed to do was add the line

WScript.Sleep 1000

before the SendKeys command.

I now have a new problem - how to exit Aeon and get back to MC. The key combination is the same.

Obviously, I can use a keyboard, but that was what I was trying to avoid in the first place.

It seems to be a kind of Catch 22 - I need to exit fullscreen in Aeon before I can trigger a script to exit fullscreen ;-)
Logged

justsomeguy

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 525
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #14 on: December 02, 2017, 03:35:56 pm »

What is meant to be the trigger for exiting Aeon? Do you want pressing a key to exit Aeon, when music playback stops or something else? Using vbs might not be possible to achieve this.
You might take a look at this https://yabb.jriver.com/interact/index.php/topic,111645.0.html instead. Add your Aeon executable as a command line. You can then exit Aeon by any of these ways:
    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
Logged

Araj

  • World Citizen
  • ***
  • Posts: 190
Re: MC-YouTube - Better way to access YouTube from theaterview
« Reply #15 on: December 03, 2017, 12:04:34 pm »

Thanks for your help but the problem has been resolved by deinstalling Aeon and MC and then reinstalling MC and Aeon 3.9.2 64-bit beta, which was kindly provided to me today by SoundSpectrum.

However, the information you gave me will surely help me in customising MC in future...
Logged
Pages: [1]   Go Up