зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1609452 - part1 : update media center's playback state whenever the event source's playback changes. r=mstange
The event source's playback state can represent if the media is currently playing. Therfore, whenever it changes, we should update the media center's playback state as well in order to show correct controller icon (eg. play and pause) on the touch bar. Differential Revision: https://phabricator.services.mozilla.com/D60024 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4d3579227c
Коммит
400100469c
|
@ -34,6 +34,7 @@ class MediaHardwareKeysEventSourceMacMediaCenter final
|
|||
virtual bool Open() override;
|
||||
void Close() override;
|
||||
virtual bool IsOpened() const override;
|
||||
void SetPlaybackState(dom::PlaybackState aState) override;
|
||||
|
||||
private:
|
||||
~MediaHardwareKeysEventSourceMacMediaCenter();
|
||||
|
|
|
@ -150,5 +150,18 @@ void MediaHardwareKeysEventSourceMacMediaCenter::HandleEvent(MediaControlKeysEve
|
|||
}
|
||||
}
|
||||
|
||||
void MediaHardwareKeysEventSourceMacMediaCenter::SetPlaybackState(PlaybackState aState) {
|
||||
MPNowPlayingInfoCenter* center =
|
||||
(MPNowPlayingInfoCenter*)[mpNowPlayingInfoCenterClass defaultCenter];
|
||||
if (aState == PlaybackState::ePlaying) {
|
||||
center.playbackState = MPNowPlayingPlaybackStatePlaying;
|
||||
} else if (aState == PlaybackState::ePaused) {
|
||||
center.playbackState = MPNowPlayingPlaybackStatePaused;
|
||||
} else if (aState == PlaybackState::eStopped) {
|
||||
center.playbackState = MPNowPlayingPlaybackStateStopped;
|
||||
}
|
||||
MediaControlKeysEventSource::SetPlaybackState(aState);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче