Simplify media routing in your Compose app with this native Material
3 MediaRouter library. Enjoy easy integration, a pure Compose-friendly
approach, and no need for AppCompatActivity
or Theme.AppCompat.*
. Focus on what matters:
creating seamless media experiences for your users.
Warning
This library is under active development. While some features may be missing or unstable, your feedback is valuable. Please report any problems you encounter or feature requests you have by opening an issue.
This library is available as a GitHub Package. Follow GitHub's documentation to set up the repository in your project.
repositories {
maven {
url = uri("https://maven.pkg.github.com/SRGSSR/androidx-mediarouter-compose")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
}
In your module build.gradle(.kts)
file, add the following:
dependencies {
implementation("ch.srgssr.androidx.mediarouter:mediarouter-compose:<version>")
}
To enable users to connect to remote devices and control media playback, add the MediaRouteButton
to your screen:
MediaRouteButton()
By default, no routes are displayed because it uses an empty MediaRouteSelector
. Configure this by
providing your own MediaRouteSelector
:
MediaRouteButton(
routeSelector = MediaRouteSelector.Builder()
.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
.build(),
)
This library is automatically published and released to GitHub Packages whenever a new tag following
the x.y.z
pattern is pushed.
See the license file for more information.