A port should be able to require a script to be called from a user gesture to start/stop a media element .
Created attachment 27833 [details] proposed patch
Comment on attachment 27833 [details] proposed patch > Index: WebCore/html/HTMLMediaElement.cpp > =================================================================== > void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) > { > ExceptionCode ec; > + > + ++m_internalCall; > load(ec); > + --m_internalCall; I think it would be better for load() to wrap a loadInternal(). load() could do the permissions checking, and loadInternal() should always load. Same with play() and pause(). > Index: WebCore/html/HTMLMediaElement.h > =================================================================== > + enum BehaviorRestrictions > { > - NoLoadRestriction = 0, > - RequireUserGestureLoadRestriction = 1 << 0, > + NoRestrictions = 0, > + RequireUserGestureLoadRestriction = 1 << 0, RequireUserGestureForLoadRestriction > + RequireUserGestureRateChangeRestriction = 1 << 1, RequireUserGestureForRateChangeRestriction > }; > > > @@ -237,7 +238,7 @@ protected: > > OwnPtr<MediaPlayer> m_player; > > - LoadRestrictions m_loadRestrictions; > + BehaviorRestrictions m_Restrictions; m_Restrictions -> m_restrictions
Created attachment 27836 [details] revised patch
Comment on attachment 27836 [details] revised patch > Index: WebCore/html/HTMLMediaElement.cpp > =================================================================== > void HTMLMediaElement::togglePlayState(ExceptionCode& ec) > { > if (canPlay()) > - play(ec); > + playInternal(ec); > else > - pause(ec); > + pauseInternal(ec); > } Maybe add a comment to say why it's always OK to call the internal methods. > Index: WebCore/html/HTMLMediaElement.h > =================================================================== > + void loadInternal(ExceptionCode& ec); > + void playInternal(ExceptionCode& ec); > + void pauseInternal(ExceptionCode& ec); Add a comment to say why these are needed.
Committed revision 41117.