jellyfin / jellyfin-web

Web Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.26k stars 1.2k forks source link

Google Cast Unsupported on Motorola Edge 30 #4747

Closed minigt closed 11 months ago

minigt commented 1 year ago

Describe The Bug Bug derive from https://github.com/jellyfin/jellyfin-android/issues/1147

The android app on moto edge can't cast to Chromecast, despite other apps(Netlix, Dysne+, Star+) being able to cast.

Steps To Reproduce On a moto edge phone

1) install jellyfin from google play 2) open app 3)connect to server via https 4)click cast button 5)see "(Google Cast Unsupported)"

Expected Behavior Should be able to cast to a chromecast device

minigt commented 1 year ago

I found hat the issue is on line

https://github.com/jellyfin/jellyfin-web/blob/26b83efc95f24ddc10c595d8e472682342764d0b/src/index.jsx#L113

as it should be

} else if (!browser.chrome && !browser.edgeChromium && !browser.opera && !browser.edge) {

ryannathans commented 1 year ago

browser.edge?

minigt commented 1 year ago

yeap, apparently XD

minigt commented 1 year ago

I am trying to push the bugfix branch but it says I don't have permission

ryannathans commented 1 year ago

oh no I think the browser detection is seeing the "motorola edge 30" in the user agent and identifying the browser as edge...

ryannathans commented 1 year ago

I am trying to push the bugfix branch but it says I don't have permission

you probably want to fork the repo, branch off master, make the changes, push to your repo and then open a pull request

minigt commented 1 year ago

you were right, it was the edge on moto edge

here https://github.com/jellyfin/jellyfin-web/blob/26b83efc95f24ddc10c595d8e472682342764d0b/src/scripts/browser.js#L187

const uaMatch = function (ua) { ua = ua.toLowerCase(); console.log(ua); const match = /(edg)[ /]([\w.]+)/.exec(ua) || /(edga)[ /]([\w.]+)/.exec(ua) || /(edgios)[ /]([\w.]+)/.exec(ua) || /(edge)[ /]([\w.]+)/.exec(ua) || /(opera)[ /]([\w.]+)/.exec(ua) || /(opr)[ /]([\w.]+)/.exec(ua) || /(chrome)[ /]([\w.]+)/.exec(ua) || /(safari)[ /]([\w.]+)/.exec(ua) || /(firefox)[ /]([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];

this is the log

mozilla/5.0 (linux; android 13; motorola edge 30 neo build/t1ssms33.1-121-4-1; wv) applewebkit/537.36 (khtml, like gecko) version/4.0 chrome/115.0.5790.138 mobile safari/537.36, webpack-internal:///./scripts/browser.js (206)

ryannathans commented 1 year ago

how good are you with regex? :P

minigt commented 1 year ago

I think I'll just move the chrome line up in the chain XD

minigt commented 1 year ago

yeap, that works

ryannathans commented 1 year ago

I might have a crack at rewriting that regex later, it might not even be needed if there's a better test for browser compatibility

ryannathans commented 1 year ago

https://developers.google.com/cast/docs/web_sender/integrate#initialization

maybe it should be doing something like this

minigt commented 1 year ago

Be my guest. If you don't find the time, at least the moto edge issue will be solved with this. Thanks for your help!

ryannathans commented 1 year ago

thank you for finding the funny browser check

Maxr1998 commented 1 year ago

Wow, that's unexpected. Thanks for debugging this and finding a solution!

ryannathans commented 1 year ago

parsing the user agent is strongly cautioned against

https://hacks.mozilla.org/2013/09/user-agent-detection-history-and-checklist/

But let get the record straight. User-Agent sniffing is a future fail strategy. By design, you will detect only what is known, not what will come. The space of small devices (smartphones, feature phones, tablets, watches, arduino, etc.) is a very fast-paced evolving space. The diversity in terms of physical characteristics will only increase. Updating databases and algorithms for identifying correctly is a very high maintenance task which is doomed to fail at a point in the future.

capabilities should be checked for individually if possible, and behavior should changed based on those capabilities and not the user agent

for example, using chromecast if the browser supports it would not only fix this issue but also probably fix casting with ungoogled chromium

icedterminal commented 12 months ago

This unsupported warning happens with all of Motorola's Edge models. Since they all report Edge in the UA string. https://gsmarena.com/results.php3?sQuickSearch=yes&sName=Motorola%20edge

I have the Edge 2021 and Edge 2023.

thornbill commented 11 months ago

Fixed by #4748