|
@@ -21,6 +21,7 @@ import android.view.animation.LinearInterpolator;
|
|
|
import android.webkit.WebView;
|
|
|
import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
+import android.widget.ProgressBar;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
@@ -52,7 +53,7 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
AndroidToJS.PlayVideoListener, HCWebViewClient.WebViewErrorListener, AndroidToJS.ThirdActivityManager {
|
|
|
|
|
|
final String url = com.hc.model.BuildConfig.Domain + com.hc.model.BuildConfig.port + "/h5v2/index.html";
|
|
|
- //final String url = "http://112.35.32.145:8090/h5v2/template/haochuan.html";
|
|
|
+ //final String url = "http://112.18.251.84:8090/tv/h5v2/activity/zt20190218/index.html?source_type=ztList&source_type_val=20190218";
|
|
|
private static final String KEY_INTENT = "params";
|
|
|
|
|
|
private SingleLiveEvent<String> loginMsg = new SingleLiveEvent<>();
|
|
@@ -63,6 +64,7 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
private VideoControlDelegate controlDelegate;
|
|
|
private UserViewModel userViewModel;
|
|
|
private View messageView;
|
|
|
+ private ProgressBar loading;
|
|
|
|
|
|
private boolean isFinish = false;
|
|
|
|
|
@@ -82,9 +84,9 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
@Override
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
+ loading = findViewById(R.id.loading_bar);
|
|
|
observer();
|
|
|
Log.d("weilai","loadH5");
|
|
|
- loadH5();
|
|
|
|
|
|
String adImage = LocalStore.getInstance().getOpenAdImage();
|
|
|
if (!TextUtils.isEmpty(adImage)) {
|
|
@@ -230,6 +232,7 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
Toast.makeText(this,"视频链接错误!",Toast.LENGTH_SHORT).show();
|
|
|
return;
|
|
|
}
|
|
|
+ Log.d(TAG,"playFloatVideo");
|
|
|
if(!hasShowWebView){
|
|
|
hasOneFloatViewToShow = true;
|
|
|
lastVideoInfo = new VideoInfo(url,x,y,width,height,uid,sourceId,title,examineId,examineType,limitTime);
|
|
@@ -246,6 +249,7 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
@Override
|
|
|
public void playFullVideo(String url, String title, String uid, String sourceId, int limitTime, boolean hadFloatVideo, String examineId, String examineType, boolean isShowCompletedDialog) {
|
|
|
this.hadFloatVideo = hadFloatVideo;
|
|
|
+ Log.d(TAG,"playFullVideo");
|
|
|
runOnUiThread(() -> {
|
|
|
// getWebView().setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
|
|
if (hadFloatVideo && TextUtils.isEmpty(url)) {
|
|
@@ -265,10 +269,9 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
* 全屏播放逻辑
|
|
|
*/
|
|
|
private void playVideo(String url, String title, String uid, String sourceId, int limitTime, String examineId, String examineType, boolean isShowCompletedDialog) {
|
|
|
-
|
|
|
isFullScreenVideo = true;
|
|
|
controlDelegate.setFullVideo(true);
|
|
|
-
|
|
|
+ Log.d(TAG,"playVideo");
|
|
|
if (YSTVideoPlayer.getParent() == null) {
|
|
|
ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
|
|
|
viewGroup.addView(YSTVideoPlayer);
|
|
@@ -311,7 +314,6 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
private void playVideo(String url, String title, String uid, String sourceId, int x, int y, int width, int height,
|
|
|
String examineId, String examineType, int limitTime) {
|
|
|
initVideoParamsIfNotInit(x, y, width, height);
|
|
|
-
|
|
|
controlDelegate.setUid(uid);
|
|
|
controlDelegate.setSourceId(sourceId);
|
|
|
|
|
@@ -444,6 +446,7 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
* */
|
|
|
|
|
|
public void favoritePlay(String sourceId,String title){
|
|
|
+ OttLoginUtil.getInstance().reportLog(4,"16," + sourceId );
|
|
|
new LastPlayTimeStore(this).insert(title,sourceId);
|
|
|
String url = com.hc.model.BuildConfig.Domain + com.hc.model.BuildConfig.port +"/index.php?m=Home&c=ApiV2&a=getExamineData&source_id="
|
|
|
+ sourceId ;
|
|
@@ -489,6 +492,23 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
controlDelegate.setSourceId(sourceId);
|
|
|
}
|
|
|
});
|
|
|
+ }else if (jsonObject.getInt("code") == -3){
|
|
|
+ Toast("该视频未审核,不能播放");
|
|
|
+ MainActivity.this.runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ destroyVideo();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Toast("获取视频信息失败,不能播放");
|
|
|
+ MainActivity.this.runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ destroyVideo();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
@@ -497,6 +517,15 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void Toast(final String msg){
|
|
|
+ runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Toast.makeText(MainActivity.this,msg,Toast.LENGTH_SHORT).show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* 获取机顶盒信息
|
|
|
* */
|
|
@@ -550,6 +579,9 @@ public class MainActivity extends BaseWebActivity implements OttLoginUtil.OnOttL
|
|
|
@Override
|
|
|
public void onOttLoginSuccess() {
|
|
|
// loginMsg.setValue("OTT登陆成功");
|
|
|
+ Log.d(TAG,"onOttLoginSuccess");
|
|
|
+ loading.setVisibility(View.INVISIBLE);
|
|
|
+ loadH5();
|
|
|
}
|
|
|
|
|
|
@Override
|