Commit 9c24e1b12cab94a2ea56a9962634765f6c8e3ddd
1 parent
149c7a66
添加探针
Showing
4 changed files
with
37 additions
and
2 deletions
app/src/main/java/com/cnlive/gundam/main/ui/activity/MainActivity.java
| ... | ... | @@ -26,6 +26,7 @@ import com.cnlive.gundam.user.auth.UserService; |
| 26 | 26 | import com.cnlive.gundam.user.model.User; |
| 27 | 27 | import com.cnlive.gundam.video.view.VideoView; |
| 28 | 28 | import com.cnlive.libs.util.Config; |
| 29 | +import com.cnlive.libs.util.ProbeUtil; | |
| 29 | 30 | |
| 30 | 31 | import java.util.Arrays; |
| 31 | 32 | |
| ... | ... | @@ -37,6 +38,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O |
| 37 | 38 | |
| 38 | 39 | private AnchorInfoPresenter mAnchorInfoPresenter; |
| 39 | 40 | |
| 41 | + | |
| 40 | 42 | @Override |
| 41 | 43 | protected void onCreate(Bundle savedInstanceState) { |
| 42 | 44 | super.onCreate(savedInstanceState); |
| ... | ... | @@ -55,6 +57,9 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O |
| 55 | 57 | |
| 56 | 58 | //加载水印图片 |
| 57 | 59 | FileUtil.copyFile(this, "cnlive_logo.png"); |
| 60 | + | |
| 61 | + ProbeUtil.probeSDK("startupCount"); | |
| 62 | + | |
| 58 | 63 | } |
| 59 | 64 | |
| 60 | 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 | 18 | import com.cnlive.gundam.video.utils.PlayerUtils; |
| 19 | 19 | import com.cnlive.gundam.video.view.PlayerAccelerometerSensor; |
| 20 | 20 | import com.cnlive.gundam.video.view.PlayerControllerView; |
| 21 | +import com.cnlive.libs.util.ProbeUtil; | |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * Created by gujun on 2017/6/27. |
| ... | ... | @@ -66,6 +67,7 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS |
| 66 | 67 | if (program == null) return; |
| 67 | 68 | VideoModel model = new VideoModel(program.getTitle(), program.getChannelId(), program.getType(), program.getRates()); |
| 68 | 69 | binding.videoView.setVideoInfo(model); |
| 70 | + ProbeUtil.probeSDK("pgcLiveCount"); | |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | 73 | @Override |
| ... | ... | @@ -88,6 +90,8 @@ public class PlayerLiveFragment extends Fragment implements PlayerAccelerometerS |
| 88 | 90 | super.onPause(); |
| 89 | 91 | binding.videoView.onPause(); |
| 90 | 92 | playerAccelerometerSensor.unregister(); |
| 93 | + | |
| 94 | + | |
| 91 | 95 | } |
| 92 | 96 | |
| 93 | 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 | 17 | import com.cnlive.gundam.video.model.VideoModel; |
| 18 | 18 | import com.cnlive.gundam.video.utils.PlayerUtils; |
| 19 | 19 | import com.cnlive.gundam.video.view.PlayerAccelerometerSensor; |
| 20 | +import com.cnlive.libs.util.ProbeUtil; | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Created by gujun on 2017/4/6. |
| ... | ... | @@ -61,6 +62,7 @@ public class PlayerVodFragment extends Fragment implements PlayerAccelerometerSe |
| 61 | 62 | program = (VideoListProgram) getArguments().getSerializable("program"); |
| 62 | 63 | if (program == null) return; |
| 63 | 64 | VideoModel videoModel = new VideoModel(program.getTitle(), program.getvId(), program.getType(), program.getRates()); |
| 65 | + ProbeUtil.probeSDK("pgcVodCount");//点播播放数量统计 | |
| 64 | 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 | 16 | import com.cnlive.gundam.video.model.DataSource; |
| 17 | 17 | import com.cnlive.gundam.video.model.VideoModel; |
| 18 | 18 | import com.cnlive.libs.util.Config; |
| 19 | +import com.cnlive.libs.util.ProbeUtil; | |
| 19 | 20 | import com.cnlive.libs.util.SharedPreferencesHelper; |
| 20 | 21 | import com.cnlive.libs.video.video.VideoStatusUtil; |
| 21 | 22 | import com.cnlive.libs.video.video.base.IMediaPlayer; |
| ... | ... | @@ -170,9 +171,13 @@ public abstract class BaseVideoView extends RelativeLayout implements |
| 170 | 171 | |
| 171 | 172 | public void onDestroy() { |
| 172 | 173 | binding.videoView.releaseSwitchVideo(); |
| 174 | + boolean playing = binding.videoView.isPlaying(); | |
| 175 | + if(playing){setPlayState(false);} | |
| 173 | 176 | binding.videoView.release(); |
| 174 | 177 | VideoStatusUtil.quit(); |
| 175 | 178 | saveCurPlayPosition(); |
| 179 | + | |
| 180 | + | |
| 176 | 181 | } |
| 177 | 182 | |
| 178 | 183 | //保存当前播放视频的播放进度 |
| ... | ... | @@ -197,8 +202,26 @@ public abstract class BaseVideoView extends RelativeLayout implements |
| 197 | 202 | * @param isPlay |
| 198 | 203 | */ |
| 199 | 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 | 252 | @Override |
| 230 | 253 | public void onCompletion(IMediaPlayer iMediaPlayer) { |
| 231 | 254 | isPlay = false; |
| 255 | + setPlayState(false); | |
| 232 | 256 | } |
| 233 | 257 | |
| 234 | 258 | @Override | ... | ... |