Bug 1655204 - part1 : stop being controlled by media control keys when media element receives Stop. r=chunmin
Currently, we treat `pause` and `stop` equally, but `stop` is actully implying more meaning, which should stop controlling media entirely. Therefore, we would pause media and stop controlling it when receiving `stop`. In addition, removing pause state checking, because it wouldn't happen anything to call `play()` and `pause()` if media is already playing or paused. Differential Revision: https://phabricator.services.mozilla.com/D84875
This commit is contained in:
@@ -523,12 +523,15 @@ class HTMLMediaElement::MediaControlKeyListener final
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(IsStarted());
|
||||
MEDIACONTROL_LOG("HandleEvent '%s'", ToMediaControlKeyStr(aKey));
|
||||
if (aKey == MediaControlKey::Play && Owner()->Paused()) {
|
||||
if (aKey == MediaControlKey::Play) {
|
||||
Owner()->Play();
|
||||
} else if ((aKey == MediaControlKey::Pause ||
|
||||
aKey == MediaControlKey::Stop) &&
|
||||
!Owner()->Paused()) {
|
||||
} else if (aKey == MediaControlKey::Pause) {
|
||||
Owner()->Pause();
|
||||
} else {
|
||||
MOZ_ASSERT(aKey == MediaControlKey::Stop,
|
||||
"Not supported key for media element!");
|
||||
Owner()->Pause();
|
||||
StopIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user