Skip to content

Commit

Permalink
提升兼容性,允许页面加载时自动播放音视频
Browse files Browse the repository at this point in the history
  • Loading branch information
宁伟 committed Feb 20, 2023
1 parent 0ccb895 commit de7741e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
//noinspection ExpiredTargetSdkVersion
targetSdk 26
versionCode 4
versionName '1.7.0-release'
versionName '1.7.1-release'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
import android.content.pm.PackageManager;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

import androidx.appcompat.app.AppCompatActivity;

import com.huozige.lab.container.utilities.ConfigManager;

/**
Expand Down Expand Up @@ -78,6 +74,9 @@ public HACWebView(Context context) {
settings.setBuiltInZoomControls(false); // 不显示缩放按钮
settings.setSupportZoom(false); // 不允许缩放

// 兼容性
settings.setMediaPlaybackRequiresUserGesture(false); // 允许页面加载时自动播放音频

// 启用Debug(全局设置)
WebView.setWebContentsDebuggingEnabled(true); // 使用Chrome调试网页,需要开启这个

Expand Down Expand Up @@ -137,10 +136,6 @@ public void refreshWebView() {
this.loadUrl(target);
}

public AppCompatActivity getActivityContext() {
return (AppCompatActivity)_context;
}

/**
* 页面导航或加载脚本
* 记录日志
Expand Down

0 comments on commit de7741e

Please sign in to comment.