forwarding-player-hot-swap

Installation
SKILL.md

Hot-swapping the delegate under a forwarding player

Some designs need a new player object per track — one media item each, two alive at once during a transition. Everything above (the session, the notification, the UI) wants one object that never changes. A ForwardingPlayer whose delegate can be replaced bridges the two:

internal class DelegatingForwardingPlayer(initial: Player) : ForwardingPlayer(initial) {
    fun swapDelegate(newDelegate: Player) {}
}

The swap is: snapshot the listeners → detach the video output from the old delegate → remove the listeners → replace the delegate → re-add the listeners → re-attach the video output → verify.

Traps

Installs
2
GitHub Stars
35
First Seen
6 days ago
forwarding-player-hot-swap — maxrave-dev/kotlin-footguns