jellyfin / jellyfin-android

Android Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
1.57k stars 251 forks source link

FOSS Chromecast support / re-implementation #249

Open Jpxe opened 3 years ago

Jpxe commented 3 years ago

Would be great to have FOSS Chromecast support.

Like VLC has, they use a foss re-implementation in libvlc. Found this blog post about it

This would allow chromecast support in future F-Droid builds.

nielsvanvelzen commented 3 years ago

If you could link to an open-source implementation for the Google Cast client we'll look into it. But as far as I know it doesn't exist (unfortunately!).

Jpxe commented 3 years ago

I tough that was what I did? https://github.com/videolan/vlc-3.0/tree/master/modules/stream_out/chromecast There's also this: https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/Chromecast

nielsvanvelzen commented 3 years ago

The resources you linked to are not in Java/Kotlin and thus will not work out of the box.

nielsvanvelzen commented 3 years ago

I've found this library which might work; https://github.com/vitalidze/chromecast-java-api-v2

Jpxe commented 3 years ago

I'm not a coder so sorry for these basic questions.

As far as I can tell, VLC for Android is in Kotlin/Java: VLC Android GitHub, also VLC for Android has FOSS Chromecast support (available in F-Droid). The Chromecast re-implementation is coded in C++ I believe? How does this work and why can't it be used with Jellyfin in the same way?

nielsvanvelzen commented 3 years ago

No problem, I'll try to explain it:

VLC is made in a low-level language which can be ported to many platforms (including Android). The app part of VLC for Android is written in Java/Kotlin (which is the user-interface, the buttons and such). The actual code to play video etc. is still the original low-level code.

VLC uses a system called "renderer" to tell which screen to play a video on. Their casting support uses one of those renderers. This means that the code is very much bound to their own system and it's very hard to re-use in other apps.

I expect it to be easier to make our own integration with cast then port their code to be usable in our app. But both take a lot of time which I personally rather spend on other things like the Android TV app and better playback in-app.

chrstfer commented 3 years ago

Just because VLC's library doesn't work does not mean we should abandon this entire thought. There are other Third Party casting APIs for chromecast+related UPnP castpoints. Chromecasts themselves are probably a minority of those castpoints, and some/many devices support multiple protocols.

How hard would it be to refactor the casting code in jellyfin-web now to be extendable to other libraries/protocols? Considering it effectively runs on every platform to handle at least some functions (right?) if it could support arbitrary Casting/UPnP receivers then on the android side we could plug in whichever library we see fit to.

I'll help out however I can but I'm not very familiar with the codebase or have too much experience on apps, I'm willing to learn though and to help out in other ways.

nielsvanvelzen commented 3 years ago

Just because VLC's library doesn't work does not mean we should abandon this entire thought

I agree, if we could find an alternative that would be great.

There are other Third Party casting APIs for chromecast+related UPnP castpoints.

Both repositories linked are not sufficient for our use, the first implements a part of the protocol but is missing some functions we need (look at the sources in our repo to see which). The second doesn't even implement casting.

How hard would it be to refactor the casting code in jellyfin-web now to be extendable to other libraries/protocols?

Really hard, the web code is not easy to change and if we did change it we'd need to update the nativeshell which potentially breaks the current releases of the android app.

if it could support arbitrary Casting/UPnP receivers

You can already use different protocols; DLNA and Jellyfin clients are supported. I can for example run the mpv-shim on a pi or the android tv app on my tv and control both from the android app or web client.

In the end, if you want to use google cast you shouldn't use the libre flavor that is published to f-droid until we find a way to support casting without requiring proprietary google libraries.

vincegre commented 2 years ago

In the end, if you want to use google cast you shouldn't use the libre flavor that is published to f-droid until we find a way to support casting without requiring proprietary google libraries.

well for google cast in all matters it's not usable with Jellyfin as I discovered recently ! The Play Store version implements Cast system but it doesn't work in a usable way :( Unable to skip next/previous on music track and always stops after first track played...

masterflitzer commented 10 months ago

what about matter open casting? afaik it's open source and now amazon wants to adopt it, also it's backed by google, amazon and apple

i think it would be perfect dor this case because it might be the new cross platform open way to cast

nielsvanvelzen commented 10 months ago

I'm somewhat familiar with Matter but as far as I know they have no casting functionality. I just tried searching for it and while I was able to find some news articles on websites I've never seen before, searching on the official Matter website doesn't bring up anything for me.

masterflitzer commented 10 months ago

it was just recently presented at CES 2024, it's not officially released i think, so not something to implement right now, before implementing it i'd wait for Amazon (and others) and see if they have success in adopting it, if it gains any traction this year i think it would be a good fit for jellyfin

i was just suggesting it because it would fit jellyfin as being open source so an open casting standard that's equivalent to chromecast (or even better) would be good

nielsvanvelzen commented 10 months ago

Definitely something that could fit in Jellyfin!

3flex commented 2 months ago

This is a sample TV casting app from Matter: https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-casting-app/APIs.md

I think a request to add support for Matter should be a separate issue, as that will not provide a FOSS implementation for Chromecast which was what this issue was originally about. I'm still using a Chromecast 2nd gen which I can guarantee won't get support for Matter even if Google adopts it in future. Support is currently limited to Amazon devices (Fire TV with Fire OS 7+, Echo Show 15) - https://www.theverge.com/2024/5/10/24153556/fire-tv-amazon-matter-casting-hands-on