diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-01-11 10:31:22 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-11 10:31:22 -0800 |
commit | dd6c3b2bf081a084d44a33b59dddea1ca9eef03e (patch) | |
tree | a09ddac74216032e2111888985feb9b28bd1e57e | |
parent | 3c3d37e22bc472db3c836a0d97e7467058f62c9e (diff) | |
parent | 299925eb66dc094d5153fb4027be09bc13e139a0 (diff) | |
download | external_webkit-dd6c3b2bf081a084d44a33b59dddea1ca9eef03e.zip external_webkit-dd6c3b2bf081a084d44a33b59dddea1ca9eef03e.tar.gz external_webkit-dd6c3b2bf081a084d44a33b59dddea1ca9eef03e.tar.bz2 |
Merge "Native function to support restore the media player state"
-rw-r--r-- | Source/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h | 1 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/Source/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h index 404ef08..535e7ae 100644 --- a/Source/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h +++ b/Source/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h @@ -95,6 +95,7 @@ public: virtual void onPosterFetched(SkBitmap*) { } void onBuffering(int percent); void onTimeupdate(int position); + void onRestoreState(); // These following two functions are used to turn on inline video support bool supportsAcceleratedRendering() const { return true; } diff --git a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index 339e91b..7a80925 100644 --- a/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -168,6 +168,14 @@ void MediaPlayerPrivate::onEnded() m_networkState = MediaPlayer::Idle; } +void MediaPlayerPrivate::onRestoreState() +{ + if (!m_paused) { + //Kick off a JNI call to start the video. + play(); + } +} + void MediaPlayerPrivate::onPaused() { m_paused = true; @@ -570,6 +578,15 @@ static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer) } } +static void OnRestoreState(JNIEnv* env, jobject obj, int pointer) +{ + if (pointer) { + WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer); + player->onRestoreState(); + } +} + + // This is called on the UI thread only. // The video layers are composited on the webkit thread and then copied over // to the UI thread with the same ID. For rendering, we are only using the @@ -632,6 +649,8 @@ static JNINativeMethod g_MediaPlayerMethods[] = { (void*) OnPaused }, { "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V", (void*) OnPosterFetched }, + { "nativeOnRestoreState", "(I)V", + (void*) OnRestoreState }, { "nativeSendSurfaceTexture", "(Landroid/graphics/SurfaceTexture;IIII)Z", (void*) SendSurfaceTexture }, { "nativeOnTimeupdate", "(II)V", |