Bug 1617033 - part8 : add an eligible media duration value to filter out notification sound. r=chunmin

Intercepting media control keys would also come up with the virtual control interface in most of platforms, and for the notification sound we don't want either to show the interface or control them.

Currently we use 3s as a threshold to filter those short duration media which are possible to be a notification sound.

Differential Revision: https://phabricator.services.mozilla.com/D64478

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2020-03-06 17:52:15 +00:00
Родитель 7eec59aab2
Коммит 7dc5318e3b
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -7699,6 +7699,16 @@ void HTMLMediaElement::StartListeningMediaControlEventIfNeeded() {
return;
}
// In order to filter out notification-ish sound, we use this pref to set the
// eligible media duration to prevent showing media control for those short
// sound.
if (Duration() <
StaticPrefs::media_mediacontrol_eligible_media_duration_s()) {
MEDIACONTROL_LOG("Not listening because media's duration %f is too short.",
Duration());
return;
}
// As we would like to start listening to media control event again so we
// should clear the timer, which is used to stop listening to the event.
ClearStopMediaControlTimerIfNeeded();

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

@ -6888,6 +6888,13 @@
value: 60000
mirror: always
# We would only use media control to control media which duration is longer
# than this value.
- name: media.mediacontrol.eligible.media.duration.s
type: AtomicFloat
value: 3.0f
mirror: always
- name: media.webrtc.platformencoder
type: bool
#if defined(MOZ_WIDGET_ANDROID)