Commit 7dc5318e authored by alwu's avatar alwu
Browse files

Bug 1617033 - part8 : add an eligible media duration value to filter out...

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
parent 7eec59aa
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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();
+7 −0
Original line number Diff line number Diff line
@@ -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)