remember Player
Creates and remembers a Player.
Parameters
config
the player configuration
Create a Player wrapping an existing THEOplayerView.
The THEOplayerView should be remembered so it's not re-created on every recomposition.
Example usage:
val context = LocalContext.current
val theoplayerView = remember(context) {
val config = THEOplayerConfig.Builder().build()
THEOplayerView(context, config)
}
val player = rememberPlayer(theoplayerView)
Content copied to clipboard
This couples the lifecycle of the given THEOplayerView to the current activity. That is, it automatically calls THEOplayerView.onPause and THEOplayerView.onResume whenever the current activity is paused or resumed.
The THEOplayerView is not automatically destroyed when the composition is disposed. If you need this, use a DisposableEffect:
val player = rememberPlayer(theoplayerView)
DisposableEffect(theoplayerView) {
onDispose {
theoplayerView.onDestroy()
}
}
Content copied to clipboard
Parameters
theoplayer View
the existing THEOplayer view