本文整理汇总了Java中android.webkit.WebSettings.setMediaPlaybackRequiresUserGesture方法的典型用法代码示例。如果您正苦于以下问题:Java WebSettings.setMediaPlaybackRequiresUserGesture方法的具体用法?Java WebSettings.setMediaPlaybackRequiresUserGesture怎么用?Java WebSettings.setMediaPlaybackRequiresUserGesture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebSettings
的用法示例。
在下文中一共展示了WebSettings.setMediaPlaybackRequiresUserGesture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeSettings
import android.webkit.WebSettings; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" })
public void initializeSettings(WebSettings settings, Context context) {
//setPageCacheCapacity2(settings);
if (API < 18) {
settings.setAppCacheMaxSize(Long.MAX_VALUE);
}
if (API < 17) {
settings.setEnableSmoothTransition(true);
}
if (API > 16) {
settings.setMediaPlaybackRequiresUserGesture(true);
}
if (API >= Build.VERSION_CODES.LOLLIPOP && !mBrowserController.isIncognito()) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
} else if (API >= Build.VERSION_CODES.LOLLIPOP) {
// We're in Incognito mode, reject
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
}
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
settings.setDatabaseEnabled(true);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setAllowContentAccess(true);
settings.setAllowFileAccess(true);
settings.setDefaultTextEncodingName("utf-8");
if (API > 16) {
settings.setAllowFileAccessFromFileURLs(false);
settings.setAllowUniversalAccessFromFileURLs(false);
}
settings.setAppCachePath(context.getDir("appcache", 0).getPath());
settings.setGeolocationDatabasePath(context.getDir("geolocation", 0).getPath());
if (API < Build.VERSION_CODES.KITKAT) {
settings.setDatabasePath(context.getDir("databases", 0).getPath());
}
}
示例2: setMediaPlaybackRequiresUserGesture
import android.webkit.WebSettings; //导入方法依赖的package包/类
static void setMediaPlaybackRequiresUserGesture(WebSettings settings, boolean value) {
settings.setMediaPlaybackRequiresUserGesture(value);
}