Commit 9c24e1b12cab94a2ea56a9962634765f6c8e3ddd

Authored by 陈硕
1 parent 149c7a66

添加探针

app/src/main/java/com/cnlive/gundam/main/ui/activity/MainActivity.java
@@ -26,6 +26,7 @@ import com.cnlive.gundam.user.auth.UserService; @@ -26,6 +26,7 @@ import com.cnlive.gundam.user.auth.UserService;
26 import com.cnlive.gundam.user.model.User; 26 import com.cnlive.gundam.user.model.User;
27 import com.cnlive.gundam.video.view.VideoView; 27 import com.cnlive.gundam.video.view.VideoView;
28 import com.cnlive.libs.util.Config; 28 import com.cnlive.libs.util.Config;
  29 +import com.cnlive.libs.util.ProbeUtil;
29 30
30 import java.util.Arrays; 31 import java.util.Arrays;
31 32
@@ -37,6 +38,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O @@ -37,6 +38,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
37 38
38 private AnchorInfoPresenter mAnchorInfoPresenter; 39 private AnchorInfoPresenter mAnchorInfoPresenter;
39 40
  41 +
40 @Override 42 @Override
41 protected void onCreate(Bundle savedInstanceState) { 43 protected void onCreate(Bundle savedInstanceState) {
42 super.onCreate(savedInstanceState); 44 super.onCreate(savedInstanceState);
@@ -55,6 +57,9 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O @@ -55,6 +57,9 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
55 57
56 //加载水印图片 58 //加载水印图片
57 FileUtil.copyFile(this, "cnlive_logo.png"); 59 FileUtil.copyFile(this, "cnlive_logo.png");
  60 +
  61 + ProbeUtil.probeSDK("startupCount");
  62 +
58 } 63 }
59 64
60 @Override 65 @Override
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerLiveFragment.java
@@ -18,6 +18,7 @@ import com.cnlive.gundam.video.model.VideoModel; @@ -18,6 +18,7 @@ import com.cnlive.gundam.video.model.VideoModel;
18 import com.cnlive.gundam.video.utils.PlayerUtils; 18 import com.cnlive.gundam.video.utils.PlayerUtils;
19 import com.cnlive.gundam.video.view.PlayerAccelerometerSensor; 19 import com.cnlive.gundam.video.view.PlayerAccelerometerSensor;
20 import com.cnlive.gundam.video.view.PlayerControllerView; 20 import com.cnlive.gundam.video.view.PlayerControllerView;
  21 +import com.cnlive.libs.util.ProbeUtil;
