|
@@ -33,6 +33,7 @@ import com.haochuan.core.http.ResponseListener;
|
|
|
import com.haochuan.core.http.bean.ApkSettingBean;
|
|
|
import com.haochuan.core.http.bean.ResponseBean;
|
|
|
import com.haochuan.core.util.ELS;
|
|
|
+import com.haochuan.core.util.HandlerUtil;
|
|
|
import com.haochuan.hciptvbasic.util.VRUtil;
|
|
|
import com.haochuan.hciptvbasic.webview.PayToJS;
|
|
|
import com.haochuan.hciptvbasic.webview.PlayerToJS;
|
|
@@ -54,6 +55,7 @@ public abstract class BaseWebActivity extends AppCompatActivity {
|
|
|
//播放器
|
|
|
private BaseMediaPlayer mHCPlayer = null;
|
|
|
protected ELS els;
|
|
|
+ VRUtil vrUtil;
|
|
|
|
|
|
//vr模块
|
|
|
MDVRLibrary mVRLibrary;
|
|
@@ -119,20 +121,15 @@ public abstract class BaseWebActivity extends AppCompatActivity {
|
|
|
//初始化日志
|
|
|
Logger.init(this,getWebView());
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- //初始化播放器
|
|
|
- initPlayer();
|
|
|
-
|
|
|
- //初始化vr模块
|
|
|
- mVRLibrary = new VRUtil().createVRLibrary(this,mHCPlayer);
|
|
|
-
|
|
|
webView = new WebView(this);
|
|
|
webView.setBackgroundColor(ContextCompat.getColor(this, android.R.color.transparent));
|
|
|
setContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
|
|
|
|
|
initWebSetting(webView);
|
|
|
|
|
|
+ //初始化播放器和vr
|
|
|
+ initPlayerAndVr();
|
|
|
+
|
|
|
runH5();
|
|
|
}
|
|
|
|
|
@@ -283,8 +280,40 @@ public abstract class BaseWebActivity extends AppCompatActivity {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
+ * 初始化vrLib库
|
|
|
+ * */
|
|
|
+ private void initVrLib(){
|
|
|
+ if(vrUtil == null){
|
|
|
+ vrUtil = new VRUtil();
|
|
|
+ }
|
|
|
+ mVRLibrary = vrUtil.createVRLibrary(this,mHCPlayer);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 初始化播放器和vr
|
|
|
+ */
|
|
|
+ public void initPlayerAndVr(){
|
|
|
+ HandlerUtil.runOnUiThread(()->{
|
|
|
+ Logger.d("刷新播放器");
|
|
|
+ //先将播放器和vr库消除
|
|
|
+ mHCPlayer = null;
|
|
|
+ mVRLibrary = null;
|
|
|
+ if(vrUtil !=null){
|
|
|
+ vrUtil.release(this);
|
|
|
+ }
|
|
|
+ //再初始化播放器和vr库
|
|
|
+ initPlayer();
|
|
|
+ initVrLib();
|
|
|
+ getPlayerToJS().setBaseMediaPlayer(mHCPlayer);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化webview
|
|
|
+ * @param webView
|
|
|
+ */
|
|
|
@SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface", "AddJavascriptInterface"})
|
|
|
private void initWebSetting(WebView webView) {
|
|
|
Logger.d("BaseWebActivity,initWebSetting()");
|