Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1060)

Unified Diff: Source/core/html/HTMLMediaElement.h

Issue 1179223002: Implement autoplay gesture override experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed !autoplaying behavior + test. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.h
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h
index ca381547f012a480c77082af3fadf6a7b1f44aaf..a7362836febb0508e54c4cc3fba79efde6d46468 100644
--- a/Source/core/html/HTMLMediaElement.h
+++ b/Source/core/html/HTMLMediaElement.h
@@ -29,6 +29,7 @@
#include "core/CoreExport.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/events/GenericEventQueue.h"
+#include "core/html/AutoplayExperimentHelper.h"
#include "core/html/HTMLElement.h"
#include "core/html/track/TextTrack.h"
#include "platform/Supplementable.h"
@@ -140,6 +141,7 @@ public:
TimeRanges* seekable() const;
bool ended() const;
bool autoplay() const;
+ bool shouldAutoplay() const;
bool loop() const;
void setLoop(bool);
void play();
@@ -386,7 +388,13 @@ private:
// This does not check user gesture restrictions.
void playInternal();
- void gesturelessInitialPlayHalted();
+ // If we are about to enter a paused state, call this to record
+ // autoplay metrics. If we were already in a stopped state, then
+ // this does nothing.
+ void recordMetricsIfPausing();
+ // Could stopping at this point be considered a bailout of playback?
+ // (as in, "The user really didn't want to play this").
+ bool isBailout() const;
void autoplayMediaEncountered();
void allowVideoRendering();
@@ -424,6 +432,8 @@ private:
void setAllowHiddenVolumeControls(bool);
+ void recordAutoplayMetric(AutoplayMetrics);
+
WebMediaPlayer::CORSMode corsMode() const;
// Returns the "direction of playback" value as specified in the HTML5 spec.
@@ -443,6 +453,12 @@ private:
// transition to HAVE_METADATA.
void selectInitialTracksIfNecessary();
+ // Return true if and only if we require a user gesture before letting
+ // the media play.
+ bool isUserGestureRequiredForPlay() const;
+ void removeUserGestureRequirement();
+ void setInitialPlayWithoutUserGestures(bool);
+
void audioTracksTimerFired(Timer<HTMLMediaElement>*);
Timer<HTMLMediaElement> m_loadTimer;
@@ -544,7 +560,7 @@ private:
bool m_remoteRoutesAvailable : 1;
bool m_playingRemotely : 1;
bool m_isFinalizing : 1;
- bool m_initialPlayWithoutUserGestures : 1;
+ bool m_initialPlayWithoutUserGesture : 1;
bool m_autoplayMediaCounted : 1;
// Whether this element is in overlay fullscreen mode.
bool m_inOverlayFullscreenVideo : 1;
@@ -617,6 +633,9 @@ private:
friend class Internals;
friend class TrackDisplayUpdateScope;
+ friend class AutoplayExperimentHelper;
+
+ AutoplayExperimentHelper m_autoplayHelper;
static URLRegistry* s_mediaStreamRegistry;
};

Powered by Google App Engine
This is Rietveld 408576698