Bug 1631075 - Clear the event source's metadata when we clear the main controller. r=bryce

When we clear the main controller, which means there is no any media we need to control at that time, we would reset its playback state, but we should clear its metadata as well.

Differential Revision: https://phabricator.services.mozilla.com/D71428
This commit is contained in:
alwu 2020-04-20 15:59:06 +00:00
Родитель a7194d3716
Коммит 5a70c0ed78
2 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -339,6 +339,7 @@ void MediaControlService::ControllerManager::UpdateMainControllerInternal(
if (!mMainController) {
LOG_MAINCONTROLLER("Clear main controller");
mSource->SetPlaybackState(MediaSessionPlaybackState::None);
mSource->SetMediaMetadata(MediaMetadataBase::EmptyData());
} else {
LOG_MAINCONTROLLER("Set controller %" PRId64 " as main controller",
mMainController->Id());

Просмотреть файл

@ -27,6 +27,8 @@ class MediaMetadataBase {
const nsString& aAlbum)
: mTitle(aTitle), mArtist(aArtist), mAlbum(aAlbum) {}
static MediaMetadataBase EmptyData() { return MediaMetadataBase(); }
nsString mTitle;
nsString mArtist;
nsString mAlbum;