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

Add Chromecast Support #16

Open
anthonylavado opened this issue Nov 20, 2019 · 38 comments
Open

Add Chromecast Support #16

anthonylavado opened this issue Nov 20, 2019 · 38 comments
Labels
blocked Progress on this is currently blocked feature New feature or request

Comments

@anthonylavado
Copy link
Member

AirPlay is natively supported, we just need to add the button in the controls in Web.

To make it a more complete client, Chromecast should be added, to finally give iOS users the option of using it.

A quick search shows that we might have to eject and use ExpoKit, so I'm unsure how to proceed.

@anthonylavado anthonylavado added the enhancement Improve existing functionality or small fixes label Nov 20, 2019
@brianclinkenbeard
Copy link

@anthonylavado
Copy link
Member Author

anthonylavado commented Dec 19, 2019

For reference:

https://forums.expo.io/t/chromecast-support/4699/2

https://expo.canny.io/feature-requests/p/support-for-chromecast

Apparently it’s been requested since 2017 with no movement, so we’d have to detach ☹️

@thornbill thornbill added the blocked Progress on this is currently blocked label May 21, 2020
@krutburken
Copy link

krutburken commented Jan 25, 2021

Old issue, but are there any current discussions on how to move forward on this? Not having Chromecast support on iOS is probably the only thing keeping me from migrating my users from plex/emby to Jellyfin.

If not, what workarounds are available?

@thornbill thornbill pinned this issue Mar 23, 2021
@Coo-ops
Copy link

Coo-ops commented Mar 24, 2021

BUMP.

This is an important feature, and the only thing keeping me on Plex in absence of a dedicated client app for Raspberry Pi.

@jellyfin jellyfin locked and limited conversation to collaborators Mar 24, 2021
@anthonylavado
Copy link
Member Author

anthonylavado commented Mar 24, 2021

This doesn't need to be bumped. That just adds extra noise and notifications that we have to deal with. Normally you could leave a thumbs up reaction on the top comment, or even upvote the feature request on our dedicated site:
https://features.jellyfin.org/posts/466/chromecast-support-on-ios

We know it is in demand. Thornbill even pinned this just a few hours ago to show that we're aware of it.

It's still not possible yet for a variety of reasons that I've shared before on Reddit. I'll find those and post them here some time.

@jellyfin jellyfin unlocked this conversation Mar 26, 2021
@jaredreich
Copy link

Hey folks! Really interested in getting this feature figured out.

Just a quick note to add to the discussion - it appears when chromecasting from Plex for iOS, it actually initiates a cast via the Plex server's address (127.0.0.1:32400) to the device. Shouldn't Jellyfin be doing the same? The Jellyfin iOS app would ping the Jellyfin server for Chromecast devices, return the list to the iOS device, present them to the user, user chooses one to start the connection, then when content is played it's actually the server that is doing the Chromecasting.

I may be completely wrong here, just spitballing, so feel free to disregard. Thoughts?

@anthonylavado
Copy link
Member Author

@jaredreich Almost, not quite. Say you are in a remote location, away from home. In that case, the server can't necessarily reach those devices on that network to cast ;-)

The way casting works (very, very simplified):

  • Client scans local network + Bluetooth for cast enabled devices
  • Client presents list of destinations to user
  • If user selects cast destination, start Cast session with App ID sent to Cast device
  • Cast devices gets App ID, checks with Google for application page (this is a website that we operate)
  • Cast page is loaded on device and session is connected to client (for media playback, etc).
  • User selects media, client sends URL and ID to Cast page
  • Page/Cast device sends request to server and starts playing back from there

@jaredreich
Copy link

@anthonylavado thank you very much for the breakdown. Though I must still ask, shall we not implement this feature only because it won't work on an external network? I'd imagine a lot of users are casting at home while on the same network as the Jellyfin server right? Are there other reasons it can't be implemented other than not working from external networks?

@anthonylavado
Copy link
Member Author

anthonylavado commented Apr 29, 2021

@jaredreich My apologies if that was the impression - there's other technical reasons why it's not there yet. I was just describing how the process works, and why just sending a session from the server isn't enough.

I realize I never fully explained the reasons here.

