Bug 1767412 - Don't set the AlbumArtist property on IMusicDisplayProperties. r=chunmin

The Album Artist field when talking about musical metadata is the
artist under which a particular release is classified under. Artist is
the people that are on a specific track, including thing like featurings, etc.

Here we only want to set Artist (the most generic item). Album Artist
overrides artist, and has nothing to do with the album name.

Windows doesn't have an API or a location in the UI to display the album
name.

Differential Revision: https://phabricator.services.mozilla.com/D145339
This commit is contained in:
Paul Adenot 2022-05-06 13:36:20 +00:00
parent 80d11774cc
commit cf08170d87
2 changed files with 6 additions and 18 deletions

View File

@ -222,8 +222,7 @@ void WindowsSMTCProvider::SetPlaybackState(
void WindowsSMTCProvider::SetMediaMetadata(
const mozilla::dom::MediaMetadataBase& aMetadata) {
MOZ_ASSERT(mInitialized);
SetMusicMetadata(aMetadata.mArtist.get(), aMetadata.mTitle.get(),
aMetadata.mAlbum.get());
SetMusicMetadata(aMetadata.mArtist, aMetadata.mTitle);
LoadThumbnail(aMetadata.mArtwork);
}
@ -395,13 +394,9 @@ bool WindowsSMTCProvider::InitDisplayAndControls() {
return true;
}
bool WindowsSMTCProvider::SetMusicMetadata(const wchar_t* aArtist,
const wchar_t* aTitle,
const wchar_t* aAlbumArtist) {
bool WindowsSMTCProvider::SetMusicMetadata(const nsString& aArtist,
const nsString& aTitle) {
MOZ_ASSERT(mDisplay);
MOZ_ASSERT(aArtist);
MOZ_ASSERT(aTitle);
MOZ_ASSERT(aAlbumArtist);
ComPtr<IMusicDisplayProperties> musicProps;
HRESULT hr = mDisplay->put_Type(MediaPlaybackType::MediaPlaybackType_Music);
@ -413,24 +408,18 @@ bool WindowsSMTCProvider::SetMusicMetadata(const wchar_t* aArtist,
return false;
}
hr = musicProps->put_Artist(HStringReference(aArtist).Get());
hr = musicProps->put_Artist(HStringReference(aArtist.get()).Get());
if (FAILED(hr)) {
LOG("Failed to set the music's artist");
return false;
}
hr = musicProps->put_Title(HStringReference(aTitle).Get());
hr = musicProps->put_Title(HStringReference(aTitle.get()).Get());
if (FAILED(hr)) {
LOG("Failed to set the music's title");
return false;
}
hr = musicProps->put_AlbumArtist(HStringReference(aAlbumArtist).Get());
if (FAILED(hr)) {
LOG("Failed to set the music's album");
return false;
}
hr = mDisplay->Update();
if (FAILED(hr)) {
LOG("Failed to refresh the display");

View File

@ -64,8 +64,7 @@ class WindowsSMTCProvider final : public mozilla::dom::MediaControlKeySource {
// Sets the Metadata for the currently playing media and sets the playback
// type to "MUSIC"
bool SetMusicMetadata(const wchar_t* aArtist, const wchar_t* aTitle,
const wchar_t* aAlbumArtist);
bool SetMusicMetadata(const nsString& aArtist, const nsString& aTitle);
// Sets one of the artwork to the SMTC interface asynchronously
void LoadThumbnail(const nsTArray<mozilla::dom::MediaImage>& aArtwork);