tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
2.99k stars 250 forks source link

H.264 failover should tell user to try STUN in Video Settings #1651

Closed mtlynch closed 10 months ago

mtlynch commented 11 months ago

Blocked on https://github.com/tiny-pilot/tinypilot/pull/1647.

Now that we have STUN support in the web UI (see https://github.com/tiny-pilot/tinypilot/issues/1460), we can improve the error message when the user fails over from H.264 to MJPEG because the issue is probably that they need a STUN server:

image

jotaen4tinypilot commented 10 months ago

Shall we just add some “static” text based on mere likelihood, or shall we carry out some sort of check before extending the error message? (Not sure yet how such a check would look, though…)

Potentially related to the dynamic check: https://github.com/tiny-pilot/tinypilot/issues/1649.

mtlynch commented 10 months ago

This kind of ties into a PR discussion @cghague and I had a couple of days ago.

My sense is that if H.264 is broken, the chances of STUN fixing it within our userbase is like 90%.

Charles - Am I overlooking other issues that would be likely among our users that would cause the WebRTC connection to fail?

cghague commented 10 months ago

Interesting question, @mtlynch!

We rarely, if ever, get reports of WebRTC/H.264 failing within a single internal network. Based on that, it's reasonable to say that encoding problems, device configuration, browser compatibility, and other similar issues aren't likely to cause problems for our users.

That only really leaves networking issues as a potential source of problems. It's anecdotal, but my experience suggests restrictive NAT configurations and firewalls are the most common root cause of WebRTC/H.264 failing. STUN can help with both restrictive NAT and some types of firewalls, so I think your interpretation is fair.

mtlynch commented 10 months ago

How about this text?

TinyPilot failed to stream video output from your target device using H.264 compression.

You may be able to resolve this issue by using a STUN server. Go to System > Video Settings > Advanced Settings to enable this option.

See System > Logs for diagnostic details.

jotaen4tinypilot commented 10 months ago

Just wanted to double-check about us omitting the “Refresh the page may fix the issue” bit: I still occasionally see random H.264 connection failures that usually go away by itself through a page refresh – although that’s rare and erratic, I’m still wondering whether it might be worth to keep that hint. (In contrast to “restart your device”, which I don’t think should be necessary anymore.)

For the middle part, I’d be thinking along the lines of:

Refreshing the page may fix the issue. In case this problem persists, you may have to configure a STUN server in order to use H.264 video streaming. Go to “System” > “Video Settings” > “H.264” > “Advanced Settings” to enable this option.

It also might be superfluous, though, because maybe people try a page refresh intuitively. It also makes the message more verbose.