Skip to main content

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​

ParameterTypeDescription
sdkCoreMaestroSDK.InstanceThe session returned by configure()
modifierModifierModifier applied to the overlay view. Defaults to Modifier.
themeMaestroThemeDataTheme the overlay draws with. Defaults to MaestroCoreTheme.
enableAutoFocusBooleanMoves D-pad focus to the overlay when it appears. Defaults to true.
enablePauseOnFocusBooleanPauses the overlay while it has D-pad focus. Defaults to false.
onDismiss() -> UnitCalled 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​