ServicePlayerConnector
Helper that manages the start + bind lifecycle between a UI layer and BVPlaybackService.
Usage
private val connector by lazy {
ServicePlayerConnector(this, AppPlaybackService::class)
}
override fun onStart() {
super.onStart()
connector.connect(playerConfig = buildPlayerConfig()) { player ->
binding.playerView.setUnifiedPlayer(player)
if (player.getCurrentMediaConfig() == null) {
connector.getService()?.loadMedia(mediaConfig)
}
}
}
override fun onStop() {
super.onStop()
connector.disconnect()
}Content copied to clipboard
Functions
Link copied to clipboard
fun connect(playerConfig: PlayerConfig? = null, analyticsConfig: AnalyticsConfig? = null, onConnected: (UniPlayer) -> Unit)
Starts and binds to the service.
Link copied to clipboard
Unbinds from the service. The service continues running in the background.
Link copied to clipboard
Returns the typed service instance (e.g. to call BVPlaybackService.loadMedia).