This is probably one of the most surreal issues I've seen in a while.
I've recently purchased a Motorola Edge Android phone. Installed the #Jellyfin client on it and all. Today I wanted to cast a video to my Chromecast, and surprisingly got a _Google Cast unsupported_ error in the client.
Weird, since Google Cast support has been working flawlessly on all my other Android/Jellyfin Web devices.
I dug through the web, and found [this issue](https://github.com/jellyfin/jellyfin-web/issues/4747).
Jellyfin Web, like many other Web-based services, does some fuzzy regex matching of the user agent header to understand what browser it's talking to.
In particular, Google Cast support is only available on Chrome-based Web views, so it'll show an _unsupported_ error on any other browser.
(Btw [I proposed a while ago](https://www.reddit.com/r/jellyfin/comments/sultqe/comment/hxb7t3x/) to support cast support on the server level as well, using server-side mDNS discovery to detect cast devices on the same network as the server, which would probably solve the problem of relying on Chrome's proprietary implementation).
Guess what? Edge (the Microsoft browser, not the Motorola phone) is also among the unsupported browser regexes. That regex just so happens to be matched before the Chrom* one, and unfortunately Edge phones export a user agent string that contains `Motorola Edge`.
So, if you use a Motorola phone, Jellyfin will think that you're using Microsoft's browser and cast support won't work.
The fix? Well...just move the Chrom* checks before the Edge check.
A reminder that relying on user agent strings to build your application's logic is _always_ a bad idea that will _always_ lead to unintended consequences.
Even if you have meticulously gone through all the possible popular combinations of user agents, nothing prevents in the future a new HTTP client from advertising a user agent string that will start matching your regexes and lead to all kind of weird issues.
https://github.com/jellyfin/jellyfin-web/issues/4747