MediaPlayerIntegrating

Adopt to integrate a third-party music player with Droppy's built-in Music widget, Floating Liquid Player, Lock Screen Expanded Stage, Lyrics, and iPhone/Android Companion app (DroppyKit 1.31.0).

@MainActor protocol MediaPlayerIntegrating : Droplet

Declare your player's bundle identifier(s) and supported features in mediaPlayerDescriptor, and emit state updates through mediaPlayerState. Droppy automatically wires favorite, shuffle, repeat, queue panels, custom transport, lyrics, and Companion sync across every surface without requiring a separate shelf widget.

Manifest requirements:

  • Include "media-read" in capabilities for passive observation, queue display, lyrics, and now-playing feeds.
  • Include "media-transport" in capabilities to accept favorite, shuffle, repeat, queue jump/promote, or custom transport commands.

Built-in players (Apple Music, Spotify, Kaset, Apple TV, and Droppy itself) are reserved and cannot be claimed by droplets. See Media player integration.

  • Note: Maturity: Supported. Host support: DroppyKit 1.31.0 and later. A host older than 1.31.0 does not inspect this protocol, so declare minAPI 1.31.0.

Properties

mediaPlayerDescriptor

@MainActor var mediaPlayerDescriptor: DropletMediaPlayerDescriptor { get }

Static description of the player app(s) and capabilities this droplet provides.

mediaPlayerState

@MainActor var mediaPlayerState: AnyPublisher<DropletMediaPlayerState, Never> { get }

Stream of state snapshots for the claimed player.

Methods

cycleRepeatMode()

@MainActor func cycleRepeatMode()

Cycle repeat mode (off -> all -> one -> off, skipping one unless .repeatOne is declared).

fetchLyrics(for:)

@MainActor func fetchLyrics(for track: DropletMediaTrack) async -> DropletMediaLyrics?

Fetch lyrics for track when .lyrics is declared.

Droppy enforces a 5-second timeout and falls back to LRCLIB when this returns nil or times out.

mediaSessionDidActivate(bundleIdentifier:)

@MainActor func mediaSessionDidActivate(bundleIdentifier: String)

Called when one of this droplet's claimed bundle identifiers becomes Droppy's active now-playing source.

mediaSessionDidDeactivate()

@MainActor func mediaSessionDidDeactivate()

Called when Droppy switches away from this droplet's player or playback clears.

performMediaTransport(_:)

@MainActor func performMediaTransport(_ command: DropletMediaTransportCommand) -> Bool

Handle a transport command when .customTransport is declared.

Return true if the droplet handled the command, or false to let Droppy fall back to MediaRemote.

playQueueItem(id:)

@MainActor func playQueueItem(id: String)

Jump playback to the queued item matching id.

promoteQueueItemToNext(id:)

@MainActor func promoteQueueItemToNext(id: String)

Move the queued item matching id to play next.

refreshQueue()

@MainActor func refreshQueue()

Refresh the Playing Next queue snapshot and publish the result via mediaPlayerState.

setFavorite(_:)

@MainActor func setFavorite(_ isFavorite: Bool)

Set favorite state explicitly (for example, from Companion sync).

setRepeatMode(_:)

@MainActor func setRepeatMode(_ mode: DropletMediaRepeatMode)

Set repeat mode explicitly.

setShuffle(_:)

@MainActor func setShuffle(_ isEnabled: Bool)

Set shuffle state explicitly.

toggleFavorite()

@MainActor func toggleFavorite()

Toggle favorite state for the active track.

toggleShuffle()

@MainActor func toggleShuffle()

Toggle shuffle state in the player.

trackDidChange(_:)

@MainActor func trackDidChange(_ track: DropletMediaTrack)

Called when the active track metadata changes while this droplet owns the active media session.