Am I missing something or is the state of chromeca...
# android
s
Am I missing something or is the state of chromecast support on Android absolutely insane in how behind and unacceptable it is? • Codelabs and documentation that demonstrate usage with an API (
Activity::onCreateOptionsMenu
) that has barely been relevant for a few years now • Usage involves a class from
play-services-cast-framework
that is explicitly tied to the activity options menu API (
CastButtonFactory::setUpMediaRouteButton
) •
play-services-cast-framework
is a closed source library so there’s no way to know what
setUpMediaRouteButton
is doing in order to replicate it in a different way • Under the hood dependency on
androidx.mediarouter
, which combines both the backend and UI components of media routing functionality into a single artifact, forcing a dependency on AppCompat/Fragments/etc ◦ Issue on the issue tracker for splitting mediarouter into two artifacts has been up with little activity since November 2020. ◦ UI side of mediarouter is heavily reliant on AppCompat and Fragments • Zero apparent support for implementing a Cast button and cast behaviour on any app that doesn’t use the above APIs. Pure Compose app? Forget about it, only official advice is from two years ago and it’s: “wrap MediaRouterButton in `AndroidView`” which seems to carry its own issues and still requires an app to ship AppCompat/Fragment classes when it would have no other need for them • This isn’t even getting into how the support for integrating with media2 was apparently not amazing and has regressed further with media3, this is just to get a cast button on screen How is the state of casting this far behind the rest of the android ecosystem? Am I missing a library somewhere which works around some of these issues? I’m basically at the point where I feel I need to fork MediaRouter to remove the UI parts and write my own Compose equivalents, and I still have to deal with forcing the
play-services-cast-framework
to use my fork instead of the actual library as well as work out what
setUpMediaRouteButton
is doing to tie
cast-framework
to the
mediarouter
. Has anyone been doing any work with casting that is sufficiently modern (even if not Compose) that can shed some light on whether there’s a better way?
not kotlin but kotlin colored 4
Even if the library issues remain, the lack of documentation is a major issue, especially when compose went 1.0 two years ago. This SO thread is so far the only resource I’ve found that provides any information about using the casting APIs with Compose https://stackoverflow.com/questions/70934821/jetpack-composable-with-mediarouteactionprovider
t
This is not Kotlin 🙂 But yes the refusal to address the media router split is a pain. You need to do it manually, there's nothing preventing it as they are already well decoupled. And no R8 does not remove most of the stuff from the transitive deps 😞
s
It’s Android, and about the usage of these libraries with Kotlin/Compose though… but yes, considering the libraries are all Java too it’s not Kotlin 😂
t
For the rest there's no docs but you can do everything manually via media router and CastContext so it's possible to have a nice and working Compose only solution.
🤔 1
c
the cast framework from day dot has always been a humongous pain. I'm hoping that some really zealous, adequately annoyed developer weasels their way into the chromecast team to fix the problem from the inside out. Specifically someone who has been able to identify the vast majority of the issues... potentially putting them in a succinct slack message...
😂 1
t
They have no incentive to do anything. So yes it will need an intern wanting a promotion 🙂
s
image.png
t
Famous one or george hotz doing internship at Twitter to try to fix search 😛
Anyway don't hope something do it yourself it's not that hard once you figure out the bits.
😕 1
208 Views