Getting started on Android
How to use the THEOlive SDK in your Android app.
Prerequisites
Add the following maven repositories to your project:
maven { url = uri("https://jitpack.io") }
maven { url = uri("https://maven.theoplayer.com/releases") }
maven { url "https://jitpack.io" }
maven { url "https://maven.theoplayer.com/releases" }
Then add the player artifact to build.gradle
:
implementation("com.theolive:player:3.3.0")
implementation "com.theolive:player:3.3.0"
Adding the player to your Activity
First you can create a player in your compose activity with:
val player = rememberTHEOlivePlayer()
This returns a THEOlivePlayer, which is the API to the player.
Then you can create a view of the player with and without a UI:
THEOliveTheme {
Surface(
modifier = Modifier.aspectRatio(16f / 9f),
color = MaterialTheme.colorScheme.background
) {
THEOliveUI(player = player)
}
}
THEOliveChromeless(
player = player,
modifier = Modifier.aspectRatio(16f / 9)
)
In order to start playback, you will need to load your THEOlive channel into the player:
player.loadChannel('your-channel-id')
API references
The API of the player package is documented here: https://docs.theo.live/player/android/index.html
Examples
For a sample Android app see https://github.com/THEOplayer/theolive-samples-android.
Updated over 1 year ago