diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-07-24 17:10:29 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-07-24 17:22:09 -0700 |
commit | ab49bbea6d85b1c1c6b26c66f402091724712349 (patch) | |
tree | cef0abebc1ffb2e19db050509ac657fdbbd6432d /Source | |
parent | b8cdff9b468cd73ace9ac43eb56b990c25c608bf (diff) | |
parent | 9abcc8af97ee9c535e4d0995b564471b3866f9e4 (diff) | |
download | external_webkit-ab49bbea6d85b1c1c6b26c66f402091724712349.zip external_webkit-ab49bbea6d85b1c1c6b26c66f402091724712349.tar.gz external_webkit-ab49bbea6d85b1c1c6b26c66f402091724712349.tar.bz2 |
Merge "Support autoplay attribute for media element, with optional gesture requirement."
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/html/HTMLMediaElement.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 693f214..f3cc170 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -1036,7 +1036,10 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) if (isPotentiallyPlaying && oldState <= HAVE_CURRENT_DATA) scheduleEvent(eventNames().playingEvent); - +#if PLATFORM(ANDROID) + // autoplay should not be honored if we require user gesture. + if (!(m_restrictions & RequireUserGestureForRateChangeRestriction)) +#endif if (m_autoplaying && m_paused && autoplay()) { m_paused = false; invalidateCachedTime(); diff --git a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index c01d916..409eff6 100644 --- a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -315,6 +315,13 @@ public: m_naturalSize = IntSize(poster->width(), poster->height()); m_player->sizeChanged(); } + // At this time, we know that the proxy has been setup. And it is the + // right time to trigger autoplay through the HTMLMediaElement state + // change. Since we are using the java MediaPlayer, so we have to + // pretend that the MediaPlayer has enough data. + m_readyState = MediaPlayer::HaveEnoughData; + m_player->readyStateChanged(); + } void onPrepared(int duration, int width, int height) |