CB-8112 Turn off mediaPlaybackRequiresUserGesture
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/132650df Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/132650df Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/132650df Branch: refs/heads/4.0.x Commit: 132650df28a22e61fe6db1206546acd6ddf16988 Parents: 81a7794 Author: Andrew Grieve <[email protected]> Authored: Wed Dec 3 10:04:54 2014 -0500 Committer: Andrew Grieve <[email protected]> Committed: Wed Dec 3 10:04:54 2014 -0500 ---------------------------------------------------------------------- .../src/org/apache/cordova/CordovaWebView.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-android/blob/132650df/framework/src/org/apache/cordova/CordovaWebView.java ---------------------------------------------------------------------- diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 4d01f58..62a641b 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -215,8 +215,12 @@ public class CordovaWebView extends WebView { // Jellybean rightfully tried to lock this down. Too bad they didn't give us a whitelist // while we do this - if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { Level16Apis.enableUniversalAccess(settings); + } + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { + Level17Apis.setMediaPlaybackRequiresUserGesture(settings, false); + } // Enable database // We keep this disabled because we use or shim to get around DOM_EXCEPTION_ERROR_16 String databasePath = getContext().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath(); @@ -831,12 +835,19 @@ public class CordovaWebView extends WebView { // Wrapping these functions in their own class prevents warnings in adb like: // VFY: unable to resolve virtual method 285: Landroid/webkit/WebSettings;.setAllowUniversalAccessFromFileURLs @TargetApi(16) - private static class Level16Apis { + private static final class Level16Apis { static void enableUniversalAccess(WebSettings settings) { settings.setAllowUniversalAccessFromFileURLs(true); } } - + + @TargetApi(17) + private static final class Level17Apis { + static void setMediaPlaybackRequiresUserGesture(WebSettings settings, boolean value) { + settings.setMediaPlaybackRequiresUserGesture(value); + } + } + public void printBackForwardList() { WebBackForwardList currentList = this.copyBackForwardList(); int currentSize = currentList.getSize(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