This app for iOS is written using a Javascript framework known as Expo. It's a special set of packages and a workflow based around React Native. The good part about Expo is they they make building apps very easy for both iOS and Android. They even take care of the build/compile process for you, so you can create an iOS app without owning a Mac (but you still have to have an Apple Developer Program membership). This is known as the "Managed" process.

The downside to Expo is that in most cases, you're limited to using packages and frameworks that they directly support. It's not possible to simply pull in whatever React Native package you'd want.

In order to add Chromecast playback, we need to add the Cast SDK in a supported way. One of those packages for React Native is linked towards the top, and I'm sure there's many others.

To have Expo include a package, you have to make a feature request, hope it gets their attention/enough votes, and then hopefully they include it. People have been asking for years now (see above again), and it hasn't happened yet.

Now you might be thinking - surely there's a way around this, right? Well, there is. The process is known as "ejecting to ExpoKit". This takes everything you've done as an Expo managed project, and converts it to a React Native project that happens to include some Expo modules. This adds a bit more complexity - builds must now be done on the correct platform. For example, the bundle for iOS would have to be compiled on a Mac, instead of just using Expo's servers. Though I have a Mac, I'm not the primary developer. Heck, I'm not really much a developer at all (my expertise is in other areas for Jellyfin, including "management"). My dear friend @thornbill has mostly been working on this from a Linux machine.

As it turns out, this year there are some things falling in to place that will make this transition easier, and we are getting closer to a solution, including ejecting and then adding on the modules we need.

Hopefully this helped explain it better 😄

Edit: Here's a link from Expo on the different "workflows" - https://docs.expo.io/introduction/managed-vs-bare/

@cuibonobo
Copy link

Expo just released a proof of concept on getting Chromecast working on Expo projects without having to eject: https://github.com/EvanBacon/prototype-config-plugins/tree/master/packages/react-native-google-cast

@anthonylavado
Copy link
Member Author

Expo just released a proof of concept...

Yes, we got a notification about this since we have voted on the item. We're investigating.

Our other beta app, Swiftfin, does have Chromecast support in testing as well.

@edenman
Copy link

edenman commented Oct 8, 2021

Current version of the app has a Chromecast button but it can't find my Chromecast (it only shows my web browser on my computer and the DLNA device for my audio receiver): want a separate bug filed or is this one still tracking the ongoing effort? Edit: filed as #309

@anthonylavado
Copy link
Member Author

@edenman Yep, this is still the correct issue.

All - We are in the process of updating the Expo SDK we're using and will update if there's any more info to provide.

In the meanwhile, if you need Chromecast support, the Swiftfin beta client does have that integrated right now.

@edenman
Copy link

edenman commented Oct 10, 2021

Sounds good. And yeah, Swiftfin just unfortunately doesn't support external playback control jellyfin/Swiftfin#177 so I'm sticking with Emby for the time being.

@salmi4k

This comment was marked as spam.

@bloodyburger

This comment was marked as spam.

@thornbill
Copy link
Member

No updates on this yet. I will make sure to comment here when there is something to report.

@JefCarlier
Copy link

Expo have released Chromecast support!

@thornbill
Copy link
Member

Yes they did... kind of. It's not implemented as one of their standard packages, but uses their relatively new "config plugin" system. Using these new plugins requires you to build native code which requires a Mac for iOS. This defeats my whole reason for using Expo which allows me to develop for iOS from my normal Linux computer.

Personally I don't see any benefit in using Expo vs standard React Native given this is the direction things seem to be going. Hopefully at some point this year I will pickup a Mac that I am able to develop from and I can move forward with ejecting from Expo to React Native proper.

@dkbnz
Copy link

dkbnz commented May 10, 2022

I'm not familiar with Expo but is it feasible to develop the Chromecast support locally on Linux and rely on macOS CI/CD machines to build, test and deploy the app?

GitHub Actions have a macOS runner but consume minutes at a 10x rate.

@FerMPY
Copy link

FerMPY commented Jul 19, 2022

Hey I have a Mac and I'm a dev, I don't have much experience with Expo, but I can help with building and do the testing just need some help to know what I should be looking at.
So I can help if the only thing needed to avance with this feature is a Mac.
I successfully build the application and added de plugin it still no showing my chrome cast but it's a good start.

