Skip to content

Show now playing metadata on macOS even without a known duration#290

Open
SandFoxy wants to merge 1 commit into
desktop-app:masterfrom
SandFoxy:fix-macos-now-playing-metadata
Open

Show now playing metadata on macOS even without a known duration#290
SandFoxy wants to merge 1 commit into
desktop-app:masterfrom
SandFoxy:fix-macos-now-playing-metadata

Conversation

@SandFoxy

Copy link
Copy Markdown

On macOS the Control Center, lock screen and media-keys HUD showed that Telegram was playing audio but without any track title, artist or artwork.

updateDisplay() published the MPNowPlayingInfoCenter dictionary only when both enabled and duration() were set, while setPlaybackStatus() assigns the global MPNowPlayingInfoCenter.playbackState unconditionally — so the app was registered as the active player even though its info dictionary was nil. The duration is not always available (audio without a duration attribute, or the short window before the media header is parsed, with no later re-publish), which produced the "playing, but no info" state.

Gate updateDisplay() on enabled only — that flag already tracks whether there is active media and is cleared together with clearMetadata() on stop. This also matches the Windows and Linux backends, which never gate the metadata on the duration.

updateDisplay() withheld the entire MPNowPlayingInfoCenter dictionary
(title, artist, artwork) whenever the current track's duration was
unknown or zero, because it published the info dictionary only when
both `enabled` and `duration()` were set. At the same time
setPlaybackStatus() had already assigned the global
MPNowPlayingInfoCenter.playbackState, so the system still registered
the app as the active player. As a result macOS Control Center, the
lock screen and the media keys HUD showed that Telegram was playing
something, but without any track title, artist or artwork.

The duration is not always available: it stays zero for audio without a
duration attribute and during the short window before the media header
is parsed, and there is no later re-publish once it becomes known.

Gate updateDisplay() on `enabled` only. That flag already tracks
whether there is active media (it is turned off together with
clearMetadata() when playback stops), so the metadata is published as
soon as media is playing. This also matches the Windows and Linux
backends, which never gate the metadata on the duration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants