From eecb7100325b3007fba928baa2b055907a2fc40a Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 17 Jan 2011 18:07:48 +0000 Subject: Maintain the seek position for HTML5 Video When the video is paused, remember where we got to so that when the video is started again we can seek to the correct position and continue where we left off. Requires a change in frameworks/base. (I6b92289d4ef36bba1e0429327917533a4101655d) Bug:3303721 Change-Id: I6001f45a362f491e9040c8b52260d0a08fb8504f --- WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'WebKit') diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index c562bb4..2158075 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -149,7 +149,6 @@ void MediaPlayerPrivate::onEnded() { m_currentTime = duration(); m_player->timeChanged(); m_paused = true; - m_currentTime = 0; m_hasVideo = false; m_networkState = MediaPlayer::Idle; m_readyState = MediaPlayer::HaveNothing; @@ -157,7 +156,6 @@ void MediaPlayerPrivate::onEnded() { void MediaPlayerPrivate::onPaused() { m_paused = true; - m_currentTime = 0; m_hasVideo = false; m_networkState = MediaPlayer::Idle; m_readyState = MediaPlayer::HaveNothing; @@ -189,8 +187,12 @@ public: return; m_paused = false; + + if (m_currentTime == duration()) + m_currentTime = 0; + jstring jUrl = wtfStringToJstring(env, m_url); - env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl); + env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl, static_cast(m_currentTime * 1000.0f)); env->DeleteLocalRef(jUrl); checkException(env); @@ -272,7 +274,7 @@ public: m_glue = new JavaGlue; m_glue->m_getInstance = env->GetStaticMethodID(clazz, "getInstance", "(Landroid/webkit/WebViewCore;I)Landroid/webkit/HTML5VideoViewProxy;"); m_glue->m_loadPoster = env->GetMethodID(clazz, "loadPoster", "(Ljava/lang/String;)V"); - m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;)V"); + m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;I)V"); m_glue->m_teardown = env->GetMethodID(clazz, "teardown", "()V"); m_glue->m_seek = env->GetMethodID(clazz, "seek", "(I)V"); -- cgit v1.1