Bug 1173844 - Video would not playback after seek seekbar if media.autoplay.enabled = false. r=cpearce
authorRandall Barker <rbarker@mozilla.com>
Fri, 19 Jun 2015 17:12:00 +0200
changeset 250147 bd399cc8c6cab407b6f26931d9fd432275aa63b6
parent 250146 2d9a98adbac2b3139503e80b5a989789fa9f67d7
child 250148 39e7b3bc8ff74af268ab8878b57cc48b86ed8e88
push id61469
push usercbook@mozilla.com
push dateThu, 25 Jun 2015 08:37:02 +0000
treeherdermozilla-inbound@eba8941bf4a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1173844
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1173844 - Video would not playback after seek seekbar if media.autoplay.enabled = false. r=cpearce
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2196,17 +2196,21 @@ HTMLMediaElement::ResetConnectionState()
   ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_NOTHING);
 }
 
 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()) {
+  nsRefPtr<TimeRanges> played(Played());
+  if (played->Length() == 0
+      && !IsAutoplayEnabled()
+      && !EventStateManager::IsHandlingUserInput()
+      && !nsContentUtils::IsCallerChrome()) {
     LOG(LogLevel::Debug, ("%p Blocked attempt to autoplay media.", this));
     return;
   }
 
   StopSuspendingAfterFirstFrame();
   SetPlayedOrSeeked(true);
 
   if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {