Fixed track change notification in media player.

This commit is contained in:
23rd 2021-06-07 08:28:53 +03:00
parent 3c86da78af
commit b553520a48
2 changed files with 8 additions and 0 deletions

View file

@ -129,6 +129,11 @@ SystemMediaControlsManager::SystemMediaControlsManager(
if (!current) {
return;
}
if ((_lastAudioMsgId.contextId() == current.contextId())
&& (_lastAudioMsgId.audio() == current.audio())
&& (_lastAudioMsgId.type() == current.type())) {
return;
}
const auto document = current.audio();
const auto &[title, performer] = Ui::Text::FormatSongNameFor(document)
@ -156,6 +161,8 @@ SystemMediaControlsManager::SystemMediaControlsManager(
} else {
_controls->clearThumbnail();
}
_lastAudioMsgId = current;
}, _lifetime);
_controls->commandRequests(

View file

@ -32,6 +32,7 @@ private:
const std::unique_ptr<base::Platform::SystemMediaControls> _controls;
std::vector<std::shared_ptr<Data::DocumentMedia>> _cachedMediaView;
AudioMsgId _lastAudioMsgId;
rpl::lifetime _lifetimeDownload;
rpl::lifetime _lifetime;