Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Chromecast video from Pixel 3a running Android 11 (Jellyfin 10.6.4 & 10.7) #303

Closed
dpraul opened this issue Feb 15, 2021 · 39 comments
Closed
Labels
bug Something isn't working stale

Comments

@dpraul
Copy link

dpraul commented Feb 15, 2021

Describe the bug
The bug is as particular as the title is - from a Pixel 3a running Android 11, Chromecast video will not work (to a Vizio smart tv). That very same device is able to cast to an audio-only device (Google Home) just fine. Other devices can cast to the smart tv using the Jellyfin app just fine.

To Reproduce

  1. Launch app on Pixel 3a running Android 11
  2. Press cast button
  3. Choose Google Cast
  4. Select a video target
  5. Loading spinner is displayed, but Jellyfin does not connect on televison.
  6. Eventually the spinner will disappear.

Logs
There are no system logs in the Jellyfin dashboard for the above events, nor any from the Jellyfin container.

I could not find how to access logs on Android - happy to grab them if they are available somewhere.

System (please complete the following information):

  • App version: 2.2.3
  • Android version: Android 11 (security update 2021-01-05, google play update 2020-12-01)
  • Device manufacturer and model: Google Pixel 3a
  • Jellyfin server version: 10.6.4 and 10.7 (tested both)
  • The type of video player implementation used: web player AND integrated player (ExoPlayer) (tried both - although I'm guessing player doesn't impact Chromecast)

Additional context

  • Other sources CAN use Chromecast with the server: the web player in desktop Chrome works, as well as casting from a Nokia 6.1 running Android 10
  • All Jellyfin instances are running in Docker behind an Nginx reverse-proxy. They have a valid SSL certificate from LetsEncrypt
  • The video device is a Vizio television. The Pixel in question is able to cast to it using other apps.
  • I'm not sure if this is particular to Android 11, the Pixel 3a, or both. I don't have any other devices running Android 11 to check.
@dpraul dpraul added the bug Something isn't working label Feb 15, 2021
@nielsvanvelzen
Copy link
Member

Did you try with the unstable chromecast receiver? (Settings -> Playback -> Chromecast version)

@dpraul
Copy link
Author

dpraul commented Feb 16, 2021

Yes, same result with the nightly chromecast receiver - although, the nightly version has never worked for me on any devices.

@Harteex
Copy link

Harteex commented Feb 16, 2021

I have the same problem with a Pixel 3 phone. It used to work, but I think it broke in a phone update. Every other app on the device is able to use Chromecast.
I also tried both stable and unstable chromecast versions, and I tried to reinstall the app. Using Chrome with the web player does work fine with Chromecast.

@villor
Copy link

villor commented Feb 23, 2021

Same problem with my Pixel 2 running Android 11.
Changing to nightly makes no difference

@agilob
Copy link

agilob commented Mar 1, 2021

I got an update from FDroid today and it stopped working completely. Chromecast isn't detected in the latest version, but it worked in previous version.

Currently installed version is 2.2.3

@nielsvanvelzen
Copy link
Member

F-Droid version does not support casting

@agilob
Copy link

agilob commented Mar 1, 2021

but it did

@nielsvanvelzen
Copy link
Member

nielsvanvelzen commented Mar 1, 2021

Today was the first time our app was published to the F-Droid repositories and it does not include casting.

See the blog for more info: https://jellyfin.org/posts/android-on-fdroid/

@agilob
Copy link

agilob commented Mar 1, 2021

Didnt you have own fdroid repo I imported over a year ago?

I'm 100% sure I installed it from fdroid before.

@nielsvanvelzen
Copy link
Member

No. We were included in IzzyOnDroid for a few months but it always included the same no-cast version as we just published. You might have sideloaded the app yourself.

@dpraul
Copy link
Author

dpraul commented Mar 11, 2021

Just to bump this, I'm still encountering this issue on 10.7 stable

@ragebflame
Copy link

ragebflame commented Mar 11, 2021

I am also seeing this issue on my Oneplus 5T & 3T
Server version: 10.7
Android app version: 2.2.3
Android version: Android 9, 10.

I have tried the stable and unstable versions of the Chromecast receiver within the app. I have no issues if I cast from either phone via a browser, only the Jellyfin application has issues. The Chromecast does not appear as an option to cast to.

@scob7
Copy link

scob7 commented Mar 19, 2021

This was a real pain, but I got it working. Part of the problem is chromecast and not using dhcp dns servers so using a local hostname is tricky, and partly Jellyfin not returning a usable LocalAddress when running in containers on separate networks.

The first part is not technically a jellyfin issue, but it you want it to play nice with chromecast getting a valid ssl cert to work using a locally routable url is not so easy for the average user. I now understand why plex set it up the way they did creating unique dns names XXXX.plex.direct for each server which they run as a dynamic dns for you on a valid wildcard cert.

In my setup I wanted to use a local only hostname (ie jellyfin.my-domain.com) using the valid wildcard cert for my public domain name (*.my-domain.com) installed on my nginx reverse proxy (kubernetes nginx-ingress issued by letsencrypt) . So I created a jellyfin.my-domain.com on my local dns server but chromecast doesn't use the dns server assigned via DHCP so I had to override all queries to google dns servers (8.8.8.8 and 8.8.4.4) so that chromecast could resolve jellyfin.my-domain.com to my reverse proxy local ip address.

**The real silly part is how stubborn the jellyfin server is at determining its own LocalAddress url. Checking the output of https://jellyfin.my-domain.com/System/Info/Public the LocalAddress returns the container ip inside the container network which is not routable outside those networks.

Version 10.7.0-1 of jellyfin server even asked for the server url first thing as part of setup, but its not returned by /System/Info/Public None of the network settings seem to override this value. So I had resort to a nginx re-write to return "LocalAddress":"https://jellyfin.my-domain.com"**

location ~* /System/Info/Public {
              add_header Content-Type "application/json; charset=utf8";
              return 200 '{"LocalAddress": "https://jellyfin.my-domain.com","ServerName":"Jellyfin Server","Version":"10.7.0","ProductName":"Jellyfin Server","OperatingSystem":"Linux","Id":"XXXXXXXX","StartupWizardCompleted":true}';
            }

At a minimum the jellyfin server should have a working config value that overrides the LocalAddress. I understand not wanting to create a dynamic dns server like plex so dealing with dns and certs is left up to users, but this will really prevent wide spread adoption if chromecast doesn't work "out-of-the-box".

@dpraul
Copy link
Author

dpraul commented Mar 19, 2021

This was a real pain, but I got it working. Part of the problem is chromecast and not using dhcp dns servers so using a local hostname is tricky, and partly Jellyfin not returning a usable LocalAddress when running in containers on separate networks.

I had the same issue on Jellyfin 10.6.2 with all my clients until I did a very similar workaround to what you suggested. AFAIK, though, the Jellyfin Chromecast client doesn't use the LocalAddress field since 10.7, since this workaround is no longer needed in my setup.

That said, did your fix solve the issue on Android 11? Because that's the only client giving me issues. The app can play content fine, and can find Chromecast devices (the casting dialogue opens and lists all the devices in my network), but clicking any of them just opens a loader and never displays content on the device. All my other clients (Google Chrome, Android 10, mpv shim) are able to cast just fine.

(FYI: I have a split horizon DNS on my internal network, so DHCP DNS returns a proper internal IP for jellyfin, and then I forward all outbound traffic on port 53 to my firewall's DNS server, so Google's DNS shouldn't play a factor here)

@scob7
Copy link

scob7 commented Mar 20, 2021

Jellyfin Chromecast client doesn't use the LocalAddress field since 10.7, since this workaround is no longer needed in my setup.

And you are correct! I removed the nginx re-write for the LocalAddress and chromecast is still working on both my Android 11 phone and chrome browser on my desktop. I figured I needed that as my first attempt was setting up 10.6.4.

I also have a split horizon dns as the jellyfin hostname and ip are only available in my home network (192.168.X.X). Are you positive that the chromecast isn't getting out to 8.8.8.8 and failing to resolve or returning a public ip? I have pfSense as my router/dns/firewall and set it up like this https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

@EvilDrW
Copy link

EvilDrW commented Mar 20, 2021

FWIW, I have the exact same setup as the original submitter (pixel 3a, android 11, jellyfin 10.7). I'm not using a reverse proxy or anything complex like that. I simply have jellyfin running in a docker container on my local network. I observe the same symptom that all of the cast devices on my network are selectable, but picking any of them gives the spinner for a very long time. No other obvious activity happens.

@dpraul
Copy link
Author

dpraul commented Mar 20, 2021

I also have a split horizon dns as the jellyfin hostname and ip are only available in my home network (192.168.X.X). Are you positive that the chromecast isn't getting out to 8.8.8.8 and failing to resolve or returning a public ip? I have pfSense as my router/dns/firewall and set it up like this https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

Bizarre, I've also got pfSense as my firewall and I'm using the same rule. I'm only redirecting port 53, though, so I suppose it could be connecting by DoT or DoH, but everything I've read leads me to believe that Android 10 - which works totally fine with Chromecast - has the same DoT/DoH support as Android 11.

FWIW, I have the exact same setup as the original submitter (pixel 3a, android 11, jellyfin 10.7). I'm not using a reverse proxy or anything complex like that. I simply have jellyfin running in a docker container on my local network. I observe the same symptom that all of the cast devices on my network are selectable, but picking any of them gives the spinner for a very long time. No other obvious activity happens.

@EvilDrW what device are you trying to cast to? It's a long-shot, but perhaps that's the commonality here? I'm trying to cast to a Vizio smart TV where it just spins and has no other obvious activity.

Otherwise, does anyone know how to get logs for the Android app? I feel like that would be an easier way to get the answer here.

@EvilDrW
Copy link

EvilDrW commented Mar 20, 2021

@dpraul, I've tried casting to a 1st gen chromecast and a chromecast ultra, both with the same result. I've pulled the source and will try to run the debug build and look at the logcat... like you I haven't found that anything useful is being logged by default.

@ragebflame
Copy link

It actually sounds like the issues I am having are a bit different to what is being discussed now.

I have a Jellyfin server v10.7 running in a docker container behind an Nginx reverse proxy. Casting only seems to be an issue from the Android app.

# Testing (All tested from the same local network):
Casting from PC browser Chrome = OK
Casting from PC browser Firefox = OK
Casting from Android 9 & 10 Phone browser Chrome = OK
Casting from Android 9 & 10 Phone browser Firefox = OK
Casting from Android app v2.3 (Chromecast stable)= The Chromecast does not appear as an option to 'Cast to'
Casting from Android app v2.3 (Chromecast unstable)= The Chromecast does not appear as an option to 'Cast to'

This to me sounds like the issue is specific to the Android app, as I have no issues casting from any other platform.

@ragebflame
Copy link

I seem to have resolved my issue by clearing the Android app cache and storage. After re-logging in, the Chromecast is appearing as an option to cast to, and the casting itself is working without issue.

@agilob
Copy link

agilob commented Mar 20, 2021

I seem to have resolved my issue by clearing the Android app cache and storage. After re-logging in, the Chromecast is appearing as an option to cast to, and the casting itself is working without issue.

It's intermittent issue for me. Restarting app or chromecast fixes it too, but it always works when streaming from browser, sometimes doesn't work when streaming from android.

@EvilDrW
Copy link

EvilDrW commented Mar 21, 2021

I spent a few hours trying to figure out why this doesn't work, but I'm no Google Cast expert, so I didn't find any smoking guns... for any devs watching, what I observed was that none of the SessionListener's events are firing in ChromecastConnection.java's listenForConnection. When it goes to requestSession, the MediaRouteChooserDialog is created, but when you tap to choose a route... nothing happens?

I tried going through the Cast docs but didn't find anything obviously wrong. If someone can give me some pointers, I'll be happy to dig further, but right now I'm at a loss.

@MBR-0001
Copy link

Update: on 2.3.0 beta 4 it doesn't reach the jellyfin spinner but instead gets stuck on this
image

@hydranmenace
Copy link

I have been searching around trying to figure out why Jellyfin won't cast for me and came upon this, so I thought I would toss in the fact that I am on a Samsung phone running Android 11 and also cannot cast to my Vizio with built in chromecast, or to my regular old plug into HDMI chromecast. I have no issues at all with Emby, Plex, or anything else. It is extremely disappointing because I want to use something that is likely far more respectful of privacy and data. 80% of the time when I click cast it doesn't even list devices to cast to. The other 20% is when I force stop the app and also restart my server. It will see devices to cast to, but nothing happens.

@agilob
Copy link

agilob commented Jun 21, 2021

80% of the time when I click cast it doesn't even list devices to cast to.

chromecast devices are only discovered when android app starts, you have to kill the app and restart it #331

The other 20% is when I force stop the app and also restart my server. It will see devices to cast to, but nothing happens.

You need to follow steps here: restart mobile app 3 times to kill broken connection #343

@EvilDrW
Copy link

EvilDrW commented Jul 24, 2021

I've continued to sporadically look into this. What I think is wrong is that the selectRoute method in Chromecast.java is supposed to be called whenever you pick a chromecast from the chooser. This is supported by this article from the Google cast docs. I'm fairly certain from that article that this is a required step. And I'm fairly certain that it cannot be invoked at present, since no mention of it appears in chrome.cast.js.

Unfortunately, that method is intended to be invoked through the Jellyfin web client, which is completely inscrutable to me. If there are instructions about how to get a debuggable version of the web client running, then I'll try to continue. Otherwise, I'm stuck.

@dessalines
Copy link

dessalines commented Jul 25, 2021

I'm also getting this issue. It sees the chromecast, but the loading indicator spins forever when trying to connect.

Same version of jellyfin-android from google play, the only difference is I got an android 11 device ( other apps work fine w/ chromecast). Android 10 device streamed to it fine.

Edit: just tried the recent beta, same issue. This likely affects all android 11 devices.

@scob7
Copy link

scob7 commented Jul 26, 2021

I've been successfully casting from my Pixel 2 (Android 11) for awhile now. Initially it wasn't working: app could see the device and connect but when I tried to play media the loader would just spin.

The issue was DNS resolution in a my home network. The DNS in the Chromecast is hard coded to Google servers but my jellyfin server url is local to my opnsense unbound dns server (aka split-horizon dns). I had to add a firewall rule to redirect all port 53 traffic from LAN to my opnsense gateway and voila it worked.

Another possible solution might be to just use the ip address of jellyfin (or docker host + port for most people probably) as your server url and not use a dns name at all. ie http://192.168.1.10:8096

@MBR-0001
Copy link

MBR-0001 commented Jul 26, 2021

I've been successfully casting from my Pixel 2 (Android 11) for awhile now. Initially it wasn't working: app could see the device and connect but when I tried to play media the loader would just spin.

The issue was DNS resolution in a my home network. The DNS in the Chromecast is hard coded to Google servers but my jellyfin server url is local to my opnsense unbound dns server (aka split-horizon dns). I had to add a firewall rule to redirect all port 53 traffic from LAN to my opnsense gateway and voila it worked.

Another possible solution might be to just use the ip address of jellyfin (or docker host + port for most people probably) as your server url and not use a dns name at all. ie http://192.168.1.10:8096

I tried using http://{ip}:8096, it produces the same result (infinite spinning) here, what's your jellyfin version?

@tim-vk
Copy link

tim-vk commented Aug 19, 2021

Nothing really new to add but to chime in:

Running the linuxserver docker image of jellyfin 2.7.6. I have 2 phones running android 10 and android 11 (motorola g8 and g9 respectively). Only the android 10 phone can connect to the chromecast. The android 11 one seems stuck in a loop. The logs don't really show anything regarding chromecast (as far as I can find at least).

The server I've connected to in the app is http://{ip}:8096 but that doesn't help.

The nightly chromecast build has never worked for me (and still doesn't work).

Clearing cache. rebooting the phone. uninstalling/reinstalling the app. Doesn't work.

I'm not sure where to look for more info regarding this issue (the logs are completely empty). So if anyone has any pointers to find some useful info I can look it up.

@rodrigost23
Copy link

Exactly. This does not seem to be a DNS issue. It works for me on Android 10 and not on Android 11 as well. I would also like to know how to try to debug this, or get some useful logs

@tim-vk
Copy link

tim-vk commented Aug 19, 2021

I did some testing: Strangely enough the normal webapp does work (on my phone). So the only thing not working is the app for android 11. Casting via Chrome still works.

Though for a lot of people that's probably quite annoying since that requires an ssl certificate.

@dpraul
Copy link
Author

dpraul commented Aug 19, 2021

I did some testing: Strangely enough the normal webapp does work (on my phone). So the only thing not working is the app for android 11. Casting via Chrome still works.

Though for a lot of people that's probably quite annoying since that requires an ssl certificate.

Well... you have just made my life a lot better. The web app works for casting on my Android 11 devices, as well. Thanks!

@MBR-0001
Copy link

MBR-0001 commented Sep 5, 2021

I tried casting yesterday and to my surprise it worked, seems like version 2.3.2 (or 2.3.1?) fixed it?

@rodrigost23
Copy link

I tried casting yesterday and to my surprise it worked, seems like version 2.3.2 (or 2.3.1?) fixed it?

Nope. Still not working for me on Android 11, app version 2.3.2, server 10.7.6.

@Harteex
Copy link

Harteex commented Oct 2, 2021

Just like MBR-0001, casting suddenly works again for me on my Pixel 3 / Android 11 phone.
I haven't really changed anything, so this is surprising. I hope it doesn't break again for whatever reason.

Currently I have the Android security updates from 5 september, and Google Play system update from 1 august.

@jellyfin-bot
Copy link
Contributor

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

@agilob
Copy link

agilob commented Jan 31, 2022

thanks bot

@jellyfin-bot jellyfin-bot removed the stale label Feb 1, 2022
@jellyfin-bot
Copy link
Contributor

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests