Index: Source/core/html/HTMLMediaElement.h |
diff --git a/Source/core/html/HTMLMediaElement.h b/Source/core/html/HTMLMediaElement.h |
index ca381547f012a480c77082af3fadf6a7b1f44aaf..b84604bb6e4c6dcf2bf624cb4e0ea089625aff12 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(bool recordMetrics = false); |
philipj_slow
2015/09/11 07:17:47
Create an enum for this, like for example "enum cl
liberato (no reviews please)
2015/09/11 19:01:42
Done.
|
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; |
}; |