Streaming PC to LG TV
Streaming a desktop PC to the TV is very convenient for webbrowser streaming, for watching movies, series, or anime, for gaming, or navigating the desktop, file-system, and applications.
After I got my new TV at the end of last year I looked into alternatives to my previous hardware Steam Link. On big panning movements in anime I saw stuttering, which I had always been wondering where the bottleneck lies, unable to narrow it down.
Exploration of Alternatives
From [PC] | To [TV] | Notes |
---|---|---|
Steam | Steam Link hardware + HDMI | performance issues; video stuttering on wide scenery panning [in anime] |
Steam | Steam Link smart-TV app | unfortunately not available on LG TVs WebOS |
Steam | IHSplay | IHSPlay is an open source Steam Link Client for webOS TV |
WiFi screen mirroring (WIN+P) | not possible over cable | |
LG WebOS Windows Remote Desktop | not adequate quality or FPS performance for video | |
nVidia thing | was dropped by nVidia, and I have AMD | |
Kodi | Kodi App | |
Sunshine | Moonlight | Works great! Low latency, after inherent setup-hassle works stable |
Streaming from Sunshine to Moonlight
Installing and running Sunshine on the PC is as simple as any other program. The service runs in the background, and offers a website user interface.
The TV setup is a hassle because it requires a developer account and manual installation, because the Moonlight app is not published in the official WebOS app store.
- Prerequisite: Have PC and TV in the same local network
- Install Sunshine on the host PC
- Install Moonlight on the LG TV
- On TV: Enable Dev Mode on the TV
- Register a WebOS TV Developer Account
- Open Home -> Developer Mode (app) -> Login (LG Account email + password) -> confirm TV restart
- Open Home -> Developer Mode
- Enable Developer mode
- Enable key server
- On PC: Install webOS Dev Manager
- Connect webOS Dev Manager and TV
- webOS Dev Manager -> TV Dev Mode App -> Enable dev mode and key server -> add TV (see TV Developer Mode app for details; should still be open from previous steps)
- On PC: In webOS Dev Manager Install Moonlight
- On TV: Enable Dev Mode on the TV
- Connect Sunshine and Moonlight
- On PC: Open Sunshine
- On TV: Open Moonlight
- In Moonlight connect to PC (automatically appears when visible in the network)
- Follow authentication via displayed PIN (only necessary once) (available (on network) PC -> connect with PIN - sunshine notifies and shows PIN -> enter on TV -> Connected)
You are now connected.
The webOS Dev Manager serves as a remote TV manager on the PC. The TV has to be on, and on the network, then you can install apps on it remotely, and a few other functionalities.
Automatically Refreshing Developer Mode Expiry
The TV developer mode remains in developer mode for 999 hours (~41 days) by default. After expiry, it has to be enabled and connected again.
The TV offers a HTTP endpoint you can call to extend it back to 999.
I set up a scheduled task in Windows Task Scheduler that runs every hour. It’s a simple inexpensive call, so every hour is fine, and for when the TV is regularly turned off, it’s still regular enough to hit when it is on.
My preferred shell is Nushell, so I have it installed, and use
"C:\Program Files\nu\bin\nu.exe" C:\dev\tv-webos\refresh-dev-session.nu
refresh-dev-session.nu
:
# From webOS Dev Manager
# Expiry display in TV only updates after TV reboot
const $sessionToken = 'to-be-filled'
const $resetUrl = $"https://developer.lge.com/secure/ResetDevModeSession.dev?sessionToken=($sessionToken)"
def main [] {
# 'success' or 'fail'
let $result = http get --redirect-mode error $resetUrl | from json | get result
if $result == 'success' { exit 0 }
exit 1
}
# Maybe add content type request header for json?
# --headers [my-header-key my-header-value]
# https://www.nushell.sh/commands/docs/http_get.html
This works through other scripts and programs too, as long as you can send the HTTP GET request with the correct token, while your TV is on[line].
To find the correct token, you can check in webOS Dev Manager -> Info -> Renew automatically… and it shows you the URL that you need to call one way or another. It also offers a (Linux) shell script, and IFTTT applet information.
It’s also fine if you call the URL manually from your webbrowser. Given that it’s necessary only about once a month, that’s feasible if you’re not familiar with scripting and/or don’t want to go through the setup.
Wireless Control
Having bought a wireless mouse, connected to my PC as an additional mouse, specifically for control from the sofa made controlling flawless.
I flip the switch and can immediately use the mouse. And after that I flip it off again. No delay. (No holding power button for 3 seconds like I had to on my wireless controller before.)