MediaSurfaceContainer

Hosts a platform-native video surface and binds the resulting MediaSurface to provider. The surface is detached on composition exit.

provider is the generic MediaSurfaceProvider so that view models can depend on the interface; only a ComposeMediaSurfaceProvider can receive a surface, so any other provider renders nothing.

expect fun MediaSurfaceContainer(provider: MediaSurfaceProvider, modifier: Modifier = Modifier)

Hosts a platform-native video surface and binds the resulting MediaSurface to provider. The surface is detached on composition exit.

provider is the generic MediaSurfaceProvider so that view models can depend on the interface; only a ComposeMediaSurfaceProvider can receive a surface, so any other provider renders nothing.

Hosts a platform-native video surface and binds the resulting MediaSurface to provider. The surface is detached on composition exit.

provider is the generic MediaSurfaceProvider so that view models can depend on the interface; only a ComposeMediaSurfaceProvider can receive a surface, so any other provider renders nothing.

macOS implementation — currently a placeholder.

Compose Multiplatform ships two distinct macOS rendering paths:

  1. Compose Desktop on the JVM (org.jetbrains.compose.ui:ui-desktop) — runs on the JVM via Skia/Skiko + AWT, and exposes androidx.compose.ui.awt.ComposePanel plus full Swing interop. AppKit/NSView interop is reachable here through Swing's heavyweight components.

  2. Compose Multiplatform Native macOS (org.jetbrains.compose.ui:ui-macosarm64) — what this Kotlin/Native module compiles against. Renders directly via Skiko, no JVM, no AWT.

The example app uses path (2) (Kotlin/Native macOS), and as of CMP 1.11.0 that path defines androidx.compose.ui.viewinterop.InteropView = typealias Any and ships no @Composable fun NSView(...) — verified by inspecting ui-macosarm64-1.11.0-sources.jar (only macosMain/androidx/compose/ui/appkit/Events.macos.kt exists, providing NSEvent access; no NSView.macos.kt). Importing androidx.compose.ui.interop.NSView produces Unresolved reference 'interop'.

The awt/ComposePanel API the user referenced is from the JVM Desktop variant and is not available on the macOS-Native target.

Until CMP-macOS-Native grows AppKit interop, the working path on macOS is the native NSViewMediaSurfaceProvider / WindowLifecycleSubscribable against an AppKit AVPlayerView hosted outside the Compose tree (e.g. SwiftUI/AppKit hosts that consume KalugaExample.framework).

Web implementation. Compose Multiplatform renders to a <canvas>, so the player's <video> element cannot live inside the Compose tree. Instead this hosts a DOM container positioned (via onGloballyPositioned) to overlay the area this composable occupies, and binds it as the MediaSurface; the container — and the video the MediaManager appends to it — is removed on composition exit. Positions are in CSS pixels, converted from Compose pixels through the current density.