@rbnmrz318

This comment was marked as spam.

@Skyl3lazer

This comment was marked as spam.

@citric-code
Copy link

citric-code commented Dec 13, 2023

@thornbill Is there any update on the likelyhood of this? Was very annoying to spend ages setting up my instance to discover my wife cannot cast to any of our TVs.

I have a Mac and while have not worked on Expo before, am willling to take a look at how this could be implemented with the config plugin system.

@thornbill
Copy link
Member

No. See this comment for details. Using the Expo plugin system would remove my ability to develop for or maintain this app.

@SvenTheBoyy
Copy link

Any update for this? Would love to see Chromecast support in IOS :)

@weiyideai520
Copy link

When will we probably use Chromecast on iOS clients?

@rbnmrz318
Copy link

For anyone interested, i am using the "infuse" App on iOS to connect my jellyfin instance and stream to my Chromecast.
Unfortunately, Infuse does not have any rendering options, so when i am on the go i am using the native jellyfin app.
Infuse is at a yearly subscription of 15€

@ajbastien
Copy link

ajbastien commented Feb 17, 2024

Maybe consider a rewrite in Flutter. I’ve tried it and works well. I see some cast plugins for flutter. Although I have not tried them.

@thornbill
Copy link
Member

In addition to having absolutely no personal interest in learning Flutter, rewriting in Flutter solves none of these issues.

The main blocker is just that I lack access to a modern Mac to develop on and both ejecting to vanilla React Native or using Expo's native plugin system would require building on a Mac.

@Aireezz
Copy link

Aireezz commented Feb 27, 2024

Can you not implement it to stream directly from the server to the chromecast device like plex? @thornbill

@ebg1223
Copy link

ebg1223 commented Feb 27, 2024

@thornbill im a dev work in RN daily. Have all the tooling.
I don’t know if I have time to contribute a full implementation including server. If someone wants to tag team I can contribute some time.

@thornbill
Copy link
Member

@Aireezz I have no idea what Plex does, but that is not how casting typically works. Possibly a plugin could be written to include cast devices as targets for the normal remote control feature but that is different than what this issue covers.

@thornbill
Copy link
Member

@ebg1223 any help would be greatly appreciated! Although we would probably need to update to a current version of expo before any other work could be done. (See #462)

@ebg1223
Copy link

ebg1223 commented Feb 27, 2024

@thornbill thank you. Just posted on that issue.

re chromecast:
My understanding is that you need a server url with https publicly accessible and chromecast streams directly from server.
I believe Plex goes a step further and has a Plex chromecast app that gets loaded.
client.loadMedia({ mediaInfo: { contentUrl: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/BigBuckBunny.mp4', contentType: 'video/mp4', metadata: { images: [ { url: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/images/480x270/BigBuckBunny.jpg', }, ], title: 'Big Buck Bunny', subtitle: 'A large and lovable rabbit deals with three tiny bullies, led by a flying squirrel, who are determined to squelch his happiness.', studio: 'Blender Foundation', type: 'movie', }, streamDuration: 596, // seconds }, startTime: 10, // seconds }}

Do you know how from the client can we get an authenticated url for this stream?

@thornbill
Copy link
Member

I'm really amazed this issue has been open 4 years and no one else has ever asked about how this would need to be implemented... 🤣

We would need to write a plugin (similar to the native video player plugin) that gets injected into the webview. The plugin will need to replicate some of the functions available in the normal Chromecast plugin from the web project. Similar to the video player, the plugin will need to post messages to trigger calls to the cast library on the react native side.

That at least provides a very high level overview and I'm more than happy to answer any additional questions.

@flashtox

This comment has been minimized.

@enigma0Z
Copy link

I’ve got a Mac and would be happy to pick this up and try poking it into a PR. I’ve got some small experience with expo apps but never actually published anything myself.

Just so I’m clear (since its’s been a bit since this issue is open), as far as it looks right now, is the goal to keep the app in expo or to eject it?

@thornbill thornbill added feature New feature or request and removed enhancement Improve existing functionality or small fixes labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Progress on this is currently blocked feature New feature or request
Projects
Development

No branches or pull requests