MaestroCoreOverlayView
Draws the current overlay of the session, for a host that places it itself.
Overview
MaestroCoreOverlayView is a Jetpack Compose composable that draws the overlay currently emitted by
sdk.overlays. Use it when you follow overlays yourself and want to control where the overlay
appears — for example, to show or hide your own player UI alongside it.
Use either MaestroCoreOverlayView or MaestroCoreOverlays, never both. It draws
nothing below Android 9 (API 28), where Rive animations don't run.
Syntax
@Composable
fun MaestroCoreOverlayView(
sdk: CoreMaestroSDK.Instance,
modifier: Modifier = Modifier,
theme: MaestroThemeData = MaestroCoreTheme,
enableAutoFocus: Boolean = true,
enablePauseOnFocus: Boolean = false,
onDismiss: () -> Unit = {},
)
Parameters
| Parameter | Type | Description |
|---|---|---|
sdk | CoreMaestroSDK.Instance | The session returned by configure() |
modifier | Modifier | Modifier applied to the overlay view. Defaults to Modifier. |
theme | MaestroThemeData | Theme the overlay draws with. Defaults to MaestroCoreTheme. |
enableAutoFocus | Boolean | Moves D-pad focus to the overlay when it appears. Defaults to true. |
enablePauseOnFocus | Boolean | Pauses the overlay while it has D-pad focus. Defaults to false. |
onDismiss | () -> Unit | Called when the overlay closes: the viewer presses Back or clicks it, or it ends on its own. Defaults to doing nothing. |
Example
import com.maestro.uitoolkit.core.MaestroCoreOverlayView
import com.maestro.uitoolkit.core.toAlignment
val overlay by sdk.overlays.collectAsStateWithLifecycle(initialValue = null)
overlay?.let { current ->
// Show host player controls while a Maestro overlay is up
Box(Modifier.fillMaxWidth().align(Alignment.BottomCenter).background(Color(0xCC000000))) {
// ... your player UI
}
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = current.position?.toAlignment() ?: Alignment.TopEnd,
) {
MaestroCoreOverlayView(
sdk = sdk,
onDismiss = { /* handle dismiss */ },
)
}
}
Notes
- Use either
MaestroCoreOverlayVieworMaestroCoreOverlays— never both. - Call
dismissOverlay()to dismiss the current overlay programmatically. - See
overlaysandCoreOverlayfor the overlay'stextandposition.