Jellyfin-android: FOSS Chromecast support / re-implementation

Created on 22 Nov 2020  路  8Comments  路  Source: jellyfin/jellyfin-android

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.

cast enhancement

Most helpful comment

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.

All 8 comments

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!).

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

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

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?

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings