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

ScopedRenderer.kt

21 lines · 1.0 KB

Changed in: 0.5.0

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