Sam Pengilly
06/13/2023, 4:39 AMActivity::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?Sam Pengilly
06/13/2023, 4:49 AMTolriq
06/13/2023, 6:13 AMSam Pengilly
06/13/2023, 6:13 AMTolriq
06/13/2023, 6:13 AMczuckie
06/13/2023, 6:17 AMTolriq
06/13/2023, 6:21 AMSam Pengilly
06/13/2023, 6:23 AMTolriq
06/13/2023, 6:26 AMTolriq
06/13/2023, 6:27 AM