Leanback YouTube on TV for PC on Chrome
#1
Hello, I am not sure if this is where I should post this, if not, can the MOD please move this and I apologize in advance.

Anyhow, after a little trial and error, I have figured out how to launch leanback youtube on tv for Windows in Chrome using a Smart TV user agent switch and launching it through a batch file. Using a portable installation of chrome allows everything to "just work"
Instructions:
  • Install portable chrome to the directory of your choosing and make note of its location. 
  • Open chrome portable and sign in to your Google account
  • Open notepad or Notepad++ and paste all of the following as one line of code:
Code:
"root\path\to\chrome\portable\App\Chrome-bin\chrome_proxy.exe" --user-data-dir="root\path\to\chrome\portable\Data\profile" --profile-directory=Default --user-agent="Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15" --kiosk https://www.youtube.com/tv#/surface?c=FEtopics&resume
  • You will replace "root\path\to\chrome\portable\" with the root of the portable chrome install folder. So if you installed it to C:\GoogleChromePortable64", you would replace the path to chrome at beginning and the "--user-data-dir=" it would look like this:

Code:
"C:\GoogleChromePortable64\App\Chrome-bin\chrome_proxy.exe" --user-data-dir="C:\GoogleChromePortable64\Data\profile" --profile-directory=Default --user-agent="Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15" --kiosk https://www.youtube.com/tv#/surface?c=FEtopics&resume
  • Save as .bat file ext to an easy to remember location and exit.

If you ever need to change your user agent string here is a list of strings for different devices.

Next you need to convert that .bat to an exe. When the program opens (launch Bat_To_Exe_Converter_(x64) for 64-bit systems).
  • select your .bat then select invisible for visibility.
  • Under architecture, select whether your system is 32 or 64 bit.
  • (optional) on the version tab, you can include an icon if you want.
  • click the "Compile" button (this is where you may get the AV false positive, its fine, I have been using this program for years and have never had issues)
Note: The .exe will be saved in the same location as your .bat file for easily locating after you're through


Bonus: 
  • If you have autohotkey installed and have AdvancedMCERemoteMapper, you can create a script and add these lines for launching and exiting with ease.
  • replace "path\to\bat-exe\you\created\YouTube on TV.exe" with the location of the .exe you created earlier. 
Code:

#SingleInstance, Force
HideShowTaskbar(hide := hide)
   
HideShowTaskbar(action) {
   static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
   VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
   NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
   NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
   DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
}    

^!V::
          ;this launches youtube on tv using Ctrl+Alt+V
if WinExist("YouTube on TV - Google Chrome ahk_class Chrome_WidgetWin_1")
   {
      WinActivate
      return
   }
Run "path\to\bat-exe\you\created\YouTube on TV.exe"
return
+Escape::
          ;shift+escape will close the tab and close portable chrome as well. Since chrome closes when the last tab is closed, this effectively closes chrome without needing to send alt+f4. 
    send, ^w
WinWaitClose, YouTube on TV - Google Chrome ahk_class Chrome_WidgetWin_1 
return

Finally you can set the shortcut of control+alt+v andshift+escape within Advance MCE Remote Mapper to any key you like, I chose "Pictures" on my HP Remote and "visualisation" as my exit. You can use any key though.

Now you can add it to Advanced Launcher in Kodi and add it to the home screen as well as launching it from the remote.

I hope this helps someone as it has me. If you have any problems, post it here and I will try and sort it out for you.,
↯ Ω ☿
If I've helped you, dont forget to give me 👍! Thank you and never stop rocking on! 🤘
Reply


Messages In This Thread
Leanback YouTube on TV for PC on Chrome - by LegzRwheelz - 2020-03-02, 21:55
Logout Mark Read Team Forum Stats Members Help
Leanback YouTube on TV for PC on Chrome1