diff options
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp | 2 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 23 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 3 |
3 files changed, 28 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp index bfb5305..3767516 100644 --- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp +++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp @@ -273,6 +273,8 @@ void MediaPlayerPrivate::getSupportedTypes(HashSet<String>&) MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs) { + if (WebViewCore::supportsMimeType(type)) + return MediaPlayer::MayBeSupported; return MediaPlayer::IsNotSupported; } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 1562775..3f3eb42 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -189,6 +189,24 @@ jobject WebViewCore::getApplicationContext() { return result; } + +struct WebViewCoreStaticMethods { + jmethodID m_supportsMimeType; +} gWebViewCoreStaticMethods; + +// Check whether a media mimeType is supported in Android media framework. +bool WebViewCore::supportsMimeType(const WebCore::String& mimeType) { + JNIEnv* env = JSC::Bindings::getJNIEnv(); + jstring jMimeType = env->NewString(mimeType.characters(), mimeType.length()); + jclass webViewCore = env->FindClass("android/webkit/WebViewCore"); + bool val = env->CallStaticBooleanMethod(webViewCore, + gWebViewCoreStaticMethods.m_supportsMimeType, jMimeType); + checkException(env); + env->DeleteLocalRef(jMimeType); + + return val; +} + // ---------------------------------------------------------------------------- #define GET_NATIVE_VIEW(env, obj) ((WebViewCore*)env->GetIntField(obj, gWebViewCoreFields.m_nativeClass)) @@ -3295,6 +3313,11 @@ int register_webviewcore(JNIEnv* env) LOG_ASSERT(gWebViewCoreFields.m_webView, "Unable to find android/webkit/WebViewCore.mWebView"); + gWebViewCoreStaticMethods.m_supportsMimeType = + env->GetStaticMethodID(widget, "supportsMimeType", "(Ljava/lang/String;)Z"); + LOG_ASSERT(gWebViewCoreStaticMethods.m_supportsMimeType == NULL, + "Could not find static method supportsMimeType from WebViewCore"); + return jniRegisterNativeMethods(env, "android/webkit/WebViewCore", gJavaWebViewCoreMethods, NELEM(gJavaWebViewCoreMethods)); } diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 056dba1..2944599 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -578,6 +578,9 @@ namespace android { // if there exists at least on WebViewCore instance then we return the // application context, otherwise NULL is returned. static jobject getApplicationContext(); + + // Check whether a media mimeType is supported in Android media framework. + static bool supportsMimeType(const WebCore::String& mimeType); }; } // namespace android |
