updateVolume();
m_player->load(m_currentSrc, contentType);
-
+
+#if PLATFORM(ANDROID)
+ if (isVideo() && m_player->canLoadPoster()) {
+ KURL posterUrl = static_cast<HTMLVideoElement*>(this)->poster();
+ if (!posterUrl.isEmpty())
+ m_player->setPoster(posterUrl);
+ }
+#endif
+
if (renderer())
renderer()->updateFromElement();
}
virtual void paint(GraphicsContext*, const IntRect&) { }
+#if PLATFORM(ANDROID)
+ virtual bool canLoadPoster() const { return false; }
+ virtual void setPoster(const String&) { }
+#endif
+
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual void setPoster(const String& /*url*/) { }
virtual void deliverNotification(MediaPlayerProxyNotificationType) { }
m_private.set(createNullMediaPlayer(this));
}
-#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+#if PLATFORM(ANDROID)
+bool MediaPlayer::canLoadPoster() const
+{
+ return m_private->canLoadPoster();
+}
+#endif
+
+#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) || PLATFORM(ANDROID)
void MediaPlayer::setPoster(const String& url)
{
m_private->setPoster(url);
-}
+}
#endif
void MediaPlayer::cancelLoad()
MediaPlayerClient* mediaPlayerClient() const { return m_mediaPlayerClient; }
+#if PLATFORM(ANDROID)
+ bool canLoadPoster() const;
+ void setPoster(const String&);
+#endif
+
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
void setPoster(const String& url);
void deliverNotification(MediaPlayerProxyNotificationType notification);
virtual void setAutobuffer(bool) { };
+#if PLATFORM(ANDROID)
+ virtual bool canLoadPoster() const { return false; }
+ virtual void setPoster(const String&) { }
+#endif
+
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
virtual void setPoster(const String& url) = 0;
virtual void deliverNotification(MediaPlayerProxyNotificationType) = 0;
virtual void setSize(const IntSize&);
+ virtual bool canLoadPoster() const { return true; }
+ virtual void setPoster(const String&);
+
virtual void paint(GraphicsContext*, const IntRect&);
private:
// Android-specific methods and fields.
jmethodID m_createView;
jmethodID m_attachView;
jmethodID m_removeView;
+ jmethodID m_setPoster;
};
MediaPlayerPrivate::~MediaPlayerPrivate()
if (!frameView)
return;
- WebViewCore* webViewCore = WebViewCore::getWebViewCore(frameView);
- ASSERT(webViewCore);
jstring jUrl = env->NewString((unsigned short *)m_url.characters(), m_url.length());
env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl);
env->DeleteLocalRef(jUrl);
{
}
+void MediaPlayerPrivate::setPoster(const String& url)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ if (!env)
+ return;
+ jstring jUrl = env->NewString((unsigned short *)url.characters(), url.length());
+ env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_setPoster, jUrl);
+ env->DeleteLocalRef(jUrl);
+ checkException(env);
+}
+
void MediaPlayerPrivate::paint(GraphicsContext*, const IntRect& r)
{
createJavaPlayerIfNeeded();
m_glue->m_createView = env->GetMethodID(clazz, "createView", "()V");
m_glue->m_attachView = env->GetMethodID(clazz, "attachView", "(IIII)V");
m_glue->m_removeView = env->GetMethodID(clazz, "removeView", "()V");
+ m_glue->m_setPoster = env->GetMethodID(clazz, "loadPoster", "(Ljava/lang/String;)V");
m_glue->m_javaProxy = NULL;
env->DeleteLocalRef(clazz);
// An exception is raised if any of the above fails.