21 22
22 /** 23 /**
23 * Created by gujun on 2017/6/27. 24 * Created by gujun on 2017/6/27.
@@ -66,6 +67,7 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS @@ -66,6 +67,7 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS
66 if (program == null) return; 67 if (program == null) return;
67 VideoModel model = new VideoModel(program.getTitle(), program.getChannelId(), program.getType(), program.getRates()); 68 VideoModel model = new VideoModel(program.getTitle(), program.getChannelId(), program.getType(), program.getRates());
68 binding.videoView.setVideoInfo(model); 69 binding.videoView.setVideoInfo(model);
  70 + ProbeUtil.probeSDK("pgcLiveCount");
69 } 71 }
70 72
71 @Override 73 @Override
@@ -88,6 +90,8 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS @@ -88,6 +90,8 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS
88 super.onPause(); 90 super.onPause();
89 binding.videoView.onPause(); 91 binding.videoView.onPause();
90 playerAccelerometerSensor.unregister(); 92 playerAccelerometerSensor.unregister();
  93 +
  94 +
91 } 95 }
92 96
93 @Override 97 @Override
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerVodFragment.java
@@ -17,6 +17,7 @@ import com.cnlive.gundam.video.fragment.chat.CommentFragment; @@ -17,6 +17,7 @@ import com.cnlive.gundam.video.fragment.chat.CommentFragment;
17 import com.cnlive.gundam.video.model.VideoModel; 17 import com.cnlive.gundam.video.model.VideoModel;
18 import com.cnlive.gundam.video.utils.PlayerUtils; 18 import com.cnlive.gundam.video.utils.PlayerUtils;
19 import com.cnlive.gundam.video.view.PlayerAccelerometerSensor; 19 import com.cnlive.gundam.video.view.PlayerAccelerometerSensor;
  20 +import com.cnlive.libs.util.ProbeUtil;
20 21
21 /** 22 /**
22 * Created by gujun on 2017/4/6. 23 * Created by gujun on 2017/4/6.
@@ -61,6 +62,7 @@ public class PlayerVodFragment extends Fragment implements PlayerAccelerometerSe @@ -61,6 +62,7 @@ public class PlayerVodFragment extends Fragment implements PlayerAccelerometerSe
61 program = (VideoListProgram) getArguments().getSerializable("program"); 62 program = (VideoListProgram) getArguments().getSerializable("program");
62 if (program == null) return; 63 if (program == null) return;
63 VideoModel videoModel = new VideoModel(program.getTitle(), program.getvId(), program.getType(), program.getRates()); 64 VideoModel videoModel = new VideoModel(program.getTitle(), program.getvId(), program.getType(), program.getRates());
  65 + ProbeUtil.probeSDK("pgcVodCount");//点播播放数量统计
64 binding.videoView.setVideoInfo(videoModel); 66 binding.videoView.setVideoInfo(videoModel);
65 } 67 }
66 68
app/src/main/java/com/cnlive/gundam/video/view/BaseVideoView.java
@@ -16,6 +16,7 @@ import com.cnlive.gundam.databinding.LayoutVideoViewBinding; @@ -16,6 +16,7 @@ import com.cnlive.gundam.databinding.LayoutVideoViewBinding;
16 import com.cnlive.gundam.video.model.DataSource; 16 import com.cnlive.gundam.video.model.DataSource;
17 import com.cnlive.gundam.video.model.VideoModel; 17 import com.cnlive.gundam.video.model.VideoModel;
18 import com.cnlive.libs.util.Config; 18 import com.cnlive.libs.util.Config;
  19 +import com.cnlive.libs.util.ProbeUtil;
19 import com.cnlive.libs.util.SharedPreferencesHelper; 20 import com.cnlive.libs.util.SharedPreferencesHelper;
20 import com.cnlive.libs.video.video.VideoStatusUtil; 21 import com.cnlive.libs.video.video.VideoStatusUtil;
21 import com.cnlive.libs.video.video.base.IMediaPlayer; 22 import com.cnlive.libs.video.video.base.IMediaPlayer;
@@ -170,9 +171,13 @@ public abstract class BaseVideoView extends RelativeLayout implements @@ -170,9 +171,13 @@ public abstract class BaseVideoView extends RelativeLayout implements
170 171
171 public void onDestroy() { 172 public void onDestroy() {
172 binding.videoView.releaseSwitchVideo(); 173 binding.videoView.releaseSwitchVideo();
  174 + boolean playing = binding.videoView.isPlaying();
  175 + if(playing){setPlayState(false);}
173 binding.videoView.release(); 176 binding.videoView.release();
174 VideoStatusUtil.quit(); 177 VideoStatusUtil.quit();
175 saveCurPlayPosition(); 178 saveCurPlayPosition();
  179 +
  180 +
176 } 181 }
177 182
178 //保存当前播放视频的播放进度 183 //保存当前播放视频的播放进度
@@ -197,8 +202,26 @@ public abstract class BaseVideoView extends RelativeLayout implements @@ -197,8 +202,26 @@ public abstract class BaseVideoView extends RelativeLayout implements
197 * @param isPlay 202 * @param isPlay
198 */ 203 */
199 protected void setPlayState(boolean isPlay) { 204 protected void setPlayState(boolean isPlay) {
200 - if (isPlay) binding.videoView.start();  
201 - else binding.videoView.pause(); 205 + if (isPlay) {
  206 + if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) {
  207 + ProbeUtil.probeSDK("ugcLiveStart");
  208 + } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) {
  209 + ProbeUtil.probeSDK("pgcLiveStart");
  210 + } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) {
  211 + ProbeUtil.probeSDK("ugcVodStart");
  212 + }
  213 + binding.videoView.start();
  214 + } else {
  215 + if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) {
  216 + ProbeUtil.probeSDK("ugcLiveEnd");
  217 + } else if (videoModel.getType().equals(VideoView.TYPE_LIVE)) {
  218 + ProbeUtil.probeSDK("pgcLiveEnd");
  219 + } else if (videoModel.getType().equals(VideoView.TYPE_UGC_VOD)) {
  220 + ProbeUtil.probeSDK("ugcVodEnd");
  221 + }
  222 + binding.videoView.pause();
  223 + }
  224 +
202 } 225 }
203 226
204 /** 227 /**
@@ -229,6 +252,7 @@ public abstract class BaseVideoView extends RelativeLayout implements @@ -229,6 +252,7 @@ public abstract class BaseVideoView extends RelativeLayout implements
229 @Override 252 @Override
230 public void onCompletion(IMediaPlayer iMediaPlayer) { 253 public void onCompletion(IMediaPlayer iMediaPlayer) {
231 isPlay = false; 254 isPlay = false;
  255 + setPlayState(false);
232 } 256 }
233 257
234 @Override 258 @Override