overlays
Emits the overlay the session is currently showing, or null when there is none.
Overview
overlays on the session emits a CoreOverlay when the SDK starts showing an overlay and null
when it ends. Use it to show or hide your own player UI alongside a Maestro overlay, or to place the overlay yourself
with MaestroCoreOverlayView.
Do not use overlays together with MaestroCoreOverlays: both read from the same overlay
queue.
Syntax
val overlays: Flow<CoreOverlay?>
Example
import com.maestro.uitoolkit.core.MaestroCoreOverlayView
import com.maestro.uitoolkit.core.toAlignment
val overlay by sdk.overlays.collectAsStateWithLifecycle(initialValue = null)
overlay?.let {
// Show host player controls while a Maestro overlay is up
Box(Modifier.fillMaxSize(), contentAlignment = it.position?.toAlignment() ?: Alignment.TopEnd) {
MaestroCoreOverlayView(sdk = sdk)
}
}
Notes
- Use either
overlayswithMaestroCoreOverlayView, orMaestroCoreOverlays— never both. - Call
dismissOverlay()to dismiss the current overlay programmatically. - See
CoreOverlayfor the overlay'stextandpositionfields.