EARHORNMUSIC UPnP · Android TV · Phones · Android Auto · GNU/Linux
Release 0.5.0

ScopedRenderer.kt

package dev.stave.domain.renderer

/**
 * A [Renderer] that holds external resources (network subscriptions, mDNS handles,
 * GENA event listeners, position pollers) needing explicit teardown when the
 * renderer is swapped out of the active slot.
 *
 * The renderer coordinator switches between local, UPnP-remote, and Cast renderers
 * as the user picks. The first two have concrete types the coordinator can reference
 * directly, but Cast lives in a platform-specific source set (desktop uses
 * chromecast-java-api-v2; Android uses Play Services CastFramework) — the
 * coordinator can't strongly type to it. This interface gives the coordinator a
 * shared-world handle to call [detach] without dragging Cast types into jvmCommonMain.
 *
 * Implementations should treat [detach] as idempotent: it may be called multiple
 * times across the life of the object (e.g. when the user toggles renderers
 * rapidly during testing), and must not throw on a second call.
 */
interface ScopedRenderer : Renderer {
    fun detach()
}