integrates the encapsulated IjkPlayer to play the video. When the video is being played, click to return to the mobile desktop. At this time, Activity uses the onPause and onStop methods, and then returns to the onResume method APP to play the original video normally. But when I pop up a native sharing box in the playback interface, I will only use the onPause method, and then I will cancel the sharing box and use the onResume method. At this time, the video will only have sound, and the interface will not continue to play. I didn"t do anything in onStop.
effect:
Activity Lifecycle Code:
@Override
protected void onResume() {
super.onResume();
if (player != null) {
player.onResume();
Log.d(TAG, "1827 onResume");
}
//TODO:bug: ,,
/**demo*/
MediaUtils.muteAudioFocus(mContext, false);
/**demo*/
// if (wakeLock != null) {
// wakeLock.acquire();
// }
}
@Override
protected void onPause() {
super.onPause();
if (player != null) {
player.onPause();
Log.d(TAG, "1827 onPause");
}
/**demo*/
// MediaUtils.muteAudioFocus(mContext, true);
}
@Override
protected void onStop() {
super.onStop();
// if (player != null) {
// player.onPause();
// }
//// /**demo*/
// MediaUtils.muteAudioFocus(mContext, true);
Log.d(TAG, "onStop: 1827");
}
integrates the IjkPlayer: https://blog.csdn.net/u014608.
of this blog.