From: Hugo Villeneuve Date: Thu, 13 Aug 2015 22:06:10 +0000 (-0400) Subject: Disable automatic HTML5 videos playing in Firefox X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=cbe8a99894d3ac8241f9d5654603dc71cdb7dedf;p=hvlinux.git Disable automatic HTML5 videos playing in Firefox --- diff --git a/stage5/patches/common/firefox-34.0.5-no-autoplay.patch b/stage5/patches/common/firefox-34.0.5-no-autoplay.patch new file mode 100644 index 0000000..134e4a4 --- /dev/null +++ b/stage5/patches/common/firefox-34.0.5-no-autoplay.patch @@ -0,0 +1,33 @@ +From: Randall Barker +Bug 659285 - Extend media.autoplay.enabled to provide a way to disable + untrusted play() invocations + + (prevent HTML5 videos from starting automatically when + media.autoplay.enabled is set to false) + +diff -Naur mozilla-release/content/html/content/src/HTMLMediaElement.cpp mozilla-release.patched/content/html/content/src/HTMLMediaElement.cpp +--- mozilla-release/content/html/content/src/HTMLMediaElement.cpp 2014-11-26 07:29:56.000000000 -0500 ++++ mozilla-release.patched/content/html/content/src/HTMLMediaElement.cpp 2015-08-13 22:01:23.224642252 -0400 +@@ -15,6 +15,8 @@ + #include "mozilla/dom/MediaEncryptedEvent.h" + #endif + ++#include "mozilla/EventStateManager.h" ++ + #include "base/basictypes.h" + #include "nsIDOMHTMLMediaElement.h" + #include "nsIDOMHTMLSourceElement.h" +@@ -2157,6 +2159,13 @@ + void + HTMLMediaElement::Play(ErrorResult& aRv) + { ++ // Prevent media element from being auto-started by a script when ++ // media.autoplay.enabled=false ++ if (!IsAutoplayEnabled() && !EventStateManager::IsHandlingUserInput() && !nsContentUtils::IsCallerChrome()) { ++ LOG(LogLevel::Debug, ("%p Blocked attempt to autoplay media.", this)); ++ return; ++ } ++ + StopSuspendingAfterFirstFrame(); + SetPlayedOrSeeked(true); +