Plex keeps buffering video even though it's played on localhost web player

When the client says that it is not connected directly to the server (but the server is in the same local network), it usually means you have either a general issue with DNS or with “DNS rebinding protection” specifically.

First step: try using the hosted web app in a fresh web browser session: https://app.plex.tv
Disable any web browser add-ins you might have activated. If that clears the error, re-enable them one by one and repeate the playback test until you have found the culprit.

Second step:
configure your router or your computer to use the DNS servers of Google: 8.8.8.8 and/or 8.8.4.4

Third step:
look for configuration options in your router/DNS resolver about DNS rebinding protection and create an exception rule for the domain plex.direct: https://support.plex.tv/articles/206225077-how-to-use-secure-server-connections#toc-4