summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorAndrei Popescu <andreip@google.com>2009-09-28 16:20:09 +0100
committerAndrei Popescu <andreip@google.com>2009-09-30 20:13:22 +0100
commit2b3d345465fdf225609499ffc5b1732157cafa22 (patch)
tree5b4d267c6550902107f26212337d00b8dd6aa920 /WebCore
parent14e3d9bdf2270d399bae78946e3efe62a6c6c373 (diff)
downloadexternal_webkit-2b3d345465fdf225609499ffc5b1732157cafa22.zip
external_webkit-2b3d345465fdf225609499ffc5b1732157cafa22.tar.gz
external_webkit-2b3d345465fdf225609499ffc5b1732157cafa22.tar.bz2
Update <video> implementation after new IRC discussion with Eric Carlsson.
- move poster drawing on the WebKit side - get rid of the child views - add prepareToPlay method to the MediaPlayer iface. Fixes http://b/issue?id=2156592
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/html/HTMLMediaElement.cpp11
-rw-r--r--WebCore/html/HTMLMediaElement.h3
-rw-r--r--WebCore/platform/graphics/MediaPlayer.cpp6
-rw-r--r--WebCore/platform/graphics/MediaPlayer.h1
-rw-r--r--WebCore/platform/graphics/MediaPlayerPrivate.h1
-rw-r--r--WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h17
6 files changed, 38 insertions, 1 deletions
diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp
index 17a3110..f98200d 100644
--- a/WebCore/html/HTMLMediaElement.cpp
+++ b/WebCore/html/HTMLMediaElement.cpp
@@ -1446,6 +1446,13 @@ bool HTMLMediaElement::potentiallyPlaying() const
return !paused() && m_readyState >= HAVE_FUTURE_DATA && !endedPlayback() && !stoppedDueToErrors() && !pausedForUserInteraction();
}
+#if PLATFORM(ANDROID)
+bool HTMLMediaElement::couldPlayIfEnoughData() const
+{
+ return !paused() && !endedPlayback() && !stoppedDueToErrors() && !pausedForUserInteraction();
+}
+#endif
+
bool HTMLMediaElement::endedPlayback() const
{
if (!m_player || m_readyState < HAVE_METADATA)
@@ -1527,6 +1534,10 @@ void HTMLMediaElement::updatePlayState()
float time = currentTime();
if (m_lastSeekTime < time)
m_playedTimeRanges->add(m_lastSeekTime, time);
+#if PLATFORM(ANDROID)
+ } else if (couldPlayIfEnoughData() && playerPaused) {
+ m_player->prepareToPlay();
+#endif
}
if (renderer())
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index 27b48ea..70b686e 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -227,6 +227,9 @@ private:
bool endedPlayback() const;
bool stoppedDueToErrors() const;
bool pausedForUserInteraction() const;
+#if PLATFORM(ANDROID)
+ bool couldPlayIfEnoughData() const;
+#endif
float minTimeSeekable() const;
float maxTimeSeekable() const;
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index 15815dc..531c598 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -107,6 +107,7 @@ public:
#if PLATFORM(ANDROID)
virtual bool canLoadPoster() const { return false; }
virtual void setPoster(const String&) { }
+ virtual void prepareToPlay() { }
#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
@@ -263,6 +264,11 @@ bool MediaPlayer::canLoadPoster() const
{
return m_private->canLoadPoster();
}
+
+void MediaPlayer::prepareToPlay()
+{
+ m_private->prepareToPlay();
+}
#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || PLATFORM(ANDROID)
diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h
index 1cb7625..8eade50 100644
--- a/WebCore/platform/graphics/MediaPlayer.h
+++ b/WebCore/platform/graphics/MediaPlayer.h
@@ -187,6 +187,7 @@ public:
#if PLATFORM(ANDROID)
bool canLoadPoster() const;
void setPoster(const String&);
+ void prepareToPlay();
#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h
index ba0f4b0..109ad10 100644
--- a/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -95,6 +95,7 @@ public:
#if PLATFORM(ANDROID)
virtual bool canLoadPoster() const { return false; }
virtual void setPoster(const String&) { }
+ virtual void prepareToPlay() { }
#endif
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
index 2d76ebb..812a337 100644
--- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
+++ b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
@@ -28,6 +28,8 @@
#if ENABLE(VIDEO)
+class SkBitmap;
+
#include "MediaPlayerPrivate.h"
namespace WebCore {
@@ -79,11 +81,13 @@ public:
virtual bool canLoadPoster() const { return true; }
virtual void setPoster(const String&);
+ virtual void prepareToPlay();
virtual void paint(GraphicsContext*, const IntRect&);
void onPrepared(int duration, int width, int height);
void onEnded();
+ void onPosterFetched(SkBitmap*);
private:
// Android-specific methods and fields.
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
@@ -97,10 +101,21 @@ private:
String m_url;
struct JavaGlue;
JavaGlue* m_glue;
+
float m_duration;
- IntSize m_size;
float m_currentTime;
+
bool m_paused;
+ MediaPlayer::ReadyState m_readyState;
+ MediaPlayer::NetworkState m_networkState;
+
+ SkBitmap* m_poster; // not owned
+ String m_posterUrl;
+
+ IntSize m_naturalSize;
+ bool m_naturalSizeUnknown;
+
+ bool m_isVisible;
};
} // namespace WebCore