Skip to content

perry/media: Windows SystemMediaTransportControls lock-screen integration #367

@proggeramlug

Description

@proggeramlug

Follow-up to #351. The Windows backend (crates/perry-ui-windows/src/media_playback.rs v0.5.429) ships full playback via Windows.Media.Playback.MediaPlayer (WinRT) but setNowPlaying is a no-op — the volume HUD media tile, Bluetooth headphone media keys, and the Edge / Chromium Now Playing widget don't see anything from a Perry app.

Scope

WinRT MediaPlayer exposes a SystemMediaTransportControls property (and the related SystemMediaTransportControlsDisplayUpdater) that are the canonical surface. Wire setNowPlaying(handle, title, artist, album, artworkUrl) through it:

  • Get the player's SystemMediaTransportControls via MediaPlayer.SystemMediaTransportControls.
  • Set IsPlayEnabled / IsPauseEnabled / IsStopEnabled / IsNextEnabled / IsPreviousEnabled = true.
  • Build a SystemMediaTransportControlsDisplayUpdater, set Type = MusicProperties.Music, populate MusicProperties.Title / Artist / AlbumArtist.
  • For artwork: RandomAccessStreamReference.CreateFromUri(uri) on https:// URLs, or CreateFromFile on file:// paths — assigned to Thumbnail.
  • Subscribe to the ButtonPressed event so headphone / volume-HUD play/pause/skip events route to the existing play / pause / stop FFI thunks.
  • Push a PlaybackStatus update on every state-poller flip so the system UI doesn't show stale state.

windows-crate features

Already on Media_Playback + Media_Core + Foundation (added in v0.5.429). Will need Media (for SMTC types) and Storage_Streams (for RandomAccessStreamReference).

Acceptance

  • setNowPlaying populates the Windows volume-HUD media tile.
  • Headphone play/pause/skip buttons trigger the registered Perry callbacks via ButtonPressed.
  • Edge / Chromium Now Playing widget shows the metadata.
  • State poller pushes PlaybackStatus updates.

Files

  • crates/perry-ui-windows/src/media_playback.rs::set_now_playing — currently a no-op
  • crates/perry-ui-windows/Cargo.toml — add Media + Storage_Streams features

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions